When a function is called, flow of control moves to the function’s prototype |
false |
A parameter is a special purpose variable that is declared inside the parentheses of a function |
true |
A local variable and a global variable may not have the same name within a program. |
false |
A static variable that is defined within a function is initialized only once, the first time it is called. |
true |
It is possible for a function to have some parameters with default arguments and some without. |
true |
A function’s return data type must be the same as the function’s parameters. |
false |
One reason for using functions is to break programs into manageable units or modules |
true |
You must always furnish an argument with a function call. |
false |
Global variables are initialized to zero by default. |
true |
Local variables are initialized to zero by default. |
false |
It is not considered good programming practice to declare all your variables globally |
true |
You may use the exit() function to terminate a program, regardless of which control mechanism is |
true |
A collection of statements that performs a specific task is a(n) |
function |
A function __________ contains the statements that make up the function. |
definition |
. A function can have no parameters, one parameter, or many parameters and can return __________ |
only one |
A function is executed when it is |
called |
Functions are ideal for menu-driven programs. When the user selects a menu item, the program can |
call |
This type of variable is defined inside a function and is not accessible outside the function. |
local |
The value in this type of variable persists between function calls. |
static |
These types of arguments are passed to parameters automatically if no argument is provided in the |
default |
When used as parameters, these types of variables allow a function to access the parameter’s original |
reference |
. __________ functions may have the same name as long as their parameter lists are different. |
two or more |
This statement causes a function to end. |
return |
This function causes a program to terminate, regardless of which function or control mechanism is |
exit() |
Which of the following causes a function to execute? |
a function call |
. It is good programming practice to __________ your functions by writing comments that describe |
document |
A(n) __________ is information that is passed to a function, and a(n) __________ is information that |
argument, parameter |
A function _________ eliminates the need to place a function definition before all calls to the function. |
prototype |
A _________ variable is declared outside all functions. |
global |
If a function is called more than once in a program, the values stored in the function’s local variables |
persist |
. A __________ argument is passed to a parameter when the actual argument is left out of the function. |
default |
If a function does not have a prototype, default arguments may be specified in the __________. |
function header |
The value in a __________ variable persists between function calls. |
static local |
Given the following function: |
1 6 3 |
EXIT_FAILURE and ________ are named constants that may be used to indicate success or failure |
EXIT_SUCCESS |
This is a dummy function that is called instead of the actual function it represents: |
stub |
What will the following code display? |
4 2 |
What will the following code display? |
2 0 2 |
What will the following code display? |
2 0 0 |
Which line in the following program contains the prototype showDub function? |
line 3 |
Which line in the following program contains the header for the showDub function? |
line 11 |
Which line in the following program contains a call to the showDub function? |
line 7 |
What is the data type of the following function prototype’s parameter variable? |
double |
What is the data type of the following function prototype’s return value? |
int |
In the following function prototype, how many parameter variables does this function have? |
3 |
What will the following code display? |
7 |
Given the following header for a function named computeValue, which of the following is a valid |
computeValue(10); |
Select all that apply. Which of the following must be included in a function header? |
all apply |
Select all that apply. Which of the following statement(s) about global variables is(are) true? |
a b c e |
C++ Chapter 6 Functions
Share This
Unfinished tasks keep piling up?
Let us complete them for you. Quickly and professionally.
Check Price