Chapter 6 C++ – Flashcards

Unlock all answers in this set

Unlock answers
question
A(n) ________ argument is passed to a parameter when the actual argument is left out of the function call.
answer
default
question
A function ________ eliminates the need to place a function definition before all calls to the function.
answer
prototype
question
This is a statement that causes a function to execute.
answer
function call
question
EXIT_FAILURE and ________ are named constants that may be used to indicate success or failure when the exit( ) function is called.
answer
EXIT_SUCCESS
question
What is the output of the following program? #include using namespace std; int getValue (int); int main() { int x= 2; cout<< getValue (x)<< endl; return 0; } int getValue (int num) { return num +5; }
answer
7
question
In a function header, you must furnish: 1) data types of the parameters 2) the name of function 3) names of parameter variables 4) data type of the return value 5) all of these
answer
all of these
question
A(n) ________ is information that is passed to a function, and a(n) ________ is information that is received by a function.
answer
argument, parameter
question
What is the output of the following program? #include using namespace std; void showDub(int); int main () { int x=2; showDub (x); cout <
answer
4 2
question
Look at the following function prototype. int myFunction (double); What is the data type of the functions parameter variable?
answer
double
question
Which line in the following program contains a call to the showDub function? 1 #include 2 using namespace std; 3 4 void showDub(int); 5 6 int main () 7 { 8 int x =2; 9 10 showDub (x); 11 cout <
answer
10
question
A function is executed when it is:
answer
called
question
Look at the following function prototype. int myFunction (double, double, double); How many parameter variables does this function have?
answer
3
question
These types of arguments are passed to parameters automatically if no argument is provided in the function call.
answer
default
question
What is the output of the following program? #include using namespace std; void doSomething (int); int main() { int x =2; cout <
answer
2 0 2
question
Given the following function definition coid calc (int a, in& b) { int c; c = a + 2; a = a * 3; b = c + a; } What is the output of the following code fragment that invokes calc? (all variables are of types int) x=1; y =2; z=3; calc (x,y); cout << x<< " " << y << " " << z << endl;
answer
1 6 3
question
A ________ variable is declared outside all functions.
answer
global
question
What is the output of the following program? #include using namespace std; void doSomething (int&); int main ( ) { int x = 2; cout <
answer
2 0 0
question
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.
answer
persist
question
________ functions may have the same name, as long as their parameter lists are different.
answer
Two or more
question
If a function does not have a prototype, default arguments may be specified in the function ________.
answer
header
question
Which of the following statements about global variables is true?
answer
A global variable can have the same name as a variable that is declared locally within a function.
question
The value in a(n) ________ variable persists between function calls.
answer
static local
question
It is a good programming practice to ________ your functions by writing comments that describe what they do.
answer
document
question
A function can have zero to many parameters, and it can return this many values.
answer
only one
question
This function causes a program to terminate, regardless of which function or control mechanism is executing.
answer
exit( )
question
A function ________ contains the statements that make up the function.
answer
definition
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New