Abstract Classes - Quiz Explanation

The correct answers are indicated below, along with text that explains the correct answers.
 
1. To dynamically select at runtime the appropriate member function from among base and derived class functions, use:
  A. keyword virtual on the base class function
  B. keyword virtual in the class name declaration to specify all functions virtual
  C. keywords pure virtual on all virtual functions in the base class
  D. void* pointer to automatically select among functions
  The correct answer is A.
To dynamically select at runtime the appropriate member function from among base and derived class functions, use keyword virtual on the base class function. There is no keyword pure virtual. A pure virtual function is a virtual function with an empty body that is defined in the base class of a class hierarchy.

2. In dynamic virtual function selection, the function selected depends on:
  A. the object being pointed at
  B. the pointer type
  C. the return type
  D. none of these
  The correct answer is A.
In dynamic virtual function selection, the function selected depends on the object being pointed at.

3. ____________ can be virtual.
  A. Any function
  B. Any nonstatic function
  C. Any nonstatic, nonconstructor function
  D. Any nonstatic, nonconstructor, nondestructor function
  The correct answer is C.
Any nonstatic, nonconstructor function can be virtual. Destructors can be virtual.

4. An abstract base class:
  A. consists entirely of pure virtual functions
  B. has no functions, only data members
  C. has at least one pure virtual function
  D. cannot be used in multiple inheritance
  The correct answer is C.
At least one pure virtual function is needed.

5. A pure virtual function:
  A. is declared with = 0; in the base class
  B. has an empty body in the derived class and always uses base class code
  C. has the special null keyword in the body in the base class
  D. cannot appear in an abstract base class
  The correct answer is A.
The syntax for a pure virtual function is an example of strange but true C++ syntax.

6. An abstract base class:
  A. can be used to declare pointers that can access subtype objects
  B. can be used to declare objects
  C. cannot have any functions containing code
  D. can have only functions that use the virtual keyword
  The correct answer is A. The creation of an abstract class means that it cannot be used to declare objects of this type, but it can be used to declare pointers that can access subtype objects derived from the abstract class.