Object Oriented Programming Using C++ – Section 1

21. The #ifndef directive tests to see whether ________

A. a class has been defined
B. a variable has been given a value
C. a class has no variable definitions
D. any objects of the class have been instantiated

Correct Answer:  A. a class has been defined

22. Which of the following statements is false?

A. A function is a block of code that performs a specific task
B. Functions allow programmers to break large and complex problems into small and manageable tasks
C. Functions allow programmers to use existing code to perform common tasks
D. Functions can be called, or invoked, only once in a program
E. Programmer-defined functions can be either value-returning or void

Correct Answer:  D. Functions can be called, or invoked, only once in a program

23. The generic type in a template function

A. must be T
B. can be T
C. cannot be T for functions you create, but may be for C++’s built-in functions
D. cannot be T

Correct Answer:  B. can be T

24. When a child class function is called, the compiler looks first for a matching function name in the _____

A. class of the object using the function name
B. immediate ancestor class
C. base class
D. descendant class

Correct Answer:  A. class of the object using the function name

25. 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

Leave A Comment?

twelve + 7 =