JSP and Servlets Quiz
Test your knowledge of Java Server Pages (JSP), Servlets, cookies, scopes, and HTTP web technology concepts.
Questions
The error message displayed when the page is not found at the correct location.
- 404
- 505
- 440
- 550
State true or false -- Can a JSP process HTML form data
- True
- False
Which of the following statements is true about the GenericServlet. (Multiple choice)
- GenericServlet is for servlets that might not use HTTP, like for instance FTP service.
- As of only Http is implemented completely in GenericServlet.
- The GenericServlet has a service() method that gets called when a client request is made.
- GenericServlet is called by both incoming requests and the HTTP requests are given to the servlet as they are.
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?
- A java.lang.IllegalStateException is thrown ("response already committed")
- An HTTP 402 Payment Required error is returned to the client
- An HTTP 404 Not Found error is returned to the client
- A java.lang.NullPointerException is thrown
URLConnection instance represents a link for accessing or communicating with the resource at the location.
- True
- False
Java Server Pages technology commonly called JSP technology offers the following advantages
- Separation of dynamic and static content.
- Support for scripting and tags
- Reuse of components and tags.
- Web access layer for N-tier enterprise application architecture
Which of the following statements is true about the scope of ‘application’ in JSP ?
- Objects with application scope are accessible from pages processing requests that are in the same application as they one in which they were created.
- All references to the object shall be released when the runtime environment reclaims the ServletContext.
- Objects with application scope can be defined (and reached) from pages that are not session-aware
- References to objects with application scope are stored in the application object associated with a page activation
The maximum age of the cookie in JSP can be set by
- cookie.setMaxAge(int seconds)
- cookie.setMaxAge(float seconds)
- cookie.setAgeMax (float seconds)
- cookie.setAgeMax (int seconds)
Following methods can be overridden in the JSP page.
- _jspService()
- jspInit()
- jspDestroy()
- getParameter()
What are the possible ways of communication between applet and Servlet (Multiple Choice?)
- HTTP Communication (Text-based and object-based)
- Socket Communication
- RMI Communication
- None of these
We make use of a ServletOutputStream object from the JSP page
- True
- False
Which tag in the jsp is used to define the error page.
- error-page
- exception-type
- location
- None of the above