Skip to main content

Web Services Development MCQs with Answers

Practice important Web Services Development MCQs with answers and explanations.

Multiple Choice Questions

Q481: What method in the Cookie class sets the maximum age of a cookie?
  • A: setValue(int expiry)
  • B: setName(int expiry)
  • C: setMaxAge(int expiry)
  • D: setCookieExpiry(int expiry)
View Answer
C

Q482: What is the return type of the getName() method of a cookie?
  • A: Integer
  • B: String
  • C: Boolean
  • D: Char
View Answer
B

Q483: What method adds a cookie to the HTTP response object?
  • A: addCookie(Cookie ck)
  • B: putCookie(Cookie ck)
  • C: createCookie(Cookie ck)
  • D: storeCookie(Cookie ck)
View Answer
A

Q484: Which method is used to get all cookies from the browser in a servlet?
  • A: getCookies(HttpServletResponse)
  • B: getAllCookies()
  • C: getCookies(HttpServletRequest)
  • D: getCookies()
View Answer
C

Q485: In which class are cookies stored in servlets?
  • A: HttpServletRequest
  • B: HttpServletResponse
  • C: Cookie
  • D: None of the above
View Answer
A

Q486: What is used in URL rewriting to send data?
  • A: Cookie
  • B: Hidden field
  • C: Token or identifier
  • D: Session object
View Answer
C

Q487: URL rewriting works with which type of information?
  • A: Only textual information
  • B: Images and videos
  • C: Binary files
  • D: Cookies
View Answer
A

Q488: What is a major advantage of URL rewriting?
  • A: It doesn't need cookies
  • B: Extra form submission is required
  • C: It's browser dependent
  • D: It doesn't require a session
View Answer
A

Q489: What method in the HttpServletResponse interface is used to redirect?
  • A: sendResponse
  • B: sendRedirect
  • C: forwardRequest
  • D: redirectResponse
View Answer
B

Q490: What is a disadvantage of using Hidden Form Fields?
  • A: It stores data at the client-side
  • B: It requires extra form submission
  • C: It supports non-textual data
  • D: It is dependent on the browser
View Answer
B

Test Your Knowledge

Take a timed quiz on Web Services Development

🚀 Start Quiz Now