Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 4 : AC

Advertisement

Detailed Solution

सही उत्तर AC है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

Consider the Java fragment: try { int[] a = new int[2]; a[5] = 10; } catch (ArrayIndexOutOfBoundsException e) { System.out.print("A"); } catch (Exception e) { System.out.print("B"); } finally { System.out.print("C"); } What is printed? / Java कोड खंड पर विचार करें: try { int[] a = new int[2]; a[5] = 10; } catch (ArrayIndexOutOfBoundsException e) { System.out.print("A"); } catch (Exception e) { System.out.print("B"); } finally { System.out.print("C"); } क्या मुद्रित होगा?

1.
A
2.
B
3.
ABC
4.
AC

Correct Answer: AC

a[5] throws ArrayIndexOutOfBoundsException, caught by the first catch (A); the more general catch is skipped, and finally always runs (C), giving AC. / a[5] से ArrayIndexOutOfBoundsException फेंका जाता है, जो पहले catch (A) से पकड़ा जाता है; सामान्य catch छूट जाता है, और finally सदैव चलता है (C), अतः AC।

Downloaded from PrepSnap (prepsnap.in)