Chapter 5: Functions
Block
A set of statements that belong together as a group and contribute to the function definition is known as a
Hierarchy
A(n) ________ chart is also known as a structured chart.
Parameter
A(n) ________ is a variable that receives an argument that is passed into a function.
Argument
A(n) ________ is any piece of data that is passed into a function when the function is called.
A function definition specifies what a function does and causes the function to execute.
False
In Python there is no restriction on the name of a module file.
False
One of the drawbacks of a modularized program is that the only structure you can use in such a program is the sequence structure.
False
The value assigned to a global constant can be changed in the mainline logic.
False
Unfortunately, there is no way to store and call on functions when using turtle graphics.
False
Unlike other languages, in Python the number of values a function can return is limited to one.
False
Global
It is recommended that programmers avoid using ________ variables in a program whenever possible.
Standard
Python comes with ________ functions that have already been prewritten for the programmer.
Header
The first line in a function definition is known as the function
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.
Different functions can have local variables with the same names.
True
One reason not to use global variables is that it makes a program hard to debug.
True
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
The math function ceil(x) returns the smallest integer that is greater than or equal to x.
True
The randrange function returns a randomly selected value from a specific sequence of numbers.
True
To assign a value to a global variable in a function, the global variable must be first declared in the function.
True
A function
What is a group of statements that exists within a program for the purpose of performing a specific task?
Which of the following will assign a random integer in the range of 1 through 50 to the variable number?
number = random.randint(1, 50)
The math function atan(x) returns one tangent of x in radians.
False
Global
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.
Local
A ________ variable is created inside a function.
A hierarchy chart shows all the steps that are taken inside a function.
False
A local variable can be accessed from anywhere in the program.
False
Interpreter
The Python library functions that are built into the Python ________ can be used by simply calling the required function.
Top-Down
The ________ design technique can be used to break down an algorithm into functions.
Scope
The ________ of a local variable is the function in which that variable is created.
Boolean
What type of function can be used to determine whether a number is even or odd?
Executed
When a function is called by its name during the execution of a program, then it is
Import random
Which of the following statements causes the interpreter to load the contents of the random module into memory?
A value-returning function is
a function that will return a value back to the part of the program that called it
A value-returning function is like a simple function except that when it finishes it returns a value back to the part of the program that called it.
True
In Python you can have a list of variables on the left side of the argument operator.
True
Python allows you to pass multiple arguments to a function.
True
Python functions names follow the same rules as those for naming variables
True
The function header marks the beginning of the function definition.
True