Read the following statements related to exception handling and arrange them in the correct order.
A. Exception is raised
B. Executes the exception for catching an exception
C. Program searches for exception handler
D. Create exception object
E. An Error encountered
Read the following statements related to exception handling and arrange them in the correct order.
A. Exception is raised
B. Executes the exception for catching an exception
C. Program searches for exception handler
D. Create exception object
E. An Error encountered
Solution
E: An error is encountered in the running program.
D: An exception object is created, holding the error type and details.
A: The exception is raised (thrown) with that object.
C: The program searches for an exception handler, moving up the call stack.
B: The matching handler (catch block) executes to catch the exception.
Option 2: the handler search starts only after the exception is raised, so C cannot come before A.
Option 3: the catch block runs only after a handler is found, so B cannot come before C.
Related questions:
2025: 3 June Shift 2
2025: 21 May Shift 1
2025: 16 May Shift 1