Multiple Choice Question

Quiz Guidelines

 

QID: 
520
Question: 

What will be the output of the following program:

public class TestClass{
public static void main(String args[]){
try{
m1();
}catch(IndexOutOfBoundsException e){
System.out.println("1");
throw new NullPointerException();
}catch(NullPointerException e){
System.out.println("2");
return;
}catch (Exception e) {
System.out.println("3");
}finally{
System.out.println("4");
}
System.out.println("END");
}     // IndexOutOfBoundsException is a subclass of RuntimeException.
static void m1(){
System.out.println("m1 Starts");
throw new IndexOutOfBoundsException( "Big Bang " );
}
}

Select 3 options

A. The program will print m1 Starts.
B. The program will print m1 Starts, 1 and 4, in that order.
C. The program will print m1 Starts, 1 and 2, in that order.
D. The program will print m1 Starts, 1, 2 and 4 in that order.
E. END will not be printed.

Q&A Set: