Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Multiple Choice Questions

Q411: Which operator is used in C++ for performing explicit type conversions in the old C-style?
  • A: static_cast
  • B: (type)expression
  • C: dynamic_cast
  • D: reinterpret_cast
View Answer
B

Q412: What does function overriding allow in a derived class?
  • A: Changing the return type
  • B: Changing the parameters
  • C: Overriding the base class method
  • D: All of the above
View Answer
C

Q413: Function overriding occurs in which scope?
  • A: Within the same class
  • B: Between parent and child classes
  • C: Between functions with different signatures
  • D: Within unrelated classes
View Answer
B

Q414: Which error occurs when two member functions with the same prototype are declared within the same class?
  • A: Syntax error
  • B: Runtime error
  • C: Duplicate declaration error
  • D: Logic error
View Answer
C

Q415: In function overloading, what must differ between overloaded functions?
  • A: Function names
  • B: Number of parameters
  • C: Function scope
  • D: Return types
View Answer
B

Q416: How can a derived class call a base class's overridden method?
  • A: By using baseClass::methodName()
  • B: By directly calling methodName()
  • C: By creating a new instance of the base class
  • D: By overriding the base class's method
View Answer
A

Q417: What output will the following code produce? Student a(“Ahmad”, “Computer Science”); a.Print();
  • A: Name: Ahmad, Major: Computer Science
  • B: Name: Ahmad
  • C: Major: Computer Science
  • D: No output due to error
View Answer
A

Q418: What mistake can lead to recursive calls in the overridden method in a derived class?
  • A: Forgetting to call the base class method
  • B: Re-declaring variables
  • C: Incorrect method signature
  • D: Incorrect return type
View Answer
A

Q419: What will be the output if the Person::Print() method is called from the Student::Print() method?
  • A: Name: Ahmad
  • B: Major: Computer Science
  • C: Name: Ahmad, Major: Computer Science
  • D: No output
View Answer
C

Q420: What is the static type of a pointer in C++?
  • A: The type it points to
  • B: The type of the object it was created from
  • C: The base class type
  • D: The derived class type
View Answer
A

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now