C++ Chapter 6 quiz
Look at the following function prototype. int myFunction(double, double, double); How many parameter variables does this function have?
3
EXIT_FAILURE and ________ are named constants that may be used to indicate success or failure when the exit() function is called.
EXIT_SUCCESS
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
Here is the header for a function named computeValue: void computeValue(int value) Which of the following is a valid call to the function?
computeValue(10);
A function ________ contains the statements that make up the function.
definition
It is a good programming practice to ________ your functions by writing comments that describe what they do
document
Look at the following function prototype. int myFunction (double); what is the data type of the function's parameter variable?
double
A ________ variable is declared outside all functions.
global
If a function does not have a prototype, default arguments may be specified in the function ________.
header
Look at the following function prototype. int myFunction(double); What is the data type of the function's return value?
int
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 function ________ eliminates the need to place a function definition before all calls to the function.
prototype
The value in this type of local variable persists between function calls.
static
The value in a ________ variable persists between function calls.
static local
In a function header, you must furnish: -data type(s) of the parameters -data type of the return value -the name of function -names of parameter variables All of these
All of these
A ________ argument is passed to a parameter when the actual argument is left out of the function call.
default
A function can have zero to many parameters, and it can return this many values.
only one
Given the following function definition: void calc (int a, int& b) { int c; c = a + 2; a = a * 3; b = c + a; } What is the output of the following code fragment that invokes calc? int x = 1; int y = 2; int z = 3; calc(x, y); cout << x << " " << y << " " << z << endl;
1 6 3