Web Services Development MCQs with Answers
Practice important Web Services Development MCQs with answers and explanations.
Multiple Choice Questions
Q501: Hidden form fields are most commonly used for?
- A: Storing sensitive information
- B: Capturing passwords
- C: Tracking page IDs or page names
- D: Submitting forms securely
View Answer
C
Q502: What is the main advantage of using hidden form fields?
- A: They work even if cookies are disabled
- B: They require no form submission
- C: They work only with links
- D: They encrypt user data
View Answer
A
Q503: Which of the following is a disadvantage of hidden form fields?
- A: Only textual information can be stored
- B: They store data on the client-side
- C: They require JavaScript to function
- D: They are vulnerable to cross-site scripting
View Answer
A
Q504: In URL rewriting, which method is used to obtain a parameter value in a servlet?
- A: getParameter()
- B: getRequest()
- C: getSession()
- D: getAttribute()
View Answer
A
Q505: What is a major advantage of URL rewriting?
- A: Extra form submission is required
- B: It works even if cookies are disabled
- C: It only works with links
- D: It encrypts user credentials
View Answer
B
Q506: In the servlet code, how is the session invalidated during logout?
- A: session.stop()
- B: session.remove()
- C: session.invalidate()
- D: session.reset()
View Answer
C
Q507: How do you retrieve the value of a hidden field in a servlet?
- A: getParameter("name")
- B: getAttribute("uname")
- C: getValue("uname")
- D: getParameter("uname")
View Answer
D
Q508: Which method returns the current session or creates a new one if it does not exist?
- A: getSession()
- B: getSession(true)
- C: getCurrentSession()
- D: createSession()
View Answer
A
Q509: What is the password used in the LoginServlet example?
- A: admin123
- B: password123
- C: user123
- D: servlet123
View Answer
A
Q510: What method is used to set an attribute in an HttpSession?
- A: setParameter()
- B: setSession()
- C: setAttribute()
- D: setProperty()
View Answer
C