1. What is an exception in Java?
2. Which keyword is used to handle exceptions in Java?
3. What is the purpose of the "try" block in exception handling?
4. In Java, can a method declare multiple exceptions using the "throws" keyword?
5. What is the purpose of the "catch" block in exception handling?
6. In Java, can a "catch" block catch multiple exceptions?
7. What is the purpose of the "throw" keyword in Java exception handling?
8. In Java, can a method throw any checked exception without declaring it using "throws"?
9. What is the purpose of the "throws" keyword in Java method declaration?
10. What is the result of the following code snippet?
try {
int[] arr = new int[5];
int value = arr[10];
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Exception Caught!");
}
try {
int[] arr = new int[5];
int value = arr[10];
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Exception Caught!");
}
Read More Section(Exceptions)
Each Section contains maximum 100 MCQs question on Exceptions. To get more questions visit other sections.