Java Programming Multiple Choice Questions - Exception
This section focuses on the "Exception" of the Java programming. These Multiple Choice Questions (mcq) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Which statement is true?
Explanation:Option A is correct. If the class specified in the catch clause does have subclasses, any exception object that subclasses the specified class will be caught as well.
Option B is wrong. The error class is a subclass of Throwable and not Runtime Exception.
Option C is wrong. You do not catch this class of error.
Option D is wrong. An exception can be thrown to the next method higher up the call stack
2. Which statement is true?
Explanation:A is wrong. A try statement can exist without catch, but it must have a finally statement.
B is wrong. A try statement executes a block. If a value is thrown and the try statement has one or more catch clauses that can catch it, then control will be transferred to the first such catch clause. If that catch block completes normally, then the try statement completes normally.
C is wrong. Exceptions of type Error and RuntimeException do not have to be caught, only checked exceptions (java.lang.Exception) have to be caught. However, speaking of Exceptions, Exceptions do not have to be handled in the same method as the throw statement. They can be passed to another method.
3. When does Exceptions in Java arises in code sequence?
Explanation:Exceptions in Java are run-time errors.
4.Which of these keywords is not a part of exception handling?
Explanation:Exceptional handling is managed via 5 keywords – try, catch, throws, throw and finally.
5. Which of these keywords must be used to monitor for exceptions?
Explanation: Try keywords must be used to monitor for exceptions
6. Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
Explanation: If an exception occurs within the try block, it is thrown and cached by catch block for processing.
7.Which of these keywords is used to manually throw an exception?
Explanation:Throw keywords is used to manually throw an exception.
8. Which of these is a super class of all errors and exceptions in the Java language?
Explanation:Throwable is a super class of all errors and exceptions in the Java language
9. In which of the following package Exception class exist?
10.Which exception is thrown when divide by zero statement executes?
Explanation:ArithmeticException is thrown when divide by zero statement executes.
Also check :