5.
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 = b / a;
           System.out.print("Hello");
       }
       catch(Exception e) 
       {
           System.out.print("World");
       } 
    }
}

9.
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(DevideByZeroException e)
       {
           System.out.print("Exception");
       } 
    }
}

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

Read More Section(Exceptions)

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