Mcq On Java Exception

1. Which statement is true?

A. catch(X x) can catch subclasses of X where X is a subclass of Exception.
B. Any statement that can throw an Exception must be enclosed in a try block.
C. The Error class is a RuntimeException.
D. Any statement that can throw an Error must be enclosed in a try block.

View Answer


2. Which statement is true?

A. An Error that might be thrown in a method must be declared as thrown by that method, or be handled within that method.
B. Multiple catch statements can catch the same class of exception more than once.
C. A try statement must have at least one corresponding catch block.
D. Except in case of VM shutdown, if a try block starts to execute, a corresponding finally block will always start to execute.

View Answer


3. When does Exceptions in Java arises in code sequence?

A. Run Time
B. Can Occur Any Time
C. Compilation Time
D. None of the mentioned

View Answer


4.Which of these keywords is not a part of exception handling?

A. finally
B. thrown
C. catch
D. try

View Answer


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

A. finally
B. throw
C. catch
D. try

View Answer


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

A. finally
B. throw
C. catch
D. try

View Answer


7.Which of these keywords is used to manually throw an exception?

A. finally
B. throw
C. catch
D. try

View Answer


8. Which of these is a super class of all errors and exceptions in the Java language?

A. Catchable
B. Throwable
C. RunTimeExceptions
D. None of the above

View Answer


9. In which of the following package Exception class exist?

A. java.file
B. java.lang
C. java.io
D. java.util
E. java.net

View Answer


10.Which exception is thrown when divide by zero statement executes?

A. NumberFormatException
B. NullPointerException
C. ArithmeticException
D. None of these

View Answer






Also check :


Discussion


* You must be logged in to add comment.