Quiz on Exceptions
Here, scoring the highest is not the goal, understanding each concept is. This quiz is here to help you to identify the gaps in your understanding of exceptions.
1
What will be the result when the code below is executed?
class Exceptions{
public static void main(String args[]){
String str = "#^6";
try{
int i = Integer.parseInt(str);
}
catch (NumberFormatException e){
System.out.println("A");
}
catch (ArithmeticException e){
System.out.println("B");
return;
}
catch (Exception e){
System.out.println("C");
}
finally{
System.out.println("D");
}
System.out.println("E");
}
}
A)
Prints E
B)
Prints C
C)
Prints A
,
D
,
E
D)
Prints B
,
D
,
E
Question 1 of 100 attempted
Get hands-on with 1400+ tech skills courses.