Skip to main content

Web Services Development MCQs with Answers

Practice important Web Services Development MCQs with answers and explanations.

Chapter: 15
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
Correct Answer: C
Chapter: 15
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
Correct Answer: A
Chapter: 15
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
Correct Answer: A
Chapter: 15
Q504:
In URL rewriting, which method is used to obtain a parameter value in a servlet?
A. getParameter()
B. getRequest()
C. getSession()
D. getAttribute()
Correct Answer: A
Chapter: 15
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
Correct Answer: B
Chapter: 15
Q506:
In the servlet code, how is the session invalidated during logout?
A. session.stop()
B. session.remove()
C. session.invalidate()
D. session.reset()
Correct Answer: C
Chapter: 15
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")
Correct Answer: D
Chapter: 15
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()
Correct Answer: A
Chapter: 15
Q509:
What is the password used in the LoginServlet example?
A. admin123
B. password123
C. user123
D. servlet123
Correct Answer: A
Chapter: 15
Q510:
What method is used to set an attribute in an HttpSession?
A. setParameter()
B. setSession()
C. setAttribute()
D. setProperty()
Correct Answer: C
Chapter: 15
Q511:
In the provided servlet example, what is the session ID used for?
A. To track the user
B. To store login information
C. To bind objects
D. To identify a particular user
Correct Answer: D
Chapter: 15
Q512:
Fill in the blank: In HttpSession, the method _______ is used to invalidate a session.
A. setSession
B. resetSession
C. destroySession
D. invalidate()
Correct Answer: D
Chapter: 16
Q513:
What is the purpose of JDBC in Java?
A. To connect and execute queries with the database
B. To manage hardware resources
C. To create graphical interfaces
D. To perform multithreading operations
Correct Answer: A
Chapter: 16
Q514:
Why was JDBC introduced over ODBC in Java?
A. ODBC was platform-independent
B. ODBC used C, which is platform-dependent and less secure
C. ODBC was faster than JDBC
D. ODBC did not support Java at all
Correct Answer: B
Chapter: 16
Q515:
How many types of JDBC drivers are there?
A. 2
B. 3
C. 4
D. 5
Correct Answer: C
Chapter: 16
Q516:
Which JDBC driver converts JDBC calls directly into the vendor-specific database protocol?
A. JDBC-ODBC Bridge Driver
B. Native-API Driver
C. Network Protocol Driver
D. Thin Driver
Correct Answer: D
Chapter: 16
Q517:
What is the advantage of using the Thin Driver?
A. Requires installation on the client-side
B. Fully written in C
C. Fully written in Java
D. Needs database-specific coding
Correct Answer: C
Chapter: 16
Q518:
In JDBC, what is used to create a connection with a database?
A. getConnection() method
B. createConnection() method
C. connectDatabase() method
D. openDatabase() method
Correct Answer: A
Chapter: 16
Q519:
What method is used to register the driver class in JDBC?
A. Class.forName()
B. DriverManager.registerDriver()
C. createDriver()
D. loadDriver()
Correct Answer: A
Chapter: 16
Q520:
The executeQuery() method is used for which type of SQL operation?
A. SELECT queries
B. INSERT queries
C. DELETE queries
D. UPDATE queries
Correct Answer: A

Test Your Knowledge

Take a timed quiz on Web Services Development

🚀 Start Quiz Now