🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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:?

  1. A.It is not an exception at all
  2. B.It inherits from BaseException, not Exception, so Ctrl+C can still stop the program
  3. C.It is caught only by except Error
  4. 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 →