GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Quiz

Questões - Introduction to Java Servlets Test 2

Luis Felipe Guariento 10 Fragen

Quiz starten

Fragen in diesem Quiz (10)

  1. 1Which method in the HttpServlet class services the HTTP POST request? (Select one)
    1. AdoPost(ServletRequest, ServletResponse)
    2. BservicePost(HttpServletRequest, HttpServletResponse)
    3. CdoPost(HttpServletRequest, HttpServletResponse)
    4. DdoPOST(ServletRequest, ServletResponse)
  2. 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)
    1. AdoGet
    2. BdoPost
    3. CdoForm
    4. DdoHref
    5. EServiceGet
  3. 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)
    Bild zu Frage 3
    1. Aif ( ! res.isSent() )
    2. Bif ( ! res.isCommitted() )
    3. Cif ( ! res.isDone() )
    4. Dif ( ! res.isFlushed() )
    5. Eif ( ! res.flush() )
  4. 4Which of the following lines would initialize the out variable for sending a Microsoft Word file to the browser? (Select one)
    1. APrintWriter out = response.getServletOutput();
    2. BPrintWriter out = response.getPrintWriter();
    3. COutputStream out = response.getWriter();
    4. DPrintWriter out = response.getOutputStream();
    5. EOutputStream out = response.getOutputStream();
    6. FServletOutputStream out = response.getServletOutputStream();
  5. 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)
    1. Aresponse.setContentType("image/gif"); Before
    2. Bresponse.setContentType("image/gif"); After
    3. Cresponse.setDataType("image/gif"); Before
    4. Dresponse.setDataType("image/gif"); After
    5. Eresponse.setStreamType("image/gif"); Before
    6. Fresponse.setStreamType("image/gif"); After
  6. 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.
    Bild zu Frage 6
    1. AgetParameter("name");
    2. BgetParameterValues("name");
    3. CgetParameterValue("name");
    4. DgetParameters("name");
    5. EgetValue("name");
    6. FgetName();
  7. 7Which of the following methods would you use to retrieve header values from a request? (Select two)
    1. AgetHeader() of ServletRequest
    2. BgetHeaderValue() of ServletRequest
    3. CgetHeader() of HttpServletRequest
    4. DgetHeaders() of ServletRequest
    5. EgetHeaders() of HttpServletRequest
  8. 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)
    Bild zu Frage 8
    1. Areq.sendRedirect("collectinfo.html");
    2. Breq.redirect("collectinfo.html");
    3. Cres.direct("collectinfo.html");
    4. Dres.sendRedirect("collectinfo.html");
    5. Ethis.sendRedirect("collectinfo.html");
    6. Fthis.send("collectinfo.html");
  9. 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)
    Bild zu Frage 9
    1. Asession.setAttribute("userid", userid);
    2. Breq.setAttribute("userid", userid);
    3. Cctx.addAttribute("userid", userid);
    4. Dsession.addAttribute("userid", userid);
    5. Ethis.addParameter("userid", userid);
    6. Fthis.setAttribute("userid", userid);
  10. 10Which of the following lines would you use to include the output of Data-Servlet into any other servlet? (Select one)
    1. ARequestDispatcher rd =
      request.getRequestDispatcher("/servlet/DataServlet");
      rd.include(request, response);
    2. BRequestDispatcher rd =
      request.getRequestDispatcher("/servlet/DataServlet");
      rd.include(response);
    3. CRequestDispatcher rd = request.getRequestDispatcher();
      rd.include("/servlet/DataServlet", request, response);
    4. DRequestDispatcher rd = request.getRequestDispatcher();
      rd.include("/servlet/DataServlet", response);
    5. ERequestDispatcher rd = request.getRequestDispatcher();
      rd.include("/servlet/DataServlet");

Informationen

Beschreibung
Concursos Públicos Desenvolvimento de Software (OCEJWCD 6 ONLINE COURSE) Quiz am Questões - Introduction to Java Servlets Test 2, erstellt von Luis Felipe Guariento am 29/01/2018.
Sprache
Português
Aufrufe
0
Bewertung
Noch keine Bewertungen
Bewerte dieses Quiz
Bewerte dieses Quiz

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck