Which of the following is a checked exception in Java?
Q.2Easy
Which exception is thrown when a method receives an illegal or inappropriate argument?
Q.3Easy
Can you have a try block without a catch block in Java?
Q.4Easy
Which of the following is NOT a subclass of Throwable in Java?
Q.5Easy
Which exception is thrown when trying to access a method of a null object?
Advertisement
Q.6Easy
Which exception is thrown when a string cannot be converted to a number?
Q.7Easy
What is the output of this code?
public class Test {
public static void main(String[] args) {
try {
int[] arr = {1, 2};
System.out.println(arr[5]);
} catch (Exception e) {
System.out.println("Caught");
}
}
}
Q.8Easy
In Java exception handling, what is the order of execution in try-finally-catch block?
Q.9Easy
Which exception is thrown when a numeric string cannot be converted to a number?
Q.10Easy
What will be the output?
public class Demo {
public static void main(String[] args) {
try {
System.out.println("A");
throw new Exception("Test");
System.out.println("B");
} catch (Exception e) {
System.out.println("C");
}
}
}
Q.11Easy
Which of the following exceptions is a checked exception in Java?
Q.12Easy
What is the correct syntax for declaring multiple exceptions in a method signature?
Q.13Easy
In Java exception handling, what is the purpose of the finally block?
Q.14Easy
What is the difference between 'throw' and 'throws' keywords in Java?
Q.15Easy
Which exception is thrown when a method argument is null but shouldn't be?
Q.16Easy
What happens when an unchecked exception is not caught?
Q.17Easy
Which exception is thrown when attempting to access an index outside the bounds of an array?
Q.18Easy
Consider a method signature: public void readFile() throws IOException. Which statement is correct?
Q.19Easy
Which of the following statements about try-catch-finally blocks is correct?
Q.20Easy
What is the output of the following code?
public class ExceptionTest {
public static void main(String[] args) {
try {
int x = 010;
} catch (ArithmeticException e) {
System.out.println("Caught");
} finally {
System.out.println("Finally");
}
}
}