Exception Handling Interview Questions

    Question 1JAVA - Exception Types

    Which of the following is a checked exception in Java?

    Question 2JAVA - Try-Catch Execution

    What will be the output?

    try { int x = 5 / 0; System.out.println("Try Block"); } catch(ArithmeticException e) { System.out.println("Catch Block"); }

    Question 3JAVA - Finally Block

    What will be the output?

    try { System.out.println("Try"); } finally { System.out.println("Finally"); }

    Question 4JAVA - Multiple Catch Blocks

    Which catch block order is correct?

    Question 5JAVA - Throw vs Throws

    Which statement is correct?

    Question 6JAVA - Exception Propagation

    What will be the output?

    class Test { void m() { int x = 10/0; } void n() { m(); } void p() { try { n(); } catch(Exception e) { System.out.println("Handled"); } } } new Test().p();

    Question 7JAVA - Custom Exception

    Which is correct about creating a custom exception?

    Question 8JAVA - Try with Multiple Resources

    Which Java version introduced try-with-resources for automatic resource management?

    Question 9JAVA - Exception Hierarchy

    Which is the top-most superclass of all exceptions in Java?

    Question 10JAVA - Catch Without Exception

    What will happen?

    try { System.out.println("Hello"); } catch(Exception e) { System.out.println("Catch"); } finally { System.out.println("Finally"); }