Chapter 5 review questions and T/F
A local variable can be accessed by all the functions in a program.
false
A statement in one function can access a local variable in another function.
false
Boolean functions have no return type.
false
Calling a function and defining a function mean the same thing.
false
In Python you cannot write functions that accept multiple arguments.
false
The phrase "divide and conquer" means that all of the programmers on a team should be divided and work in isolation.
false
The value of a global constant can only be changed within a function.
false
You do not need to have an import statement in a program to use the functions in the random module.
false
A group of statements that exist within a program for the purpose of performing a specific task is a(n) __________. a. block b. parameter c. function d. expression
function
A global variable whose value cannot be changed is known as __________. a. global constant b. local variable c. global variable d. local constant
global constant
A variable that is visible to every function in a program file is a __________. a. local variable b. universal variable c. program-wide variable d. global variable
global variable
The first line of a function definition is known as the __________. a. body b. introduction c. initialization d. header
header
A __________ is a diagram that gives a visual representation of the relationships between functions in a program. a. flowchart b. function relationship chart c. symbol chart d. hierarchy chart
hierarchy chart
20. This is not a function of math module. a. hypot (x, y) b. radians (x) c. sin (x) d. len (x)
len(x)
This is a prewritten function that is built into a programming language. a. standard function b. library function c. custom function d. cafeteria function
library function
A __________ is a variable that is created inside a function. a. global variable b. local variable c. hidden variable d. none of the above; you cannot create a variable inside a function
local variable
A variable created inside a function block is known as a __________. a. global variable b. local variable c. super variable d. new variable
local variable
A(n) __________ is a special variable that receives a piece of data when a function is called. a. argument b. parameter c. header d. packet
parameter
This standard library function returns a random floating-point number in the range of 0.0 up to 1.0 (but not including 1.0). a. random b. randint c. random_integer d. uniform
randint
This statement causes a function to end and sends a value back to the part of the pro- gram that called the function. a. end b. send c. exit d. return
return
A(n) __________ is the part of a program in which a variable may be accessed. a. declaration space b. area of visibility c. scope d. mode
scope
This value initializes the formula that generates random numbers. a. dummy value b. random value c. seed value d. new value
seed value
A design technique that programmers use to break down an algorithm into functions is known as __________. a. top-down design b. code simplification c. code refactoring d. hierarchical subtasking
top-down design
A hierarchy chart does not show the steps that are taken inside a function.
true
An import statement can be used to call a built-in function that is stored in a module.
true
Complex mathematical expressions can sometimes be simplified by breaking out part of the expression and putting it in a function.
true
IPO charts provide only brief descriptions of a function's input, processing, and output, but do not show the specific steps taken in a function.
true
Some library functions are built into the Python interpreter.
true
Void functions do not return any value when they are called.
true
You cannot have both keyword arguments and non-keyword arguments in a function call.
true
This standard library function returns a random floating-point number within a speci- fied range of values. a. random b. randint c. random_integer d. uniform
uniform
A(n) __________ is a piece of data that is sent into a function. a. argument b. parameter c. header d. packet
argument
When possible, you should avoid using __________ variables in a program. a. local b. global c. reference d. parameter
b. global
This type of function returns either True or False. a. Binary b. true_false c. Boolean d. logical
boolean
A design technique that helps to reduce the duplication of code within a program and is a benefit of using functions is __________. a. code reuse b. divide and conquer c. debugging d. facilitation of teamwork
code reuse