OCA Java SE 8 Mock Exam - OCA Mock Question 15








Question

Which of the following are checked exceptions? (Choose all that apply)

  1. Exception
  2. NullPointerException
  3. IOException
  4. IllegalArgumentException
  5. NumberFormatException
  6. StackOverflowError




Answer



A, C.

Note

Exception, which is a checked exception, is the base class for exceptions. A is correct.

B, D, and E extend RuntimeException directly or indirectly and therefore are unchecked exceptions.

F is a throwable and not an exception, and so should not be caught or declared.