Do finally block get executed if the exception had not occurred?

  1. True

  2. False


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) True - This option is correct. The finally block is always executed, regardless of whether an exception occurred or not. It is typically used to release resources or perform cleanup actions that need to be done regardless of the outcome of the try-catch block.

Option B) False - This option is incorrect. The finally block is always executed, even if an exception did not occur.

The correct answer is A) True. This option is correct because the finally block will be executed regardless of whether an exception occurred or not.

Find more quizzes: