Skip to main contentSkip to solution

Arrange the steps of handling exceptions in order:

(A) The exception object is handed over to the runtime system so that it can find an appropriate code to handle this particular exception.

(B) If the runtime system is not able to find an appropriate exception after searching all the methods in the call stack, then the program execution stops.

(C) The runtime system searches the entire program for a block of code, called the exception handler that can handle the raised exception.

(D) When an error occurs, Python interpreter creates an object called the exception object.

Solution

✅ Correct Option: 4

The order follows what happens when an error occurs.

(D) The interpreter creates an exception object. (A) This object is handed to the runtime system. (C) The runtime system searches for an exception handler that can handle it. (B) If no handler is found after searching all methods in the call stack, the program stops.


Option 2: puts the search (C) and the stopping of the program (B) before the object is handed over (A), but the search cannot start until the runtime system has the object.

Option 3: places the stop (B) before the hand-over and search, but the program stops only after the search fails.

Keyboard Shortcuts

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