Filters
Question type

Study Flashcards

The following function heading in a C++ program is valid: int funcExp(int u, char v, float g)

A) True
B) False

Correct Answer

verifed

verified

The following return statement returns the value 10. return 10, 16;

A) True
B) False

Correct Answer

verifed

verified

Given the following function prototype: double tryMe(double, double) ;, which of the following statements is valid? Assume that all variables are properly declared.


A) cin >> tryMe(x) ;
B) cout << tryMe(2.0, 3.0) ;
C) cout << tryMe(tryMe(double, double) , double) ;
D) cout << tryMe(tryMe(float, float) , float) ;

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

Correct Answer

verifed

verified

A function prototype is ____.


A) a definition, but not a declaration
B) a declaration and a definition
C) a declaration, but not a definition
D) a comment line

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

Correct Answer

verifed

verified

A variable listed in a header is known as a(n) ____ parameter.


A) actual
B) local
C) formal
D) function

E) A) and D)
F) B) and D)

Correct Answer

verifed

verified

Given the following function prototype: int test(float, char) ;, which of the following statements is valid?


A) cout << test(12, &) ;
B) cout << test("12.0", '&') ;
C) int u = test(5.0, '*') ;
D) cout << test('12', '&') ;

E) B) and C)
F) A) and C)

Correct Answer

verifed

verified

Once you write and properly debug a function, you can use it in the program (or different programs) again and again without having to rewrite the same code repeatedly.

A) True
B) False

Correct Answer

verifed

verified

The ____________________ of an identifier refers to where in the program an identifier is accessible (visible).

Correct Answer

verifed

verified

scope

Assume that all variables are properly declared. The following statement in a value-returning function is legal. if (x % 2 == 0) return x; else return x + 1;

A) True
B) False

Correct Answer

verifed

verified

____________________ identifiers are not accessible outside of the function (block).

Correct Answer

verifed

verified

When you attach & after the dataType in the formal parameter list of a function, the variable following that dataType becomes a(n) ____________________ parameter.

Correct Answer

verifed

verified

The standard header file for the abs(x) function is ____.


A) <cmath>
B) <ioinput>
C) <cctype>
D) <cstdlib>

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

Given the following function: int next(int x) { \quad Return (x + 1) ; } What is the output of the following statement? Cout << next(next(5) ) << endl;


A) 5
B) 6
C) 7
D) 8

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

The program that tests a function is called a(n) ____________________ program.

Correct Answer

verifed

verified

The output of the statement: cout << tolower('$') << endl; Is ____.


A) '$'
B) '0'
C) '1'
D) An error, because you cannot use tolower with '$'.

E) B) and C)
F) C) and D)

Correct Answer

verifed

verified

A

The data type of a variable in a return statement must match the function type.

A) True
B) False

Correct Answer

verifed

verified

The execution of a return statement in a user-defined function terminates the program.

A) True
B) False

Correct Answer

verifed

verified

The statement: return 37, y, 2 * 3; returns the value ____.


A) 2
B) 3
C) y
D) 6

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

Correct Answer

verifed

verified

Assume the following. static_cast<int>('a') = 97 Static_cast<int>('A') = 65 The output of the statement: Cout << static_cast<int>(tolower('B') ) << endl; is ____.


A) 65
B) 67
C) 96
D) 98

E) C) and D)
F) A) and B)

Correct Answer

verifed

verified

Which of the following function prototypes is valid?


A) int funcExp(int x, float v) ;
B) funcExp(int x, float v) {};
C) funcExp(void) ;
D) int funcExp(x) ;

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

A

Showing 1 - 20 of 50

Related Exams

Show Answer