A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

1. When does Exceptions in Java arises in code sequence?
a. Run Time
b. Compilation Time
c. Can Occur Any Time
d. None of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (a).Run Time

2. Which of these keywords must be used to monitor for exceptions?
a. try
b. finally
c. throw
d. catch
View Answer Report Discuss Too Difficult!
Answer: (a).try

3. Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
a. try
b. finally
c. throw
d. catch
View Answer Report Discuss Too Difficult!
Answer: (d).catch

4. 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");         
            }
        }
    }
a. Hello
b. World
c. HelloWorld
d. Hello World
View Answer Report Discuss Too Difficult!
Answer: (b).World

5. 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");         
            }
        }
    }
a. A
b. B
c. Compilation Error
d. Runtime Error
View Answer Report Discuss Too Difficult!
Answer: (b).B

6. Which of the following keywords is used for throwing exception manually?
a. finally
b. try
c. throw
d. catch
View Answer Report Discuss Too Difficult!
Answer: (c).throw

7. Which of the following classes can catch all exceptions which cannot be caught?
a. RuntimeException
b. Error
c. Exception
d. ParentException
View Answer Report Discuss Too Difficult!
Answer: (b).Error

8. Which of the following is a super class of all exception type classes?
a. Catchable
b. RuntimeExceptions
c. String
d. Throwable
View Answer Report Discuss Too Difficult!
Answer: (d).Throwable

9. Which of the following operators is used to generate instance of an exception which can be thrown using throw?
a. thrown
b. alloc
c. malloc
d. new
View Answer Report Discuss Too Difficult!
Answer: (d).new

10. Which of the following keyword is used by calling function to handle exception thrown by called function?
a. throws
b. throw
c. try
d. catch
View Answer Report Discuss Too Difficult!
Answer: (a).throws

Page 1 of 7