Top 250+ Solved Advanced JAVA MCQ Questions Answer
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
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