Test
Questões - Introduction to Java Servlets Test 2
Crea una cuenta gratis para terminar este test
Guarda tu progreso y consulta tu resultado final.
¿Ya tienes cuenta? Inicia sesión
Preguntas del test (10)
1Which method in the HttpServlet class services the HTTP POST request? (Select one)
- AdoPost(ServletRequest, ServletResponse)
- BservicePost(HttpServletRequest, HttpServletResponse)
- CdoPost(HttpServletRequest, HttpServletResponse)
- DdoPOST(ServletRequest, ServletResponse)
2Consider the following HTMLpage code:
<html><body>
<a href="/servlet/HelloServlet">POST</a>
</body></html>
Which method of HelloServlet will be invoked when the hyperlink displayed by the above page is clicked? (Select one)- AdoGet
- BdoPost
- CdoForm
- DdoHref
- EServiceGet
3Consider the following code for the doGet() method:
Which of the following lines can be inserted at //1 so that the above code does not throw any exception? (Select one)- Aif ( ! res.isSent() )
- Bif ( ! res.isCommitted() )
- Cif ( ! res.isDone() )
- Dif ( ! res.isFlushed() )
- Eif ( ! res.flush() )
4Which of the following lines would initialize the out variable for sending a Microsoft Word file to the browser? (Select one)
- APrintWriter out = response.getServletOutput();
- BPrintWriter out = response.getPrintWriter();
- COutputStream out = response.getWriter();
- DPrintWriter out = response.getOutputStream();
- EOutputStream out = response.getOutputStream();
- FServletOutputStream out = response.getServletOutputStream();
5You need to send a GIF file to the browser. Which of the following lines should be called after (or before) a call to response.getOutputStream()? (Select one)
- Aresponse.setContentType("image/gif"); Before
- Bresponse.setContentType("image/gif"); After
- Cresponse.setDataType("image/gif"); Before
- Dresponse.setDataType("image/gif"); After
- Eresponse.setStreamType("image/gif"); Before
- Fresponse.setStreamType("image/gif"); After
6Consider the following HTML page code:
Identify the two methods that can be used to retrieve the value of the name parameter when the form is submitted.- AgetParameter("name");
- BgetParameterValues("name");
- CgetParameterValue("name");
- DgetParameters("name");
- EgetValue("name");
- FgetName();
7Which of the following methods would you use to retrieve header values from a request? (Select two)
- AgetHeader() of ServletRequest
- BgetHeaderValue() of ServletRequest
- CgetHeader() of HttpServletRequest
- DgetHeaders() of ServletRequest
- EgetHeaders() of HttpServletRequest
8Consider the following code:
Which of the following lines can be inserted at //1 so that the request is redirected to collectinfo.html page? (Select one)- Areq.sendRedirect("collectinfo.html");
- Breq.redirect("collectinfo.html");
- Cres.direct("collectinfo.html");
- Dres.sendRedirect("collectinfo.html");
- Ethis.sendRedirect("collectinfo.html");
- Fthis.send("collectinfo.html");
9Consider the following code:
You want the userid parameter to be available only to the requests that come from the same user. Which of the following lines would you insert at //1? (Select one)- Asession.setAttribute("userid", userid);
- Breq.setAttribute("userid", userid);
- Cctx.addAttribute("userid", userid);
- Dsession.addAttribute("userid", userid);
- Ethis.addParameter("userid", userid);
- Fthis.setAttribute("userid", userid);
10Which of the following lines would you use to include the output of Data-Servlet into any other servlet? (Select one)
- ARequestDispatcher rd =
request.getRequestDispatcher("/servlet/DataServlet");
rd.include(request, response); - BRequestDispatcher rd =
request.getRequestDispatcher("/servlet/DataServlet");
rd.include(response); - CRequestDispatcher rd = request.getRequestDispatcher();
rd.include("/servlet/DataServlet", request, response); - DRequestDispatcher rd = request.getRequestDispatcher();
rd.include("/servlet/DataServlet", response); - ERequestDispatcher rd = request.getRequestDispatcher();
rd.include("/servlet/DataServlet");
- ARequestDispatcher rd =
Información
- Descripción
- Concursos Públicos (OCEJWCD 6 ONLINE COURSE) Desenvolvimento de Software Test sobre Questões - Introduction to Java Servlets Test 2, creado por Luis Felipe Guariento el 29/01/2018.
- Idioma
- Português
- Visitas
- 0
- Etiquetas
- Valoración
- Aún sin valoraciones Valora este test