Object Oriented Programming Using C++ – Section 9

6. A function that is called automatically each time an object is destroyed is a

A. constructor
B. destructor
C. destroyer
D. terminator

Correct Answer:  B. destructor

7. We can output text to an object of class ofstream using the insertion operator « because

A. the ofstream class is a stream
B. the insertion operator works with all classes
C. we are actually outputting to cout
D. the insertion operator is overloaded in ofstream

Correct Answer:  D. the insertion operator is overloaded in ofstream

8. The operator that allocates new memory is _____

A. allocate
B. mem
C. new
D. next

Correct Answer:  C. new

9. 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
E. None of the above

Correct Answer:  D. All of the above

10. Which of the following is(are) valid identifier(s)?

A. record_1
B. 1 record
C. return
D. $tax
E. None of the above

Correct Answer:  A. record_1

Leave A Comment?

1 × five =