← All topics
Quiz: Exception Handling in C++: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. When a throw statement runs inside a try block, what happens to the remaining statements in that try block?
- Q2. What does this print? (code)
- Q3. Why should you catch exceptions by const reference?
- Q4. What is stack unwinding?
- Q5. What does this print? (code)
- Q6. Which catch block order is correct?
- Q7. What is the best base class for your own InsufficientFunds exception?
- Q8. Inside a catch block, what is the difference between throw; and throw e; (where e is const exception &)?
- Q9. What happens if an exception escapes a function marked noexcept?
- Q10. Why should a destructor never throw an exception?