Which of the following is an incorrect statement in the context to Exception handling in Python?
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.
Related questions:
2025: 3 June Shift 2
2025: 15 May Shift 2
2026: 23 May Shift 2