Practice Test: Question Set - 09
1. Local variables ________
- (A) Are
created outside a block
- (B) Are
known only to that block
- (C) Continue
to exist when their block ends
- (D) Are
illegal in C++
2. A file pointer always contains the address of the file
- (A) True
- (B) False
3. 6.5 is a _______ constant
- (A) Character
literal
- (B) Named
literal
- (C) Numeric
literal
- (D) String
literal
4. A class Stockltems has four data members and three function members. You define 50 objects as members of the class. Which is true?
- (A) Only one
copy of each of the tree functions exists
- (B) Only
one copy of each of the four data members exists
- (C) Both (a) and
(b) are true
- (D) Neither (a)
nor (b) is true
5. When a new class is derived from an existing class, the derived class member functions _______ have names that differ from base class function names
- (A) May
- (B) May
if the two classes have the same name
- (C) Must
- (D) Must not
6. The program can access the private members of a class
- (A) Directly
- (B) Only
through other private members of the class
- (C) Only
through other public members of the class
- (D) None
of the above - the program cannot access the private members of a class in any
way
7. The dot operator (or class member access operator) connects the following two entities (reading from left to right):
- (A) A
class member and a class object
- (B) A class
object and a class
- (C) A class and
a member of that class
- (D) A
class object and a member of that class
8. You have declared an integer pointer called point You have also declared an integer called number. Which statement is the correct format?
- (A) point =
number;
- (B) point =
*number;
- (C) point =
&number;
- (D) point =
+number;
9. The instructions you enter into the computer are called the ________
- (A) Edited code
- (B) Machine code
- (C) Object code
- (D) Source code
10. In a simple 'if' statement with no 'else'. What happens if the condition following the 'if is false?
- (A) The
program searches for the last else in the program
- (B) Nothing
- (C) Control
'falls through' to the statement following 'if
- (D) The body of
the statement is executed
11. Compared with the classes from which they are derived, inherited classes may have _______
- (A) Additional
data members
- (B) Additional
member functions
- (C) Both (a) and
(b)
- (D) Neither (a)
nor (b)
12. Library header files usually contain
- (A) Complete
functions
- (B) Parts
of functions
- (C) Function
prototypes for functions stored in other files
- (D) Function
bodies, but not function headers
13. Which of the following are valid characters constants?
- (A) '\n'
- (B) '\\'
- (C) '\0'
- (D) All
of the above
14. A comment
- (A) Is
a note that can be put into the source code
- (B) Is ignored
by the compiler
- (C) Starts
with the /* character pair
- (D) All
of the above
15. A variable's _______ indicates how long the variable remains in the computer's memory
- (A) Area
- (B) Extent
- (C) Lifetime
- (D) Scope
Next Tests: