Functions and modules Flashcards
A ___________ variable is created inside a function and cannot be accessed by the statements that are outside the function.
local
insider
global
constant
local
After the Python interpreter executes the function body, ________.
it jumps to the next function in the module
it prompts the user for the next step
it terminates the program
it returns back to the calling point
it returns back to the calling point
________ provide the basic means of code reuse.
Functions
Selection structures
Sequences
Variables
Functions
The randrange function returns a randomly selected value from a specific sequence of numbers.
TRUE
FALSE
TRUE
A/an _____________ is any piece of data that is passed into a function when the function is called.
global
scope
local file
argument
argument
The first line in the function definition is known as the function __________.
header parameters block body header
header
Programmers should avoid using ______ variables in their programs when possible.
global float integer constant string
global
Different functions cannot have local variables with the same names.
TRUE
FALSE
FALSE
Python function names follow the same rules for naming variables.
TRUE
FALSE
TRUE
If a file with the specified name already exists when the file is opened and the file is opened in ‘w’ mode, then an alert will appear on the screen.
TRUE
FALSE
FALSE
Python function names follow the same rules as those for naming variables.
TRUE
FALSE
TRUE
One reason not to use global variables is that it makes a program hard to debug.
TRUE
FALSE
TRUE
In Python there is no restriction on the name of a module file.
TRUE
FALSE
FALSE
The randrange function returns a randomly selected value from a specific sequence of numbers.
TRUE
FALSE
TRUE
The math function atan(x) returns the tangent of x in radians.
TRUE
FALSE
FALSE