71.
What will be the output of the following Java code?
public class A
 {  
    public static void main(String[] args) 
    {
        try 
        { 
            return; 
        } 
        finally 
        {
            System.out.println( "Finally" ); 
        } 
    } 
}

73.
What will be the output of the following Java code?
class exception_handling 
{
    public static void main(String args[]) 
    {
        try 
        {
            int a = args.length;
            int b = 10 / a;
            System.out.print(a);
            try 
            {
                if (a == 1)
                    a = a / a - a;
                if (a == 2) 
                {
                    int []c = {1};
                    c[8] = 9;
                }
            }
            catch (ArrayIndexOutOfBoundException e) 
            {
                System.out.println("TypeA");
            }
            catch (ArithmeticException e) 
            {
                System.out.println("TypeB");
            }
        }
    }
}

74.
What will be the output of the following Java code?
class exception_handling 
{
    public static void main(String args[]) 
    {
        try 
        {
            int i, sum;
            sum = 10;
            for (i = -1; i < 3 ;++i) 
            {
                sum = (sum / i);
            System.out.print(i);
            }
        }
        catch(ArithmeticException e) 
        {     	
            System.out.print("0");
        }
    }
}

78.
What will be the output of the following Java code?
class exception_handling 
        {
            public static void main(String args[])
            {
                try 
                {
                    int a = 1;
                    int b = 10 / a;
                    try 
                    {
                         if (a == 1)
                             a = a / a - a;
                         if (a == 2) 
                         {
                             int c[] = {1};
                             c[8] = 9;
                         }
                    }
                    finally 
                    {
                        System.out.print("A");
                    }
                }
                catch (Exception e) 
                {
                        System.out.println("B");
                }
            }
        }

79.
What will be the output of the following Java code?
class Output 
{
    public static void main(String args[]) 
    {
       try 
       {
           int a = 0;
           int b = 5;
           int c = a / b;
           System.out.print("Hello");
       }
       finally 
       {
           System.out.print("World");
       } 
    }
}

80.
What will be the output of the following Java code?
class exception_handling 
{
    public static void main(String args[])
    {
        try 
        {
            throw new NullPointerException ("Hello");
            System.out.print("A");
        }
        catch(ArithmeticException e) 
        {
      System.out.print("B");        	
        }
    }
}

Read More Section(Exceptions)

Each Section contains maximum 100 MCQs question on Exceptions. To get more questions visit other sections.