0% found this document useful (0 votes)
47 views13 pages

Servlets - Quiz

C. init followed by service The servlet is initialized with the init method first, then the service method is invoked when it is requested. B. PUT OPTIONS DELETE TRACE The HTTP methods apart from GET and POST include PUT, OPTIONS, DELETE, and TRACE. D. 1, ServletConfig The init method of a servlet takes one argument of type ServletConfig. A. getInitParameterNames() The getInitParameterNames method of ServletConfig is used to access initialization parameters in web.xml. B. ServletConfig object via getServletContext() The ServletContext object can be obtained from the ServletConfig object

Uploaded by

Manish Dev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views13 pages

Servlets - Quiz

C. init followed by service The servlet is initialized with the init method first, then the service method is invoked when it is requested. B. PUT OPTIONS DELETE TRACE The HTTP methods apart from GET and POST include PUT, OPTIONS, DELETE, and TRACE. D. 1, ServletConfig The init method of a servlet takes one argument of type ServletConfig. A. getInitParameterNames() The getInitParameterNames method of ServletConfig is used to access initialization parameters in web.xml. B. ServletConfig object via getServletContext() The ServletContext object can be obtained from the ServletConfig object

Uploaded by

Manish Dev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 13

Servlets - Quiz

Q1 : Which method(s) will be invoked when a


servlet is requested for the first time?

A. service
B. init
C. init followed by service
D. service followed by init
Q2 : Apart from GET and POST the other HTTP
method are

A. PUT TRACE DELETE


B. PUT OPTIONS DELETE TRACE
C. RETURN OPTIONS PUT
D. RETURN PUT DELETE TRACE
Q3 : The init method takes __ arguments of type

A. 1, ServletContext
B. 2, ServletRequest, ServletResponse
C. 0
D. 1, ServletConfig
Q4 : Which method of ServletConfig is used to
access the initialization parameters specified
in web.xml?

A. getInitParameterNames()
B. getInitParameterList()
C. getInitParameters()
D. getParameters()
Q5 : We can obtain the object of ServletContext
from ?

A. ServletConfig object via getContext()


B. ServletConfig object via getServletContext()
C. It is already available in every method
D. ServletResponse object via getContext()
Q6 : The attributes set into the object of
ServletContext can be accessed ___

A. Only in the request where it was set


B. In all responses
C. Only in the session where it was set
D. In all subsequent requests
Q7 : Which of the following sets doesn’t depict a
method of ServletRequest

A. getServerPort(), getServerName()
B. getProtocol(), getCharacterEncoding()
C. getRemoteAddress(), getRemoteHost()
D. getContentType(), getContentLength()
Q8 : In an HTML form which attribute signifies
the method to be used for submitting the
form and if not specified which is the default
method?

A. method, POST
B. method, GET
C. submit, GET
D. submit, POST
Q9 : The data which a user enters in a HTML
form element can be accessed in a servlet
via which method of ServletRequest?

A. getData
B. getAttribute
C. getParameterNames
D. getParameter
Q10 : Which method of ServletResponse is used
to write HTML response for the client

A. getWriter()
B. write()
C. writeHTML()
D. printHTML()
Q11 : The GenericServlet ?

A. extends the Servlet interface


B. implements the Servlet interface
C. extends the Servlet class
D. extends the HttpServletClass
Thank You

You might also like