0% found this document useful (0 votes)
27 views2 pages

Unit 6

This document provides a summary of servlets including: 1. It discusses servlet lifecycle and the init, service, and destroy methods that are invoked. 2. It asks multiple choice questions about servlets, including questions about the servlet API, servlet containers, sessions, and cookies. 3. The document provides answers to the multiple choice questions about servlets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Unit 6

This document provides a summary of servlets including: 1. It discusses servlet lifecycle and the init, service, and destroy methods that are invoked. 2. It asks multiple choice questions about servlets, including questions about the servlet API, servlet containers, sessions, and cookies. 3. The document provides answers to the multiple choice questions about servlets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Advanced Java Programming 6 - 22 Servle

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

~ request.getParameterO Q.24 Which cookie it is valid for single session only

1] request.setParameterQ and it is removed each time when the user closes


the browser?
Q.16 Dynamic interception of requests and response
to transform the information is done by _
~ Persistent cookie lliJ Non-persistent cookie

~ 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

[£J doTrace - -"


@]doPost 13. a 14. a 15. c 16. a

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

[£J All of these [ill None of these Explanation :


Q.21 Which of the following are session tracking Q.12 : The HTTP Request method Post is secured
techniques
~ URL rewriting, using session object, using cookies,
000
using hidden fields
lliJ URL rewriting, using servlet object, using response
object; using cookies
[£J URL rewriting, using session object, using response
object, using hidden field
Q.22 Which methods are used to bind the objects on
HttpSession instance and get the objects?
~ setAttribute lliJ getAttribute
[£J Both a and b [ill None of the above
Q.23 Sessions is a part of the SessionTracking and it
is for maintaining the client state at server side.
~ True lliJ False

TM
Technical Publications - An up thrust for knowledge

You might also like