Skip to main contentSkip to solution

Which of the following is an incorrect statement in the context to Exception handling in Python?

Solution

✅ Correct Option: 4

Option 4 is the incorrect statement. An except clause is always part of a try statement and cannot appear on its own. Writing except without a try gives a SyntaxError.


Option 2: correct, because finally runs whether or not an exception occurs, and even if the try block has a return.

Option 3: correct, because raise throws a chosen exception and assert raises AssertionError when its condition is False.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question