ExamVeda
Login
Home
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" ); 
        } 
    } 
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
72
Which of the following classes can catch all exceptions which cannot be caught?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
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");
            }
        }
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
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");
        }
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
75
Which of these keywords are used for the block to be examined for exceptions?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
76
Which part of code gets executed whether exception is caught or not?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
77
Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
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");
                }
            }
        }
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
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");
       } 
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
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");        	
        }
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board