JSP and Servlets Quiz

Test your knowledge of Java Server Pages (JSP), Servlets, cookies, scopes, and HTTP web technology concepts.

12 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

The error message displayed when the page is not found at the correct location.

  1. 404
  2. 505
  3. 440
  4. 550
Question 2 True/False

State true or false -- Can a JSP process HTML form data

  1. True
  2. False
Question 3 Multiple Choice (Multiple Answers)

Which of the following statements is true about the GenericServlet. (Multiple choice)

  1. GenericServlet is for servlets that might not use HTTP, like for instance FTP service.
  2. As of only Http is implemented completely in GenericServlet.
  3. The GenericServlet has a service() method that gets called when a client request is made.
  4. GenericServlet is called by both incoming requests and the HTTP requests are given to the servlet as they are.
Question 4 Multiple Choice (Single Answer)

In a Java servlet/JSP, if you attempt to redirect (or forward) after output has already been written and the HTTP response has been committed, what happens?

  1. A java.lang.IllegalStateException is thrown ("response already committed")
  2. An HTTP 402 Payment Required error is returned to the client
  3. An HTTP 404 Not Found error is returned to the client
  4. A java.lang.NullPointerException is thrown
Question 5 True/False

URLConnection instance represents a link for accessing or communicating with the resource at the location.

  1. True
  2. False
Question 6 Multiple Choice (Multiple Answers)

Java Server Pages technology commonly called JSP technology offers the following advantages

  1. Separation of dynamic and static content.
  2. Support for scripting and tags
  3. Reuse of components and tags.
  4. Web access layer for N-tier enterprise application architecture
Question 7 Multiple Choice (Multiple Answers)

Which of the following statements is true about the scope of ‘application’ in JSP ?

  1. Objects with application scope are accessible from pages processing requests that are in the same application as they one in which they were created.
  2. All references to the object shall be released when the runtime environment reclaims the ServletContext.
  3. Objects with application scope can be defined (and reached) from pages that are not session-aware
  4. References to objects with application scope are stored in the application object associated with a page activation
Question 8 Multiple Choice (Single Answer)

The maximum age of the cookie in JSP can be set by

  1. cookie.setMaxAge(int seconds)
  2. cookie.setMaxAge(float seconds)
  3. cookie.setAgeMax (float seconds)
  4. cookie.setAgeMax (int seconds)
Question 9 Multiple Choice (Multiple Answers)

Following methods can be overridden in the JSP page.

  1. _jspService()
  2. jspInit()
  3. jspDestroy()
  4. getParameter()
Question 10 Multiple Choice (Multiple Answers)

What are the possible ways of communication between applet and Servlet (Multiple Choice?)

  1. HTTP Communication (Text-based and object-based)
  2. Socket Communication
  3. RMI Communication
  4. None of these
Question 11 True/False

We make use of a ServletOutputStream object from the JSP page

  1. True
  2. False
Question 12 Multiple Choice (Single Answer)

Which tag in the jsp is used to define the error page.

  1. error-page
  2. exception-type
  3. location
  4. None of the above