Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Multiple Choice Questions

Q151: Separation of interface and implementation in C++ is primarily achieved through which files?
  • A: .h and .cpp files
  • B: .cpp and .exe files
  • C: .h and .lib files
  • D: .cpp and .obj files
View Answer
A

Q152: In which form is the modulus of a complex number denoted?
  • A: Phasor form
  • B: Euler form
  • C: Cartesian form
  • D: Polar form
View Answer
B

Q153: What is the purpose of const keyword in member functions?
  • A: To allow modification of the class state
  • B: To prevent modification of the class state
  • C: To make a function virtual
  • D: To declare a function as static
View Answer
B

Q154: If a class has dynamic memory allocation, shallow copy will likely lead to which problem?
  • A: Memory leak
  • B: Dangling pointer
  • C: Redundant memory usage
  • D: Stack overflow
View Answer
B

Q155: The setNumber method in the new implementation of the Complex class uses which form of complex number?
  • A: Euler form
  • B: Phasor form
  • C: Cartesian form
  • D: Polar form
View Answer
B

Q156: What is the main benefit of separating interface from implementation in C++?
  • A: Easier to manage memory
  • B: Improved software engineering
  • C: Faster execution of code
  • D: Reduced code size
View Answer
B

Q157: What kind of copy does the default copy constructor perform?
  • A: Deep copy
  • B: Shallow copy
  • C: Bitwise copy
  • D: Logical copy
View Answer
B

Q158: In the context of C++ classes, which file typically contains the class's interface?
  • A: .cpp file
  • B: .exe file
  • C: .h file
  • D: .lib file
View Answer
C

Q159: What issue arises when trying to assign a value to a constant data member in a constructor?
  • A: Value assignment is allowed
  • B: Compiler generates an error
  • C: Value assignment is ignored
  • D: Compiler generates a warning
View Answer
B

Q160: What is the purpose of a member initializer list in C++?
  • A: To initialize data members before constructor execution
  • B: To assign values after constructor execution
  • C: To define class member variables
  • D: To declare member functions
View Answer
A

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now