Arrange the following in the correct order of handling exceptions.
(A) Exception is raised.
(B) Run time system searches for exception handler in the current method.
(C) An Error encountered in a method.
(D) Create Exception Object.
Arrange the following in the correct order of handling exceptions.
(A) Exception is raised.
(B) Run time system searches for exception handler in the current method.
(C) An Error encountered in a method.
(D) Create Exception Object.
Solution
An error in a method first creates an exception object, which is then thrown (raised) to the run time system. Only after that does the run time system look for a handler, starting in the current method.
(C) An Error encountered in a method.
(D) Create Exception Object.
(A) Exception is raised.
(B) Run time system searches for exception handler in the current method.
Options 2 and 4: the handler search (B) cannot come before the exception is raised (A), because the run time system searches only after the object is thrown to it.
Related questions:
2025: 27 May Shift 2
2025: 15 May Shift 2
2026: 20 May Shift 1
2026: 11 May Shift 2