Font size
WorksheetsUnit4_Servlets_Exam1
Total questions: 24
Worksheet time: 12mins
The _______ specification defines an application programming interface for communication between the server and the application program
Java Servlet
java jdbc
java applet
java swing
Which packages represent interfaces and classes for servlet API?
javax.servlet
javax.servlet.http
both 1 and 2
none of the above
What is the lifecycle of a servlet?
Servlet class is loaded
Servlet instance is created
init(),service() and destroy() methods will be called
All the above
How many times init() method is called during life time of a servlet?
two times
one time
several times
never called
How many time destroy() method will be called during the life time of a Servlet?
one
two
several time
never called
When will call init() method of a servlet?
(a)
When destroy method() of servlet called ?
for first request
when you close the browser window
when you remove the application from server
none of the above
web.xml file is available in which directory of web application.
root directory
WEB-INF directory
src
classes
where can you keep .java files in webapplication(Servlets)?
root directory
WEB-INF
src
classes
All html pages will be placed in ----------- directory
root directory
WEB-INF
src
classes
web.xml is also called as --------------------
data directory
deployment descriptor
directroy descriptor
none of the above
what is root tag of web.xml ?
web-app
servlet
servlet-mapping
init-param
under which tag of web.xml file contains actual servlet class
web-app
init-param
servlet
servlet-mapping
Where to place user defined webapplications in webserver (Apache Tomcat)
in bin directory
in lib directory
webapps directory
work directory
In which jar file contains the entire servlet API
servlet-api.jar
catalina.jar
tomcat-api.jar
jasper.jar
What are the methods of ServletConfig Interface?
getInitParameter()
getServletName()
getServletContext()
all the above
What are the parameters of the service() method
ServletConfig,ServletContext
doGet,doPost
init-param
ServletRequest,ServletResponse
What is the parent tag of url-pattern tag in web.xml?
servlet tag
webapp tag
servlet-mapping tag
none of the above
What are the methods of RequestDispatcher Interface?
doGet(),doPost()
include(),forward()
backward(),doHead()
doLink(),return
How many types of cookies are available in servlets?
2
4
8
6
doGet(),doPost() methods are available in which class ?
GenericServlet
HttpServlet
Both 1 & 2
None of the above
How many Ways to we create Sessions?
2
6
8
4
What are the different Exceptions thrown by service() method?
(a)
What are the different types of Cookies?
writecookie, tempcookies
strongcookie,weekcookies
persistent,non-persistent
none of the above
