Chapter 5 Multiple choice questions Flashcards
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
A function.
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.
The first line of a function definition is known as the ______.
a) body
b) introduction
c) initialization
d) header
The first line of a function definition is known as the header.
You ______ a function to execute it.
a) define
b) call
c) import
d) export
You call a function to execute it.
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 ______ 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
A hierarchy chart.
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
A local variable.
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
A variable’s scope.
A(n) ______ is a piece of data that is sent into a function.
a) argument
b) parameter
c) header
d) packet
An argument.
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
A parameter.
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
A global variable.
When possible, you should avoid using ______ variables in a program.
a) local
b) global
c) reference
d) parameter
global variables.
This is a prewritten function that is built into a programming language.
a) standard function
b) library function
c) custom function
d) cafeteria function
A library function.
This standard library function returns a random integer within a specified range of values.
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 program that called the function.
a) end
b) send
c) exit
d) return
The return statement.