Filters
Question type

Study Flashcards

Which line in the following program contains the prototype for the showDub function? 1 \quad #include <iostream> 2 \quad using namespace std; 3 4 \quad void showDub(int) ; 5 6 \quad int main() 7 \quad { 8 \quad\quad int x = 2; 9 10 \quad\quad showDub(x) ; 11 \quad\quad cout << x << endl; 12 \quad\quad return 0; 13 \quad } 14 15 void showDub(int num) 16 { 17 cout << (num * 2) << endl; 18 }


A) 4
B) 6
C) 10
D) 15

E) A) and D)
F) None of the above

Correct Answer

verifed

verified

In a function header, you must furnish


A) data type(s) of the parameters
B) data type of the return value
C) the name of function
D) names of parameter variables
E) All of these

F) A) and B)
G) A) and C)

Correct Answer

verifed

verified

A static variable that is defined within a function is initialized only once, the first time the function is called.

A) True
B) False

Correct Answer

verifed

verified

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) A global variable can have the same name as a variable that is declared locally within a function.
D) 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.
E) All of these are true

F) None of the above
G) C) and D)

Correct Answer

verifed

verified

Look at the following function prototype. int myFunction(double) ; What is the data type of the funtion's return value?


A) int
B) double
C) void
D) Can't tell from the prototype

E) B) and C)
F) None of the above

Correct Answer

verifed

verified

A(n) _________ is information that is passed to a function, and a(n) _________ is information that is received by a function.


A) function call, function header
B) parameter, argument
C) argument, parameter
D) prototype, header
E) None of these

F) A) and B)
G) A) and C)

Correct Answer

verifed

verified

What is the output of the following program? #include <iostream> using namespace std; void showDub(int) ; int main() { \quad int x = 2; \quad showDub(x) ; \quad cout << x << endl; \quad return 0; } void showDub(int num) { \quad cout << (num * 2) << endl; }


A) 2
2
B) 4
2
C) 2
4
D) 4
4

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

A local variable and a global variable may not have the same name within the same program.

A) True
B) False

Correct Answer

verifed

verified

The value in a(n) _______ variable persists between function calls.


A) dynamic
B) local
C) counter
D) static local

E) C) and D)
F) All of the above

Correct Answer

verifed

verified

Showing 41 - 49 of 49

Related Exams

Show Answer