Java Exceptions  «Prev  Next»

Java User Defined Exceptions - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 
1. You can create a new Exception called BigException by writing
Please select the best answer.
  A. class BigException { }
  B. class BigException extends Exception implements Throwable { }
  C. class BigException extends Exception { }

2. Imagine you are catching an exception called IOException and have assigned this exception to the variable e.
One way to display information about the exception in your catch block is to write this line of code
Please select the best answer.
  A. e.getMessage();
  B. System.out.println(e.getMessage());
  C. System.err.println(e.getMessage());


3. You should never create and throw exceptions based on type
Please select the best answer.
  A. RuntimeException
  B. IOException
  C. Exception


Your score is 0.0
C
B
A