Java JSP (Java Server Pages) MCQs with answers Page - 3

Here, you will find a collection of MCQ questions on Java JSP (Java Server Pages). Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

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

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ