ACtE03 · Chapter 3Programming & Applications🏛️ Past Licensure QuestionID: 9f4b5c31
Which of the following statements regarding pure virtual functions in C++ is TRUE?
Which of the following statements regarding pure virtual functions in C++ is TRUE?
Multiple Choice Options
- A✓ Correct Option
They make the enclosing class abstract and are intended to be overridden in derived classes
- B
The
purekeyword must be explicitly written before the return type - C
They can never be called using qualified syntax even if an implementation is provided
- D
A class containing a pure virtual function can be directly instantiated
Detailed Technical Solution & Explanation
Declaring a pure virtual function (= 0) makes the class an abstract base class that cannot be directly instantiated. Its primary design purpose is to enforce an interface that must be implemented (overridden) by concrete derived classes.
Option Analysis:
•
Option A (They make the enclosing class abstrac...): Correct. Fundamental purpose of pure virtual functions.
•
Option B (The
pure keyword must be explicitly...): False; = 0 is used, not a pure keyword.•
Option C (False; a pure virtual function can have a definition in C++ and be called explicitly via
Base): :foo().•
Option D (A class containing a pure virtual fun...): False; abstract classes cannot be instantiated.
Reference: Mock Test 06NEC Licensure Syllabus