Arrange the following in order in the context of exception handling:
(A) Program Termination
(B) Exception is raised
(C) Error occurs in a program
(D) Catching an exception
Arrange the following in order in the context of exception handling:
(A) Program Termination
(B) Exception is raised
(C) Error occurs in a program
(D) Catching an exception
Solution
(C) Error occurs in a program: something goes wrong at run time, such as division by zero.
(B) Exception is raised: the runtime creates an exception object and passes it up the call stack.
(D) Catching an exception: a matching handler (catch or except block) receives the exception and deals with it.
(A) Program termination: the program ends, normally or after cleanup, once the exception has been handled.
Option 4: termination comes before catching, but an exception that is caught is handled so the program can continue. Termination happens only after handling, or when no handler is found.
Related questions:
2025: 14 May Shift 1
2026: 13 May Shift 2
2025: 15 May Shift 2