Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Multiple Choice Questions

Q441: In specialization, can the derived class always replace the base class?
  • A: Yes
  • B: No
  • C: Sometimes
  • D: Only in private inheritance
View Answer
B

Q442: Which type of inheritance is used when the derived class is behaviorally incompatible with the base class?
  • A: Public
  • B: Protected
  • C: Private
  • D: All of the above
View Answer
C

Q443: When using private inheritance, what happens to the public and protected members of the base class?
  • A: They remain public and protected in the derived class
  • B: They become private members of the derived class
  • C: They are hidden from the derived class
  • D: They are deleted
View Answer
B

Q444: Which of the following is a correct characteristic of protected inheritance?
  • A: Derived class members and friends can access base class members
  • B: Only derived class can access base class members
  • C: Derived class friends only can access base class members
  • D: Public can access base class members
View Answer
A

Q445: Which constructor is called first in the object construction process in inheritance?
  • A: Derived class constructor
  • B: Friend class constructor
  • C: Base class constructor
  • D: All constructors are called simultaneously
View Answer
C

Q446: In the provided example, why does the line Parent *pptr = & cobj; result in an error?
  • A: Because of incorrect syntax
  • B: Because Child is privately inherited from Parent
  • C: Because Parent is not defined
  • D: Because of protected inheritance
View Answer
B

Q447: In private inheritance, which class in the hierarchy cannot access the member functions of the GrandParent class?
  • A: Parent
  • B: Derived class one level down
  • C: Derived class more than one level down
  • D: Any class outside the hierarchy
View Answer
C

Q448: Fill in the blank: __________ inheritance is used to implement specialization.
  • A: Public
  • B: Protected
  • C: Private
  • D: Hybrid
View Answer
C

Q449: What type of inheritance allows the derived class to access only the protected and public members of the base class?
  • A: Private
  • B: Protected
  • C: Public
  • D: Hybrid
View Answer
B

Q450: Which function is NOT allowed to be accessed by the Set class in the provided example?
  • A: AddElement
  • B: IsMember
  • C: DeleteMember
  • D: SearchElement
View Answer
D

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now