CSC 200 Quiz 3/28

25 July 2022
4.7 (114 reviews)
10 test answers

Unlock all answers in this set

Unlock answers (6)
question
Which line in the following program contains the header for 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 << x << endl; 12 return 0; 13 } 14 15 void showDub( int num) 16 { 17 cout << (num * 2) << endl; 18 } A. 10 B. 4 C. 15 D. 6
answer
15
question
Look at the following function prototype. int myFunction(double, double, double); How many parameter variables does this function have? A. 1 B. 3 C. 2 D. can't tell from the prototype
answer
3
question
A function ___________ contains statements that make up the function. A. prototype B. definition C. call D. parameter list E. expression
answer
definition
question
A function can have zero to many parameters, and it can return this many values. A. no B. zero to many C. a maximum of ten D. only one E. None of these
answer
only one
question
Which of the following statements about global variables is true? A. A global variable is accessible only to the main function. B. A global variable is declared in the highest-level block in which it is used. C. If a function contains a local variable with the same name as a global variable, the global variable's name takes precedence within the function. D. A global variable can have the same name as a variable that is declared locally within the function. E. All of these are true.
answer
A global variable can have the same name as a variable that is declared locally within the function.
question
It is good programming practice to _________ your functions by writing comments that describe what they do. A. eliminate B. document C. execute D. prototype E. None of these
answer
document
question
A function __________ eliminates the need to place a function definition before all calls to the function. A. prototype B. parameter C. header D. argument E. None of these
answer
prototype
question
This function causes a program to terminate, regardless of which function or control mechanism is executing. A. return( ) B. exit( ) C. continue( ) D. terminate( ) E. None of these
answer
exit( )
question
These types of arguments are passed to parameters automatically if no argument is provided in the function call. A. local B. global C. default D. relational E. None of these
answer
default
question
Look at the following function prototype. int myFunction(double); What is the data type of the function's return value? A. void B. double C. int D. can't tell from the prototype
answer
int