92.
What will be the output of the following Java program?
class exception_handling 
{
    public static void main(String args[]) 
    {
        try 
       {
            int a, b;
            b = 0;
            a = 5 / b;
            System.out.print("A");
        }
        catch(ArithmeticException e) 
        {
      System.out.print("B");        	
        }
    }
}

95.
What will be the output of the following Java code?
class Myexception extends Exception 
{
int detail;
    Myexception(int a)
    {
        detail = a;
}
public String toString()
    {
  return "detail";
}
}
class Output 
{
    static void compute (int a) throws Myexception 
    {
   throw new Myexception(a);	 
}
public static void main(String args[]) 
    {
        try
        {
            compute(3);
        }
       catch(Myexception e)
       {
           System.out.print("Exception");
       } 
    }
}

97.
What will be the output of the following Java code?
class exception_handling 
{
    public static void main(String args[]) 
    {
        try 
        {
            throw new NullPointerException ("Hello");
        }
        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.