Q: An error is sometimes thrown in a certain try…catch block. You know that the issue can be fixed within the code during the error handling code block. What statement could you use when the error is found to run the code again?
-
A
The throw statement should be used in the catch statement to rerun the try block.
-
B
The finally statement should be used in the catch statement to rerun the try block.
-
C
The retry statement could be used in the catch statement to rerun the try block.
-
D
A business system function should be used in the catch statement to rerun the try block.
A
Answer:
A
Explanation:
- A. Incorrect: A throw statement does not rerun the try block when an error is found.
- B. Incorrect: The finally statement runs code regardless of how the try block is exited. It does not try to rerun the try block.
- C. Correct: The retry statement will rerun the try block to give the code another opportunity to succeed.
- D. Incorrect: A business system function is used to calculate or enter financial data. It is not used for error handling.
Related Topic:
Share Above MCQ