Top 50+ Solved Servlet and Overview MCQ Questions Answer
Q. How is the dynamic interception of requests and responses to transform the informationdone?
a. servlet container
b. servlet config
c. servlet context
d. servlet filter
Q. Which type of ServletEngine is a server that includes built-in support for servlets?
a. Add-on ServletEngin
b. Embedded ServletEngine
c. Standalone ServletEngine
d. None of the above
Q. Which cookie it is valid for single session only and it is removed each time when the usercloses the browser?
a. Persistent cookie
b. Non-persistent cookie
c. All the above
d. None of the above
Q. Sessions is a part of the SessionTracking and it is for maintaining the client state at serverside.
a. True
b. False
c. none
d. all
Q. When destroy() method of a filter is called?
a. The destroy() method is called only once at the end of the life cycle of a filter
b. The destroy() method is called after the filter has executed doFilter method
c. The destroy() method is called only once at the begining of the life cycle of a filter
d. The destroyer() method is called after the filter has executed
Q. Which method is used to send the same request and response objects to another servlet inRequestDispacher ?
a. forward()
b. sendRedirect()
c. Both A & B
d. None of the above
Q. Which packages represent interfaces and classes for servlet API?
a. javax.servlet
b. javax.servlet.http
c. Both A & B
d. None of the above
Q. Which class can handle any type of request so that it is protocol-independent?
a. GenericServlet
b. HttpServle
c. Both A & B
d. None of the above
Q. Which object is created by the web container at time of deploying the project?
a. ServletConfig
b. ServletContext
c. Both A & B
d. None of the above
Q. What is the lifecycle of a servlet?
a. Servlet class is loaded
b. Servlet instance is created
c. init,Service,destroy method is invoked
d. All mentioned above
Q. Which method in session tracking is used in a bit of information that is sent by a web server to a browser and which can later be read back from that browser?
a. HttpSession
b. URL rewriting
c. Cookies
d. Hidden form fields