Java Programming - Java Exception Handling Questions and Answers

Related Topics:

Java Programming : Java Exception Handling

Java Exception Handling Multiple Choice Questions and Answers with Explanations and Example for various Java Interviews, Copetetive Exams. Exception Handling in Java. An exception is an event in java.
1. The exception class is in ____ package
[A] java.file
[B] java.io
[C] java.lang
[D] java.util

Answer: C. java.lang

2. Which keyword is used to monitor statement for exception?
[A] try
[B] ctach
[C] throw
[D] throws

Answer: A. try

3. If an exception is generated in try block , then it is caught in ____ block
[A] finally
[B] throw
[C] throws
[D] catch

Answer: D. catch

4. To explicitly throw an exception , ______ keyword is used.
[A] try
[B] ctach
[C] throw
[D] throwing

Answer: C. throw

5. ______ is a superclass of all exception classes.
[A] Exception
[B] Throwable
[C] RuntimeException
[D] IOException

Answer: B. Throwable

6. Exception is subclass of ____ class
[A] Exception
[B] Throwable
[C] RuntimeException
[D] IOException

Answer: B. Throwable

7. If a statement tries to divide by zero which exception is thrown?
[A] ArithemticException
[B] NullPointerException
[C] NumberFormatException
[D] None of these

Answer: A. ArithemticException

8. When a method can throw an exception then it is specified by _____ keyword
[A] finally
[B] throw
[C] throws
[D] catch

Answer: C. throws

9. Which block gets executed compulsory whether exception is caught or not.
[A] finally
[B] throw
[C] throws
[D] catch

Answer: A. finally

10. To create our own exception class , we have to _______
[A] Extend exception class
[B] Create our own try and catch block
[C] use finally block
[D] Use throws keyword

Answer: A. Extend exception class


Comments: (Your feedback is valuable to us)

Fairoz 10 months ago Reply

Very nice and helpful


Abhijit Kute 11 months ago Reply

I have amazing experience with you , I learn much more from envision , thank you envision to supporting me to walk on logical way......


rajeev 1 year ago Reply

u would have kept radio buttons and made it like a quiz with answers shown at end .... nice info though


warisha 1 year ago Reply

(Y) appriciate


Smile Wizard 2 years ago Reply

You Guys are great.... you help me test how good iam in Java


Anita Mehra 2 years ago Reply

gud job appreciated


Debjit Rowdian Banerjee 2 years ago Reply

9789789789789


Jignesh Sangale 2 years ago Reply

good..


Sharanya Sharan 2 years ago Reply

gud


Sharanya Sharan 2 years ago Reply

gud