Top 50+ Solved Servlet and Overview MCQ Questions Answer
Q. In HTTP Request method Get request is secured because data is exposed in URL bar
a. True
b. False
c. none
d. all
Q. In the following statements identify the disadvantages of CGI?
a. If number of clients increases, it takes more time for sending response
b. For each request, it starts a process and Web server is limited to start processes
c. It uses platform dependent language e.g. C, C++, perl
d. All mentioned above
Q. Which method is used to specify before any lines that uses the PintWriter?
a. setPageType()
b. setContextType()
c. setContentType()
d. setResponseType()
Q. What are functions of Servlet container?
a. Lifecycle management
b. Communication Support
c. Multithreading Support
d. All of the above
Q. Which object of HttpSession can be used to view and manipulate information about asession?
a. session identifier
b. creation time
c. last accessed time
d. All mentioned above
Q. Which methods are used to bind the objects on HttpSession instance and get the objects?
a. setAttribute
b. getAttribute
c. Both A & B
d. None of the above
Q. Which of the following are interface? 1. ServletContext 2. Servlet 3. GenericServlet 4. HttpServlet
a. 1,2,3,4
b. 1,2
c. 1,2,3
d. 1,4
Q. The life cycle of a servlet is managed by
a. servlet context
b. servlet container
c. the supporting protocol (such as http or https)
d. All of the above
Q. Which of the following code is used to get an attribute in a HTTP Session object inservlets?
a. session.getAttribute(String name)
b. session.alterAttribute(String name)
c. session.updateAttribute(String name)
d. session.setAttribute(String name)
Q. What is the difference between servlets and applets?i. Servlets execute on Server; Applets execute on browser ii. Servlets have no GUI; Applet has GUI iii. Servlets creates static web pages; Applets creates dynamic web pages iv. Servlets can handle only a single request; Applet can handle multiple requests
a. i, ii, iii are correct
b. i, ii are correct
c. i, iii are correct
d. i, ii, iii, iv are correct
Q. Which are the session tracking techniques?i. URL rewriting ii. Using session object iii.Using response object iv. Using hidden fields v. Using cookies vi. Using servlet object
a. i, ii, iii, vi
b. i, ii, iv, v
c. i, vi, iii, v
d. i, ii, iii, v