Multiple choice general knowledge science & technology

Which of the following exceptions are thrown by the doGet() method?

  1. NullPointerException

  2. ServletException

  3. FileNotFoundException

  4. IOException

  5. none of the above

Reveal answer Fill a bubble to check yourself
B,D Correct answer
Explanation

The doGet() method in HttpServlet explicitly declares ServletException and IOException in its method signature. ServletException is thrown for servlet-specific errors, while IOException handles general I/O errors during request processing. NullPointerException (unchecked) and FileNotFoundException (not thrown by doGet) are not declared exceptions.