Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Multiple Choice Questions

Q661: What is the concept of stack unwinding in exception handling?
  • A: Order of function calls
  • B: Destruction of local variables
  • C: Cleanup of dynamically allocated memory
  • D: Handling exceptions in catch blocks
View Answer
B

Q662: What happens to local variables in a try block when an exception is thrown?
  • A: They are kept unchanged
  • B: They are destroyed
  • C: They are modified
  • D: They are ignored
View Answer
B

Q663: When an exception is thrown from nested functions, what is the sequence of control transfer called?
  • A: Stack unwinding
  • B: Exception handling
  • C: Error propagation
  • D: Function return
View Answer
A

Q664: In stack unwinding, what is the order of handling exceptions in nested try-catch blocks?
  • A: Innermost try-catch first
  • B: Outermost try-catch first
  • C: Random order
  • D: All try-catch blocks simultaneously
View Answer
A

Q665: How does C++ handle exceptions if no catch handler is found?
  • A: It terminates the program
  • B: It ignores the exception
  • C: It retries the code
  • D: It skips the catch blocks
View Answer
A

Q666: What is the purpose of the throw keyword in exception handling?
  • A: To catch an exception
  • B: To throw an exception
  • C: To end the program
  • D: To return a value
View Answer
B

Q667: What happens to dynamically allocated memory when an exception is thrown?
  • A: It is automatically freed
  • B: It remains allocated
  • C: It is partially freed
  • D: It causes a memory leak
View Answer
B

Q668: What will happen if a catch block does not match the thrown exception type?
  • A: The program crashes
  • B: The catch block is skipped
  • C: The catch block handles the exception
  • D: The program continues without handling
View Answer
B

Q669: What is the role of the catch block when an exception is thrown?
  • A: To throw another exception
  • B: To handle the thrown exception
  • C: To terminate the program
  • D: To log the error
View Answer
B

Q670: In the provided example, which class represents the exception for division by zero?
  • A: DivideByZero
  • B: Exception
  • C: Error
  • D: ZeroDivision
View Answer
A

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now