Similar Collections


    No collections found

questions

Title
When does Exceptions in Java arises in code sequence

When does Exceptions in Java arises in code sequence?


  1. Run Time
  2. Compilation Time
  3. Can Occur Any Time
  4. None of the mentioned
discuss
Which of these keywords must be used to monitor for exceptions

Which of these keywords must be used to monitor for exceptions?


  1. try
  2. finally
  3. throw
  4. catch
discuss
Which of these keywords must be used to handle the exception thrown by try block in some rational manner

Which of these keywords must be used to handle the exception thrown by try block in some rational manner?


  1. try
  2. finally
  3. throw
  4. catch
discuss
What is the output of this program

What is the output of this program?

    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                System.out.print("Hello" + " " + 1 / 0);
            }
            catch(ArithmeticException e) 
            {
         System.out.print("World");         
            }
        }
    }

  1. Hello
  2. World
  3. HelloWorld
  4. Hello World
discuss
What is the output of this program

What is the output of this 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");         
            }
        }
    }

  1. A
  2. B
  3. Compilation Error
  4. Runtime Error
discuss
Which of the following keywords is used for throwing exception manually

Which of the following keywords is used for throwing exception manually?


  1. finally
  2. try
  3. throw
  4. catch
discuss
Which of the following classes can catch all exceptions which cannot be caught

Which of the following classes can catch all exceptions which cannot be caught?


  1. RuntimeException
  2. Error
  3. Exception
  4. ParentException
discuss
Which of the following is a super class of all exception type classes

Which of the following is a super class of all exception type classes?


  1. Catchable
  2. RuntimeExceptions
  3. String
  4. Throwable
discuss
Which of the following operators is used to generate instance of an exception which can be thrown using throw

Which of the following operators is used to generate instance of an exception which can be thrown using throw?


  1. thrown
  2. alloc
  3. malloc
  4. new
discuss
Which of the following keyword is used by calling function to handle exception thrown by called function

Which of the following keyword is used by calling function to handle exception thrown by called function?


  1. throws
  2. throw
  3. try
  4. catch
discuss
Which of the following handles the exception when a catch is not used

Which of the following handles the exception when a catch is not used?


  1. finally
  2. throw handler
  3. default handler
  4. java run time system
discuss
Which part of code gets executed whether exception is caught or not

Which part of code gets executed whether exception is caught or not?


  1. finally
  2. try
  3. catch
  4. throw
discuss
Which of the following should be true of the object thrown by a thrown statement

Which of the following should be true of the object thrown by a thrown statement?


  1. Should be assignable to String type
  2. Should be assignable to Exception type
  3. Should be assignable to Throwable type
  4. Should be assignable to Error type
discuss
At runtime, error is recoverable

At runtime, error is recoverable.


  1. True
  2. False
  3. May be
  4. Can't say
discuss
Which of these clause will be executed even if no exceptions are found

Which of these clause will be executed even if no exceptions are found?


  1. throws
  2. finally
  3. throw
  4. catch
discuss
What is the output of this program

What is the output of this program?
Note : Execution command line : $ java exception_handling

    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                int a = args.length;
                int b = 10 / a;
                System.out.print(a);
            }
            catch (ArithmeticException e) 
            {
                    System.out.println("1");
            }
        }
    }

  1. 0
  2. 1
  3. Compilation Error
  4. Runtime Error
discuss
What is the output of this program

What is the output of this program?

    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                throw new NullPointerException ("Hello");
            }
            catch(ArithmeticException e)
            {
         System.out.print("B");         
            }
        }
    }

  1. A
  2. B
  3. Compilation Error
  4. Runtime Error
discuss
Which of these keywords are used for the block to be examined for exceptions

Which of these keywords are used for the block to be examined for exceptions?


  1. try
  2. catch
  3. throw
  4. check
discuss
Which of these statements is incorrect

Which of these statements is incorrect?


  1. try block need not to be followed by catch block
  2. try block can be followed by finally block instead of catch block
  3. try can be followed by both catch and finally block
  4. try need not to be followed by anything
discuss
What is the output of this program

What is the output of this program?

    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");
           } 
        }
    }

  1. Hello
  2. World
  3. HelloWOrld
  4. Compilation Error
discuss
total MCQs: 90

MCQs

90

Views

250

Best Answers

299

Points

5