COSC 1436 Python Quiz 5
The first line in a function definition is known as the function
header
A(n) ________ chart is a visual representation of the relationships between functions.
hierarchy
Which of the following statements causes the interpreter to load the contents of the RANDOM module into memory?
import random
A ________ variable is created inside a function
local
The approach known as ______ names a program easier to understand, test, and maintain.
modularization
Functions that are in the standard library are stored in files that are known as________.
modules
The top-down design breaks down the overall task of a program into a series of
subtasks
The top-down design breaks down the overall task of a program into a series of________.
subtasks
The _______ design technique can be used to break down an algorithm into functions.
top-down
In Python you can have a list of variables on the left side of the argument operator
True
One reason not to use global variables is that it makes a program hard to debug.
True
In Python, a module's file name should end in __________.
.py
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
Which of the following functions returns the largest integer that is less than or equal to its argument?
floor
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
What will be displayed after the following code is executed? def pass_it(x,y): z= x*y result= get_result (z) return (result) def get_result(number): z= number + 2 return (z) num1= 3 num2= 4 answer= pass_it(num1, num2) print(answer)
14
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 answer main()
25
A value-returning function is
A function that will return a value back to the part of the program that called it.
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
A local variable can be accessed from anywhere in the program.
False
In Python there is no restriction on the name of a module file.
False
The value assigned to a global constant can be changed in the mainline logic.
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 codes is executed? def pass_it(x,y): z= x + ", " +y return(z) name2= "Tony" name1= "Gaddis" fullname = pass_it(name1, name2) print(fullname)
Gaddis, Tony
A ________ variable is accessible to all the functions in a program file.
Global
The _________ chart is an effective tool used by programmers to design and document functions.
IPO
A(n) ___________ is a variable that recieves an argument that is passed into a function.
Parameter
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
Python function names follow the same rules as those for naming variables
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
The function header marks the beginning of the function definition.
True
To assign a value to a global variable in a function, the global variable must be first declared the function.
True
A(n) _________ is any piece of data that is passed into a function when the function is called.
argument
A set of statements that belong together as a group and contribute to the function definition is known as a
block
The function header begins with the keyword _________ and is followed by the name of the function.
def
The code for a function is known as a function_________.
definition
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
Arguments are passed by __________ to the corresponding parameter variables in a function.
position
The 'P' in the acronym IPO refers to __________.
processing
The return values of the trigonometric functions in Python are in __________.
radian
In a flowchart, a function call is depicted by a(n) ________.
rectangle
A value-returning function has a(n) _________ statement that sends a value back to the part of the program that called it.
return
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
A variable is available only to statements in the variable's __________.
scope
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