Unit 6
Unit 6
Unit 6
3. The setAttribute(string attribute, object value) is a [£J Both a and b @] None of these
method which assigns the value passed as the Q.S What is the lifecycle of a servlet ?
object value to the attribute name. The data type of ~ Servlet class is loaded
this method is void. [8 Servlet instance is created
Review Question [£J init, Service, destroy method is invoked
1. Explain session management and cookies in servlet. [ill All of these
Multiple Choice Questions Q.9 What is the difference between servlet and
Q.1 The Java specification defines an applet?
application programming interface for ~ servlets execute on servers while applets execute
communication between the web server and the
on browser
application program
~ servlet [8 randomise [8 servlets create static pages while applets create
dynamic pages
[£J applet @] script
Q.2 Which method is used to specify before any
I£J servlets can execute single request while applets
lines that uses the PintWriter ? execute multiple requests
[!] setPageTypeO [8 setContextTypeO , @]None of these
[£J setContentTY}ieO....@] setResponseTypeO Q.10 A deployment descriptor describes
Q.3 What are the functions of Servlet container? ~ web component response settings
~ Lifecycle 'management [}] web component settings
[8 Communication support [£J web component request settings
[£J Multithreading support @] All of these
@] All of the above Q.11 Which object is created by the web container at
time of deploying the project?
Q.4 What is bytecode ?
~ Machine-specific code
~ ServletConfig [8 ServletContext
[8 Java code [£J Both a and b @] None of the above
Q.12 In HTIP Request method Get request is
[£J Machine-independent code secured because data is exposed in URL bar
@] None ofthe mentioned ~ True [8 False
Q.5 • What type of servlets use these methods Q.13 Which class can handle any type of request so
doGetO, dof'ostt), doHead, dofreletei), that it is protocol-independent ?
do'Iracet) ?
~ GenericServlet [8 HttpServlet
~ Genereic Servlets lliJ
HttpServlets
[£J Both a and b @] None of the above
[£J All of the above @] None of these
Q.14 Servlet technology is used to create web
Q.6 Web server is used for loading the initf) application
method of servlet.
~ True [8 False
~ True lliJ False
Q.15 The doGetO method extracts values of the
Q.7 Which packages represent interfaces and parameter's types and number by using __
classes for servlet API?
~ response.getAttributeO
~ j avax.servlet [8 j avax.servlet.http
lliJ response.getParameterO
TAl
Technical Publications - An up thrust for know/edge
- vanced Java Programming 6 -23 Servlets
~ Servlet Filter [IJ Servlet Config [£J All of these [ill None of these
[£J Servlet Container [ill Servlet Context Q.25 Which method in session tracking is used in a
bit of information that is sent by a web server to
Q.17 The life cycle of a servlet is managed by _ a browser and which can later be read back from
[!] http and https [IJ servlet context that browser?
[£J servlet itself @] servlet container ~ HttpSession lliJ URL rewriting
Q.18 Which method take a string not a URL ? [£J Cookies [ill Hidden form fields
[!] sendRedirect [IJ forward Answers :
[£J Both @] None
1. a 2. c 3. d 4. c
Q.19 Which method shows the client what server is
5. b 6. a 7. c 8. d
receiving?
[!]doGet' [IJ doOption 9. a 10. b 11. b 12. b
Q.20 What type of servlets use these methods 17. d 18. a 19. a 20. b
doGetO: dol'osttj.dol-Iead, doOeletet), 21. a 22. c 23. a 24. b
doTraceO?
~ Genereic Servlets lliJ HttpServlets 25. c
TM
Technical Publications - An up thrust for knowledge