Software Development Fundamentals — Question 51
The purpose of the Catch section in an exception handler is to:
Answer options
- A. Break out of the error handler.
- B. Conclude the execution of the application.
- C. Execute code only when an exception is thrown.
- D. Execute code regardless of whether an exception is thrown.
Correct answer: C
Explanation
The correct answer is C because the Catch block is specifically designed to execute code in response to exceptions being thrown. Options A and B misinterpret the function of the Catch block, while option D inaccurately describes its behavior since the Catch block only runs when an exception is encountered.