Object Oriented Programming MCQs with Answers
Practice important Object Oriented Programming MCQs with answers and explanations.
Multiple Choice Questions
Q421: How can recursive calls be avoided when overriding methods in C++?
- A: By using this->methodName()
- B: By calling baseClass::methodName()
- C: By avoiding method overloading
- D: By using different method names
View Answer
B
Q422: Function overriding can be avoided by using:
- A: Different method names
- B: Pointers
- C: Virtual functions
- D: Static methods
View Answer
C
Q423: Function overloading is done within the scope of:
- A: Two different classes
- B: A single class
- C: Multiple inheritance
- D: Multiple classes
View Answer
B
Q424: Inheritance hierarchy in OOP is represented in which form?
- A: Tree-like structure
- B: Circular structure
- C: Linked list
- D: Graph
View Answer
A
Q425: What does the child class call during initialization in the constructor initialization list?
- A: Direct base class constructor
- B: Indirect base class constructor
- C: Any constructor available
- D: None of the above
View Answer
A
Q426: Which class's constructor cannot be called by the child class during its initialization?
- A: Direct base class constructor
- B: Indirect base class constructor
- C: Both direct and indirect base class constructors
- D: Only the grandparent class constructor
View Answer
B
Q427: What error occurs if the child class tries to call an indirect base class constructor in its initialization list?
- A: Syntax error
- B: Logic error
- C: Compilation error
- D: None of the above
View Answer
C
Q428: In the given code, what will be the output when Child1 obj; obj.Print(); is called?
- A: GrandParent::Print
- B: Parent1::Print
- C: Child1::Print
- D: Compilation error
View Answer
C
Q429: Which types of inheritance allow public members of the base class to remain public in the derived class?
- A: Private inheritance
- B: Protected inheritance
- C: Public inheritance
- D: All of the above
View Answer
C
Q430: Which type of inheritance hides the private members of the base class in the derived class?
- A: Public inheritance
- B: Protected inheritance
- C: Private inheritance
- D: None of the above
View Answer
D