public class Test1{
    public static void main(String args[]){
        System.out.println(method());
    }
    public static int method(){
       try{
          return 1;
       }
       catch(Exception e){
          return 2;
       }
       finally{
          return 3;
       }
    }
}
What will be the output?

A1

1

A2

2

A3

3

A4

0



Q2

public class Test2{
   public static void main(String args[]){
       System.out.println(method());
   }
   public static int method(){
       try{
           throw new Exception();
           return 1;
       }
       catch(Exception e){
           return 2;
       }
       finally{
           return 3;
       }
    }
}

What will be the output?

1

A1

2

A2

3

A3

4

A4

Compiler error



Q3

public class Test3{
    public static void main(String args[]){
        System.out.println(method());
    }
    public static int method(){
        try{
            throw new Exception();
        }
        catch(Exception e){
            throw new Exception();
        }
        finally{
            return 3;
        }
    }
}
What will be the output?

A1

3

A2

0

A3

Runtime Exception

A4

Compiler error



Q4

public class Test4{
    public static void main(String args[]){
        System.out.println(method());
    }
    public static int method(){
        return;
    }
}
What will be the output?

A1

null

A2

0

A3

Runtime exception

A4

Compiler error



Q5

import java.io.IOException;
public class Test5{
   public static void main(String args[]){
      try{
          throw new IOException();
      }
      catch(Exception e){
          System.out.println("Excepion");
      }
      catch(IOException e){
          System.out.println("IOExcepion");
      }
       }
}
What will be the output?

A1

Exception

A2

IOException

A3

Exception IOException

A4

Compilers error



Q6

public class Test6{
    public static void main(String args[]) throws Exception{
        try{
            throw new Exception();
        }
        finally{
            System.out.println("No Error");
        }
     }
}
What will be the output?

A1

No Error followed by java.lang.Exception

A2

java.lang.Exception followed by No Error

A3

No Error

A4

Compiler Error



Q7

ublic class Test7{
    public static void main(String args[]) throws Exception{
        Test7 t = new Test7();
        t.method();
        System.out.println("Print");
    }
    public void method()throws Exception{
        throw new Exception();
    }
}
What will be the output?

A1

Print

A2

Exception thrown at runtime

A3

no output

A4

Compiler Error



Q8

public class Test8{
    public static void main(String args[]) throws Exception{
        Test8 t = new Test8();
        t.method();
        System.out.println("Print");
    }
    public void method(){
        try{
            throw new Exception();
        }catch(Exception e){}
    }
}
What will be the output?

A1

Print

A2

Exception thrown at runtime

A3

no output

A4

Compiler Error



Q9

public class Test9 extends A{
    public static void main(String args[]) throws Exception{
        Test9 t = new Test9();
    }
}
class A{
    A() throws Exception{
        System.out.println("A Class");
    }
}
What will be the output?

A1

A Class

A2

Runtimxception

A3

no output

A4

Compiler Error



Q10

public class Test10 extends A{
    Test10()throws Exception{
        System.out.println("Test10 Class");
    }
    public static void main(String args[]) throws Exception{
        Test10 t = new Test10();
    }
}
class A{
    A() throws Exception{
        System.out.println("A Class");
    }
}
What will be the output?

A1

A Class Test10 Class

A2

Runtimxception

A3

no output

A4

Compiler Error



Q11

public class Test11 extends A{
    Test11()throws Exception{
        System.out.println("Test10 Class");
    }
    Test11(int i){}
    public static void main(String args[]) throws Exception{
        Test11 t = new Test11();
    }
}
class A{
    A() throws Exception{
        System.out.println("A Class");
    }
}
What will be the output?

A1

A Class Test10 Class

A2

Runtimxception

A3

no output

A4

Compiler Error



Q12

import java.io.IOException;
    public class Test12 extends A{
        public void method() throws Exception{
        System.out.println("Subclass");
    }
    public static void main(String args[]) throws Exception{
        A a = new A();
        a.method();
        a = new Test12();
        a.method();
    }
}
class A{
    public void method() throws IOException{
        System.out.println("Superclass");
    }
}
What will be the output?

A1

Subclass Superclass

A2

Runtimxception

A3

Superclass Superclass

A4

Compiler Error