Cis102 chapter 5

¡Supera tus tareas y exámenes ahora con Quizwiz!

A ________ constant is a name that references a value that cannot be changed while the program runs.

global

A ________ variable is accessible to all the functions in a program file.

global

The first line in a function definition is known as the function

header

A(n) ________ chart is also known as a structured chart.

hierarchy

Which of the following statements causes the interpreter to load the contents of the random module into memory?

import random

The Python library functions that are built into the Python ________ can be used by simply calling the required function.

interpreter

A ________ variable is created inside a function.

local

The ________ design technique can be used to break down an algorithm into functions.

top-down

Python allows you to pass multiple arguments to a function.

true

python function names follow the same rules as those for naming variables.

true

Which of the following functions returns the largest integer that is less than or equal to its argument?

floor

One reason to store graphics functions in a module is so that you can import the module into any program that needs to use those functions.

True

What will be displayed after the following code is executed? def pass_it(x, y): z = x*yresult = get_result(z)return(result) def get_result(number): z = number + 2return(z)num1 = 3num2 = 4answer = pass_it(num1, num2) print(answer)

14

Different functions can have local variables with the same names.

True

What will display after the following code is executed?def main():print("The answer is", magic(5))def magic(num):answer = num + 2 * 10 return answermain()

25

What will be the output after the following code is executed? def pass_it(x, y): z = y**xreturn(z) num1 = 3 num2 = 4 answer = pass_it(num1, num2) print(answer)

64

What type of function can be used to determine whether a number is even or odd?

Boolean

A function definition specifies what a function does and causes the function to execute.

False

Unlike other languages, in Python the number of values a function can return is limited to one.

False

What will be the output after the following code is executed? def pass_it(x, y): z = x + ", " + yreturn(z) name2 = "Tony" name1 = "Gaddis" fullname = pass_it(name1, name2) print(fullname)

Gaddis, Tony

It is recommended that programmers avoid using ________ variables in a program whenever possible

Global

The Python standard library's ________ module contains numerous functions that can be used in mathematical calculations.

Math

What will be the output after the following code is executed? def pass_it(x, y): z = x , ", " , y num1 = 4 num2 = 8 answer = pass_it(num1, num2) print(answer)

None

A(n) ________ is a variable that receives an argument that is passed into a function.

Parameter

What does the following statement mean? num1, num2 = get_num()

The function get_num() is expected to return a value for num1 and for num2.

The function header marks the beginning of the function definition.

True

The randrange function returns a randomly selected value from a specific sequence of numbers.

True

n Python you can have a list of variables on the left side of the argument operator.

True

What is a group of statements that exists within a program for the purpose of performing a specific task?

a function

A value-returning function is

a function that will return a value back to the part of the program that called it

A set of statements that belong together as a group and contribute to the function definition is known as a

block

When a function is called by its name during the execution of a program, then it is

executed

A local variable can be accessed from anywhere in the program.

false

A(n) ________ is any piece of data that is passed into a function when the function is called.

number = random.randint(1, 50)

in a value-returning function, the value of the expression that follows the keyword ________ will be sent back to the part of the program that called the function.

return

The ________ of a local variable is the function in which that variable is created.

scope

Python comes with ________ functions that have already been prewritten for the programmer.

standard


Conjuntos de estudio relacionados

Research Methods and Statistics Prepjet Exam #2,3,4,5,7

View Set

BTS 161 - Excel Ch 1 - Creating a Worksheet and Charting Data- Part 2

View Set