This is a collection of statements that performs a specific task. |
D |
A function ________ contains the statements that make up the function. |
A |
A function can have zero to many parameters, and it can return this many values. |
C |
A function is executed when it is: |
D |
In a function header, you must furnish: |
E |
Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function. |
A |
This type of variable is defined inside a function and is not accessible outside the function. |
C |
The value in this type of local variable persists between function calls. |
C |
These types of arguments are passed to parameters automatically if no argument is provided in the function call. |
B |
When used as parameters, these types of variables allow a function to access the parameter’s original argument. |
A |
This statement causes a function to end. |
C |
________ functions may have the same name, as long as their parameter lists are different. |
B |
This function causes a program to terminate, regardless of which function or control mechanism is executing. |
D |
Given the following function definition: void calc (int a, int& b) c = a + 2; What is the output of the following code fragment that invokes calc? int x = 1; calc(x, y); A) 1 2 3 |
B |
This is a statement that causes a function to execute. |
D |
It is a good programming practice to ________ your functions by writing comments that describe what they do. |
B |
A(n) ________ is information that is passed to a function, and a(n) ________ is information that is received by a function. |
C |
Which of the following statements about global variables is true? |
C |
A function ________ eliminates the need to place a function definition before all calls to the function. |
B |
A ________ variable is declared outside all functions. |
B |
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. |
A |
A ________ argument is passed to a parameter when the actual argument is left out of the function call. |
D |
If a function does not have a prototype, default arguments may be specified in the function ________. |
B |
EXIT_FAILURE and ________ are named constants that may be used to indicate success or failure when the exit() function is called. |
B |
The value in a ________ variable persists between function calls. |
D |
This is a dummy function that is called instead of the actual function it represents. |
B |
What is the output of the following program? #include <iostream> void showDub(int); int main() showDub(x); void showDub(int num) A) 2 B) 4 C) 2 D) 4 |
B |
What is the output of the following program? #include <iostream> void doSomething(int); int main() cout << x << endl; void doSomething(int num) A) 2 B) 2 C) 0 D) 2 |
A |
What is the output of the following program? #include <iostream> void doSomething(int&); int main() cout << x << endl; void doSomething(int& num) A) 2 B) 2 C) 0 D) 2 |
D |
Which line in the following program contains the prototype for the showDub function? 1 #include <iostream> A) 4 |
A |
Which line in the following program contains the header for the showDub function? 1 #include <iostream> A) 4 |
D |
Which line in the following program contains a call to the showDub function? 1 #include <iostream> A) 4 |
C |
Look at the following function prototype. int myFunction(double); What is the data type of the function’s parameter variable? |
B |
Look at the following function prototype. int myFunction(double); What is the data type of the function’s return value? |
A |
Look at the following function prototype. int myFunction(double, double, double); How many parameter variables does this function have? |
C |
What is the output of the following program? #include <iostream> int getValue(int); int main() cout << getValue(x) << endl; int getValue(int num) A) 5 |
C |
Here is the header for a function named computeValue: void computeValue(int value) Which of the following is a valid call to the function? |
B |
Chapter 6 Functions
Share This
Unfinished tasks keep piling up?
Let us complete them for you. Quickly and professionally.
Check Price