Difficulty: Easy
Correct Answer: Exception occurred Remaining program
Explanation:
Introduction / Context:
This program converts input to an index and assigns val = 66 to a[index] in a 5-element array. It uses a single catch(Exception) block. We input "6" to trigger an out-of-range access.
Given Data / Assumptions:
Concept / Approach:
Any exception thrown within the try block is caught by the general catch(Exception). After handling, the program continues unless rethrow or exit is used.
Step-by-Step Solution:
Verification / Alternative check:
If index were 2, no exception would occur and output would be only "Remaining program ".
Why Other Options Are Wrong:
Common Pitfalls:
Assuming execution halts after an exception when it is actually caught and handled.
Final Answer:
Exception occurred Remaining program
Discussion & Comments