11. |
Which part of code gets executed whether exception is caught or not?
|
||||||||
Answer:
Option (a) |
12. |
Which of the following should be true of the object thrown by a thrown statement?
|
||||||||
Answer:
Option (c) |
13. |
At runtime, error is recoverable.
|
||||
Answer:
Option (b) |
14. |
Which of these class is related to all the exceptions that can be caught by using catch?
|
||||||||
Answer:
Option (b) |
15. |
What exception thrown by parseInt() method?
|
||||||||
Answer:
Option (d) |
16. |
What will be the output of the following Java code?
class exception_handling { public static void main(String args[]) { try { int a = args.length; int b = 10 / a; System.out.print(a); try { if (a == 1) a = a / a - a; if (a == 2) { int []c = {1}; c[8] = 9; } } catch (ArrayIndexOutOfBoundException e) { System.out.println("TypeA"); } catch (ArithmeticException e) { System.out.println("TypeB"); } } } }
|
||||||||
Answer:
Option (c) |
17. |
What will be the output of the following Java code?
class exception_handling { public static void main(String args[]) { try { System.out.print("A"); throw new NullPointerException ("Hello"); } catch(ArithmeticException e) { System.out.print("B"); } } }
|
||||||||
Answer:
Option (d) |
18. |
A single try block must be followed by which of these?
|
||||||||
Answer:
Option (c) |
19. |
Which of these exceptions will occur if we try to access the index of an array beyond its length?
|
||||||||
Answer:
Option (d) |
20. |
What is the use of try & catch?
|
||||||||
Answer:
Option (d) |