Practice Test: Question Set - 05
1. Which is a good guideline for creating function names?
- (A) Use
all lowercase letters to identify the functions as C++ functions
- (B) Use
long names to reduce the likelihood of creating a duplicate function name
- (C) Use
abbreviations as much as possible to save both keystrokes and memory
- (D) Avoid
the use of digits because they are easily confused with letters
2. A derived class may also be called a
- (A) Subclass
- (B) Super class
- (C) Parent class
- (D) Base class
3. The continue statement should be written only
- (A) In the body
of a loop
- (B) In the
nested loops
- (C) Outside the
body of a loop
- (D) Any where
4. A do-while loop contains
- (A) Only
one statement between the do statement and the while statement
- (B) Several
statements between the do statement and the while statement
- (C) No
statement at all between the do statement and the while statement
- (D) Only
two statement between the do statement and the while statement
5. The difference between a return and a throw is that ________
- (A) With
a throw, no value can be sent
- (B) With
a return, no value can be sent
- (C) With
a throw, execution takes place at the location from which the function was
called
- (D) With
a return, execution takes place at the location from which the function was
called
6. The loop condition in a flowchart is represented by a(n) _______
- (A) Diamond
- (B) Oval
- (C) Parallelogram
- (D) Rectangle
7. The C++ _________ function generates random numbers
- (A) generate()
- (B) genRand
- (C) rand
- (D) srand
8. The preprocessor directive always ends with
- (A) A
comma
- (B) A
semicolon
- (C) Neither
a semicolon nor a comma
- (D) "/"
9. The last statement in a function is often a(n) _______
- (A) Return
- (B) Goodbye
- (C) Finish
- (D) End
function
10. The best functions have _________
- (A) High
cohesion and tight coupling
- (B) High
cohesion and loose coupling
- (C) Low
cohesion and tight coupling
- (D) Low
cohesion and loose coupling
11. The instruction "If it's raining outside, then take an umbrella to work" is an example of the ________ structure
- (A) Control
- (B) Repetition
- (C) Selection
- (D) Sequence
12. To use a template class member function, use the ________ with the instantiation
- (A) Scope
resolution operator
- (B) Dot
operator
- (C) Class
definition
- (D) Keyword
template
13. You can pass _______ to functions
- (A) Copies
of individual structure members
- (B) Copies
of entire structures
- (C) Pointers
to structures
- (D) All
of the above
14. A variable w with a value 67 may be defined with _______
- (A) int w = 67;
- (B) int w(67);
- (C) int 67(w);
- (D) Both (a) and
(b), but not (c)
15. With a template class, _______ type is generic
- (A) No
- (B) Exactly one
- (C) At least one
- (D) At most one
Next Tests: