← 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 →- Q1. Which exception does except LookupError: catch?
- Q2. When does the else part of a try statement run?
- Q3. What does this print? (code)
- Q4. What does this print? (code)
- Q5. What should a custom exception class usually inherit from?
- Q6. What does a bare raise inside an except block do?
- Q7. What does raise ConfigError("bad") from e add compared to raise ConfigError("bad")?
- Q8. What does this print? (code)
- Q9. Why should assert not be used to validate user input?
- Q10. Why is KeyboardInterrupt not caught by except Exception:?