JSP Servlet MCQs with answers Page - 1

You will find multiple-choice questions (MCQs) related to #JSP Servlet here. Go through these questions to prepare effectively for your upcoming exams and interviews.

To view the correct answer for any question, simply click the "Show Answer" button.

Have a question to share? Click on "Add Question" to contribute!

S

Satya • 3.38K Points
Extraordinary

Q. What is a Servlet?

  • (A) A client-side Java program
  • (B) A server-side Java component used to handle HTTP requests
  • (C) A database driver
  • (D) A JavaScript library

S

Satya • 3.38K Points
Extraordinary

Q. Servlets run on?

  • (A) Browser
  • (B) Web Server / Servlet Container
  • (C) Database Server
  • (D) Operating System Kernel

S

Satya • 3.38K Points
Extraordinary

Q. Which package contains the GenericServlet class?

  • (A) java.servlet
  • (B) javax.servlet
  • (C) javax.servlet.http
  • (D) java.http

S

Satya • 3.38K Points
Extraordinary

Q. Which class is commonly extended to create HTTP servlets?

  • (A) ServletRequest
  • (B) HttpServlet
  • (C) ServletContext
  • (D) ServletConfig

S

Satya • 3.38K Points
Extraordinary

Q. Which method handles HTTP GET requests?

  • (A) doPost()
  • (B) doGet()
  • (C) service()
  • (D) init()

S

Satya • 3.38K Points
Extraordinary

Q. Which method handles HTTP POST requests?

  • (A) doPost()
  • (B) doGet()
  • (C) destroy()
  • (D) init()

S

Satya • 3.38K Points
Extraordinary

Q. Which method is called only once during the servlet lifecycle?

  • (A) service()
  • (B) doGet()
  • (C) init()
  • (D) destroy()

S

Satya • 3.38K Points
Extraordinary

Q. Which method is called when the servlet is removed from service?

  • (A) service()
  • (B) init()
  • (C) destroy()
  • (D) doPost()

S

Satya • 3.38K Points
Extraordinary

Q. Which object is used to read client request data?

  • (A) HttpServletResponse
  • (B) HttpServletRequest
  • (C) ServletContext
  • (D) PrintWriter

S

Satya • 3.38K Points
Extraordinary

Q. Which object is used to send response to the client?

  • (A) HttpServletRequest
  • (B) ServletConfig
  • (C) HttpServletResponse
  • (D) ServletContext
What's Tag

As you may know, questions are organized under broad categories. Each category can include various types of questions. For example, the "History" category might contain questions about the Revolt of 1857, Shivaji Maharaj, Ancient History, Buddhism, and more.

To further refine this organization, we've introduced tags, which act as sub-categories to group questions more specifically.

Verified users can add tags to any question. If you have any suggestions regarding this system, we'd love to hear from you. Contact Us

Learn More