COSC 1436 C++ Chapter 6 Quiz
When used as parameters, these types of variables allow a function to access the parameter's original argument.
reference
Look at the following function prototype. int myFunction(double, double, double); int myFunction(double, double, double); How many parameter variables does this function have?
3
This type of variable is defined inside a function and is not accessible outside the function.
local
A function ________ eliminates the need to place a function definition before all calls to the function.
prototype
This statement causes a function to end.
return
What is the output of the following program? Group of answer choices
2 0 2
This is a collection of statements that performs a specific task.
function
A function can have zero to many parameters, and it can return this many values.
only one
Given the following function definition: What is the output of the following code fragment that invokes calc?
1 6 3
What is the output of the following program? Group of answer choices
7
Local variables are initialized to zero by default.
False
When a function is called, flow of control moves to the function's prototype.
False
It is possible for a function to have some parameters with default arguments and some without.
True
One reason for using functions is to break programs into manageable units, or modules.
True
A function's return data type must be the same as the function's parameter(s).
False
A local variable and a global variable may not have the same name within the same program.
False
What is the output of the following program?
2 0 0
Which line in the following program contains the header for the showDub function?
4
If a function is called more than once in a program, the values stored in the function's local variables do not ________ between function calls.
persist
A parameter is a special-purpose variable that is declared inside the parentheses of a function definition.
True
A static variable that is defined within a function is initialized only once, the first time the function is called.
True
A(n) ________ is information that is passed to a function, and a(n) ________ is information that is received by a function.
argument, parameter
Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function.
call
A function is executed when it is:
called
In a function header, you must furnish:
data type(s) of the parameters data type of the return value names of parameter variables the name of function All of these
A function ________ contains the statements that make up the function. Group of answer choices
definition
Look at the following function prototype. int myFunction(double);int myFunction(double); What is the data type of the function's parameter variable?
double
Look at the following function prototype. int myFunction(double);int myFunction(double); What is the data type of the function's return value?
double
This is a statement that causes a function to execute.
function call