C++ MCQs - Abstract Classes

This section focuses on the "Abstract Classes" in C++ programming langauge. These Multiple Choice Questions (MCQ) should be practiced to improve the C++ programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. A class is made abstract by declaring at least one of its functions as?

A. impure virtual function
B. pure virtual function
C. pure abstract function
D. impure abstract function

View Answer


2. A pure virtual function is specified by placing?

A. -1
B. 0
C. 1
D. infinite

View Answer


3. Classes that can be used to instantiate objects are called?

A. concrete classes
B. interface
C. abstract class
D. None of the above

View Answer


4. Which of the following is true?

A. The C++ interfaces are implemented using abstract classes
B. The purpose of an abstract class is to provide an appropriate base class from which other classes can inherit.
C. Abstract classes cannot be used to instantiate objects and serves only as an interface.
D. All of the above

View Answer


5. Where does the abstract class is used?

A. base class only
B. derived class
C. both derived & base class
D. virtual class

View Answer


6. Which class is used to design the base class?

A. abstract class
B. derived class
C. base class
D. derived & base class

View Answer


7. We cannot make an instance of an abstract base class

A. TRUE
B. FALSE
C. Can be true and false
D. Can not say

View Answer


8. We can make an instance of an abstract super class

A. TRUE
B. FALSE
C. Can be true and false
D. Can not say

View Answer


9. Which is the correct syntax of defining a pure virtual function?

A. pure virtual return_type func();
B. virtual return_type func() pure;
C. virtual return_type func() = 0;
D. virtual return_type func();

View Answer


10. Which is the correct statement about pure virtual functions?

A. They should be defined inside a base class
B. Pure keyword should be used to declare a pure virtual function
C. Pure virtual function is implemented in derived classes
D. Pure virtual function cannot implemented in derived classes

View Answer





Discussion



* You must be logged in to add comment.