Top 250+ Solved Advanced JAVA MCQ Questions Answer
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
Q. A deployment descriptor describes
a. Web component response settings
b. Web component setting
c. Web component request objects
d. All of the above
Q. The values of <servlet-name> and <servlet-class> in web.xml file
a. must be same
b. must not be same
c. may be same
d. None of the above
Q. Which one is the correct order of phases in JSP life cycle?
a. Initialization, Cleanup, Compilation, Execution
b. Initialization, Compilation, Cleanup, Execution
c. Compilation, Initialization, Execution, Cleanup
d. Cleanup, Compilation, Initialization, Execution
Q. Which technology do we mix our business logic with the presentation logic?
a. Servlet
b. JSP
c. Both A and B
d. None of the above
Q. Which attribute specifies a JSP page that should process any exceptions thrown but not caught in the current page?
a. The ErrorPage Attribute
b. The IsErrorPage Attribute
c. Both A & B
d. None of the above
Q. Which of the following is an advantage of the statement – Separation of business logicfrom JSP ?
a. Custom Tags in JSP
b. JSP Standard Tag Library
c. All the above
d. None of the above
Q. JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you cando with Java servlets.
a. True
b. False
c. none
d. all
Q. JavaServer Pages often serve the same purpose as programs implemented using theCommon Gateway Interface (CGI)
a. True
b. False
c. none
d. all
Q. Which is the Microsoft solution for providing dynamic Web content?
a. ASP
b. JSP
c. Both A and B
d. None of the above
Q. Which tag is used to execute java source code in JSP?
a. Declaration Tag
b. Scriptlet tag
c. Expression tag
d. None of the above