🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Exceptions in Depth: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. Which exception does except LookupError: catch?
  2. Q2. When does the else part of a try statement run?
  3. Q3. What does this print? (code)
  4. Q4. What does this print? (code)
  5. Q5. What should a custom exception class usually inherit from?
  6. Q6. What does a bare raise inside an except block do?
  7. Q7. What does raise ConfigError("bad") from e add compared to raise ConfigError("bad")?
  8. Q8. What does this print? (code)
  9. Q9. Why should assert not be used to validate user input?
  10. Q10. Why is KeyboardInterrupt not caught by except Exception:?