Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Multiple Choice Questions

Q491: How does polymorphism work in the context of the Shape class and its derived classes?
  • A: By using base class pointers to derived class objects
  • B: By using arrays of base class objects
  • C: By directly calling methods on derived class objects
  • D: By using only base class methods
View Answer
A

Q492: What is the result of using arrays of objects in the drawShapes function?
  • A: The program compiles but may terminate abnormally
  • B: Correctly draws all shapes without issues
  • C: Displays only the base class output
  • D: Produces a compile-time error
View Answer
A

Q493: In the context of the payroll application, what does the calcSalary method in CommEmp class compute?
  • A: Gross pay after tax
  • B: Total sales
  • C: Commission rate
  • D: Salary before tax
View Answer
A

Q494: What should be used instead of an array of objects to achieve correct polymorphic behavior?
  • A: Array of pointers to objects
  • B: Array of integers
  • C: Array of characters
  • D: Array of floats
View Answer
A

Q495: In C++, a class can inherit from how many classes using multiple inheritance?
  • A: Only one
  • B: Two
  • C: Three
  • D: More than one
View Answer
B

Q496: Which inheritance mode allows derived classes to access public and protected members of the base class?
  • A: Private Inheritance
  • B: Protected Inheritance
  • C: Public Inheritance
  • D: Virtual Inheritance
View Answer
C

Q497: What happens if a derived class inherits from two base classes that have a function with the same signature?
  • A: The derived class will have one copy of the function
  • B: The derived class will have two copies of the function
  • C: The function will be overridden in the derived class
  • D: An error will occur
View Answer
B

Q498: Fill in the blank: In multiple inheritance, when a derived class inherits from two base classes with the same method, the compiler might face _______ due to the presence of two identical methods.
  • A: Ambiguity
  • B: Clarity
  • C: Precision
  • D: Simplicity
View Answer
A

Q499: Which type of inheritance ensures that only one copy of a base class object is generated in a derived class?
  • A: Virtual Inheritance
  • B: Public Inheritance
  • C: Private Inheritance
  • D: Protected Inheritance
View Answer
A

Q500: Fill in the blank: The C++ feature that allows a class to inherit from more than one class is known as _______.
  • A: Multiple Inheritance
  • B: Single Inheritance
  • C: Hybrid Inheritance
  • D: Virtual Inheritance
View Answer
A

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now