Java Exceptions- Quiz for Beginners(With Answers & Explanations)

1. Which of the following is a checked exception?

 
 
 
 

2. What happens if a method throws a checked exception but does not declare it in the method signature or handle it?

 
 
 
 

3. Which of the following is a runtime exception?

 
 
 
 

4. Which keyword is used to manually throw an exception in Java?

 
 
 
 

5. What is the output of the following code?


try {
int a = 10 / 0;
} catch (ArithmeticException e) {
System.out.println("Exception caught");
}

 
 
 
 





Leave a Reply

Your email address will not be published. Required fields are marked *