Exception Handling in Java

Check how well you handle errors and exceptions in Java programs.

1. Which of the following is an example of an unchecked exception in Java?
2. Which components are part of exception handling in Java?
3. Checked exceptions must be handled or declared in the method signature.
4. What keyword is used to declare that a method might throw a checked exception?
5. Which block ensures resources are closed automatically after use?
6. Which of the following are checked exceptions?
7. A try block can exist without a catch or finally block.
8. What is the parent class of all exceptions in Java?
9. What is the output of: try { int x = 10/0; } catch (ArithmeticException e) { System.out.print("Error"); } finally { System.out.println("Done"); }
10. Which statements about the finally block are true?
11. Custom unchecked exceptions typically extend RuntimeException.
12. What keyword is used to explicitly throw an exception object?
13. Which exception is thrown by Integer.parseInt("abc")?
14. Which are true about try-with-resources?
15. What happens when an exception is not caught by any catch block?
Answered 0 of 0 — 0 correct