← Quiz: Exceptions in Depth: all 10 questions
Quiz: Exceptions in Depth · Question 10 of 10
Why is KeyboardInterrupt not caught by except Exception:?
Why is KeyboardInterrupt not caught by except Exception:?
- A.It is not an exception at all
- B.It inherits from BaseException, not Exception, so Ctrl+C can still stop the program
- C.It is caught only by except Error
- D.Python ignores Ctrl+C
Answer & explanation
Correct answer: It inherits from BaseException, not Exception, so Ctrl+C can still stop the program
Keeping it outside Exception stops broad handlers from blocking a user's interrupt.
Can you get the rest right without peeking?
Take the timed Quiz: Exceptions in Depth quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →