Quiz
Servlets
Crie uma conta grátis para terminar este quiz
Salve seu progresso e veja sua nota final.
Já tem uma conta? Inicie sessão
Perguntas do quiz (50)
1What are Servlets?
- AJava Servlets are programs that run on a Web or Application server.
- BJava Servlets act as a middle layer between a request coming from a Web browser or other HTTP client and databases or applications on the HTTP server.
- CBoth of the above.
- DNone of the above.
2Which of the following is true about servlets?
- AServlets execute within the address space of a Web server.
- BServlets are platform-independent because they are written in Java.
- CThe full functionality of the Java class libraries is available to a servlet.
- DAll of the above.
3Which of the following package contains servlet classes?
- Ajavax.servlet
- Bjavax.servlet.http
- CBoth of the above.
- DNone of the above.
4Which of the following is the correct order of servlet life cycle phase methods?
- Ainit, service, destroy
- Binitialize, service, destroy
- Cinit, execute, destroy
- Dinit, service, delete
5When init method of servlet gets called?
- AThe init method is called when the servlet is first created.
- BThe init method is called whenever the servlet is invoked.
- CBoth of the above
- DNone of the above.
6Which of the following is true about init method of servlet?
- AThe init method simply creates or loads some data that will be used throughout the life of the servlet.
- BThe init method is not called again and again for each user request.
- CBoth of the above.
- DNone of the above.
7When service method of servlet gets called?
- AThe service method is called when the servlet is first created.
- BThe service method is called whenever the servlet is invoked.
- CBoth of the above.
- DNone of the above.
8Which of the following is true about service method of servlet?
- AThe servlet container i.e.webserver calls the service method to handle requests coming from the client.
- BEach time the server receives a request for a servlet, the server spawns a new thread and calls service.
- CThe service method checks the HTTP request type GET,POST,PUT,DELETE,etc. and calls doGet, doPost, doPut, doDelete, etc. methods as appropriate.
- DAll of the above.
9When doGet method of servlet gets called?
- AA GET request results from a normal request for a URL.
- BThe service method checks the HTTP request type as GET and calls doGet method.
- CBoth of the above.
- DNone of the above.
10When doPost method of servlet gets called?
- AA POST request results from an HTML form that specifically lists POST as the METHOD.
- BThe service method checks the HTTP request type as POST and calls doPost method.
- CBoth of the above.
- DNone of the above.
11When destroy method of servlet gets called?
- AThe destroy method is called only once at the end of the life cycle of a servlet.
- BThe destroy method is called after the servlet has executed service method.
- CBoth of the above.
- DNone of the above.
12Which of the following is true about destroy method of servlet?
- AAfter the destroy method is called, the servlet object is marked for garbage collection.
- BThe servlet is terminated by calling the destroy method.
- CBoth of the above.
- DNone of the above.
13What is javax.servlet.Servlet?
- Ainterface
- Babstract class
- Cconcreate class
- DNone of the above.
14What is javax.servlet.http.HttpServlet?
- Ainterface
- Babstract class
- Cconcrete class
- DNone of the above.
15Which of the following is true about HTTP Get method?
- AThe GET method sends the encoded user information appended to the page request.
- BThe GET method is the default method to pass information from browser to web server.
- CBoth of the above.
- DNone of the above.
16Which of the following is true about HTTP Post method?
- AThe POST method sends the encoded user information as a seperate message to page request.
- BThe POST method is used to submit form data normally.
- CBoth of the above.
- DNone of the above.
17Which of the following method can be used to get the value of form parameter?
- Arequest.getParameter
- Brequest.getParameterValues
- Crequest.getParameterNames
- DNone of the above.
18Which of the following method can be used to get the multiple values of a parameter like checkbox data?
- Arequest.getParameter
- Brequest.getParameterValues
- Crequest.getParameterNames
- DNone of the above.
19Which of the following method can be used to get complete list of all parameters in the current request?
- Arequest.getParameter
- Brequest.getParameterValues
- Crequest.getParameterNames
- DNone of the above.
20Which of the following code is used to set content type of a page to be serviced using servlet?
- Aresponse.setContentType
- Brequest.setContentType
- Cwriter.setContentType
- DNone of the above.
21Which of the following code is used to get PrintWriter object in servlet?
- Aresponse.getWriter
- Brequest.getWriter
- Cnew PrintWriter
- DNone of the above.
22Which of the following code is used to get cookies in servlet?
- Aresponse.getCookies
- Brequest.getCookies
- CCookies.getCookies
- DNone of the above.
23Which of the following code is used to get names of the attributes in servlet?
- Aresponse.getAttributeNames
- Brequest.getAttributeNames
- CHeader.getAttributeNames
- DNone of the above.
24Which of the following code is used to get names of the headers in servlet?
- Aresponse.getHeaderNames
- Brequest.getHeaderNames
- CHeader.getHeaderNames
- DNone of the above.
25Which of the following code is used to get names of the parameters in servlet?
- Arequest.getParameterNames
- Bresponse.getParameterNames
- CHeader.getParameterNames
- DNone of the above.
26Which of the following code is used to get session in servlet?
- Arequest.getSession
- Bresponse.getSession
- Cnew Session
- DNone of the above.
27Which of the following code is used to get locale in servlet?
- Arequest.getlocale
- Bresponse.getLocale
- Cnew Locale
- DNone of the above.
28Which of the following code is used to get a particular attribute in servlet?
- Arequest.getAttributename
- Bresponse.getAttributename
- Cnew Attributename
- DNone of the above.
29Which of the following code retrieves the name of the authentication scheme?
- Anew AuthType
- Bresponse.getAuthType
- Crequest.getAuthType
- DNone of the above.
30Which of the following code retrieves the body of the request as binary data?
- Anew InputStream
- Bresponse.getInputStream
- Crequest.getInputStream
- DNone of the above.
31Which of the following code retrieves the character encoding used in the body of this request?
- Anew CharacterEncoding
- Bresponse.getCharacterEncoding
- Crequest.getCharacterEncoding
- DNone of the above.
32Which of the following code retrieves the MIME type of the body of the request?
- Anew MimeType
- Brequest.getContentType
- Cresponse.getContentType
- DNone of the above.
33Which of the following code retrieves the context of the request?
- Anew ClassContextPath
- Brequest.getContextPath
- Cresponse.getContextPath
- DNone of the above.
34Which of the following code retrieves the request header?
- AHeader.getHeaderNameheaderName
- Bresponse.getHeaderheaderName
- Crequest.getHeaderheaderName
- DNone of the above.
35Which of the following code retrieves the name of the HTTP Method?
- AHeader.getMethod
- Bresponse.getMethod
- Crequest.getMethod
- DNone of the above.
36Which of the following code retrieves the value of a request parameter?
- AHeader.getParametername
- Bresponse.getParametername
- Crequest.getParametername
- DNone of the above.
37Which of the following code retrieves any extra path information associated with the URL the client sent?
- AHeader.getPathInfo
- Bresponse.getPathInfo
- Crequest.getPathInfo
- DNone of the above.
38Which of the following code retrieves name and version of the protocol?
- AHeader.getProtocol
- Bresponse.getProtocol
- Crequest.getProtocol
- DNone of the above.
39Which of the following code retrieves the query string that is contained in the request URL after the path?
- AHeader.getQueryString
- Bresponse.getQueryString
- Crequest.getQueryString
- DNone of the above.
40Which of the following code retrieves the Internet Protocol IP address of the client that sent the request?
- Arequest.getRemoteAddr
- Bresponse.getRemoteAddr
- CHeader.getRemoteAddr
- DNone of the above.
41Which of the following code retrieves the fully qualified name of the client making this request?
- Arequest.getRemoteHost
- Bresponse.getRemoteHost
- CHeader.getRemoteHost
- DNone of the above.
42Which of the following code retrieves the login of the user making this request?
- Arequest.getRemoteUser
- Bresponse.getRemoteUser
- CHeader.getRemoteUser
- DNone of the above.
43Which of the following code retrieves the part of this request's URL from the protocol name?
- Arequest.getRequestURI
- Bresponse.getRequestURI
- CHeader.getRequestURI
- DNone of the above.
44Which of the following code retrieves session ID specified by the client?
- Arequest.getRequestedSessionId
- Bresponse.getRequestedSessionId
- CHeader.getRequestedSessionId
- DNone of the above.
45Which of the following code checks whether this request was made using a secure channel, such as HTTPS?
- Aresponse.isSecure
- Brequest.isSafe
- CHeader.isSecure
- DNone of the above.
46Which of the following code returns the port number on which this request was received?
- Aresponse.getServerPort
- Brequest.getServerPort
- CHeader.getServerPort
- DNone of the above.
47Which of the following code encodes the specified URL for use in the sendRedirect method?
- Aresponse.encodeRedirectURLurl
- Brequest.encodeRedirectURLurl
- CHeader.encodeRedirectURLurl
- DNone of the above.
48Which of the following code encodes the specified URL by including the session ID in it?
- Aresponse.encodeURLurl
- Brequest.encodeURLurl
- CHeader.encodeURLurl
- DNone of the above.
49Which of the following code indicates whether the named response header has already been set?
- Aresponse.containsHeaderheaderName
- Brequest.containsHeaderheaderName
- CHeader.containsHeaderheaderName
- DNone of the above.
50Which of the following code indicates whether the response has been committed?
- Aresponse.isCommitted
- Brequest.isCommitted
- CHeader.isCommitted
- DNone of the above.
Informações
- Descrição
- Quiz sobre Servlets, criado por Chris Noctskie em 26-06-2018.
- Autor
- Chris Noctskie
- Idioma
- English
- Visualizações
- 0
- Avaliação
- Ainda sem avaliações Avalie este quiz