nerdexam
Oracle

1Z0-899 · Question #29

Given an HttpServletRequestrequest and HttpResponseresponse, which sets a cookie "username" with the value "joe" in a servlet?

The correct answer is F. response.addCookie(new Cookie("username", "joe")). See the full explanation below for the reasoning.

Question

Given an HttpServletRequestrequest and HttpResponseresponse, which sets a cookie "username" with the value "joe" in a servlet?

Options

  • Arequest.addCookie("username", "joe")
  • Brequest.setCookie("username", "joe")
  • Cresponse.addCookie("username", "joe")
  • Drequest.addHeader(new Cookie("username", "joe"))
  • Erequest.addCookie(new Cookie("username", "joe"))
  • Fresponse.addCookie(new Cookie("username", "joe"))
  • Gresponse.addHeader(new Cookie("username", "joe"))

How the community answered

(25 responses)
  • B
    4% (1)
  • C
    8% (2)
  • F
    84% (21)
  • G
    4% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-899 Practice