Skip to main content

Web Services Development MCQs with Answers

Practice important Web Services Development MCQs with answers and explanations.

Chapter: 15
Q461:
What is the default port number of Apache Tomcat?
A. 9999
B. 8080
C. 9090
D. 8005
Correct Answer: B
Chapter: 15
Q462:
To change the port number in Apache Tomcat, which file should be edited?
A. web.xml
B. server.xml
C. tomcat.conf
D. context.xml
Correct Answer: B
Chapter: 15
Q463:
Which method of RequestDispatcher is used to forward a request?
A. include
B. forward
C. dispatch
D. send
Correct Answer: B
Chapter: 15
Q464:
What is the correct way to deploy a servlet project in Apache Tomcat?
A. By creating a WAR file
B. By selecting the WAR file from UI
C. By copying project to webapps
D. By selecting the folder from server
Correct Answer: C
Chapter: 15
Q465:
What is the primary use of the ServletContext object?
A. To maintain session
B. To store servlet attributes
C. To share configuration data
D. To handle servlet requests
Correct Answer: C
Chapter: 15
Q466:
Which of the following methods is used to get an attribute in ServletContext?
A. getInitParameter
B. getAttribute
C. setAttribute
D. removeAttribute
Correct Answer: B
Chapter: 15
Q467:
What is the primary advantage of a WAR file?
A. It reduces deployment time
B. It helps in project debugging
C. It improves code readability
D. It makes the project smaller in size
Correct Answer: A
Chapter: 15
Q468:
Which session tracking technique stores small information on the client side?
A. HttpSession
B. URL Rewriting
C. Hidden Form Fields
D. Cookies
Correct Answer: D
Chapter: 15
Q469:
Which method is used to get the ServletContext object?
A. getRequestDispatcher
B. getServletContext
C. getServletConfig
D. getInitParameter
Correct Answer: B
Chapter: 15
Q470:
What is the method to include the content of another resource in Servlet?
A. forward
B. include
C. dispatch
D. send
Correct Answer: B
Chapter: 15
Q471:
Which method in RequestDispatcher is used to include a resource?
A. forward
B. send
C. include
D. dispatch
Correct Answer: C
Chapter: 15
Q472:
What does HttpSession manage in a servlet application?
A. User authentication
B. User state
C. Database connection
D. File handling
Correct Answer: B
Chapter: 15
Q473:
What does the forward() method in a servlet do?
A. Redirects the client to another servlet
B. Forwards the request to a resource
C. Closes the connection
D. Starts a new session
Correct Answer: B
Chapter: 15
Q474:
How many types of cookies are there in servlets?
A. 2
B. 3
C. 4
D. 5
Correct Answer: A
Chapter: 15
Q475:
Which cookie is valid only for a single session?
A. Persistent cookie
B. Non-persistent cookie
C. Session cookie
D. Temporary cookie
Correct Answer: B
Chapter: 15
Q476:
What happens to a non-persistent cookie when the browser is closed?
A. It is saved
B. It is removed
C. It is stored temporarily
D. It is shared with the server
Correct Answer: B
Chapter: 15
Q477:
How is a persistent cookie removed?
A. On closing the browser
B. On user logout/signout
C. Automatically after a session
D. Manually by the user
Correct Answer: B
Chapter: 15
Q478:
What is one advantage of using cookies?
A. Cookies are stored on the server
B. Simplest technique for state
C. Complex technique for state
D. Cookies are faster than other
Correct Answer: B
Chapter: 15
Q479:
What is a major disadvantage of cookies?
A. Cookies are encrypted
B. Cookies support complex data
C. Cookies can be disabled in browser
D. Cookies store large data
Correct Answer: C
Chapter: 15
Q480:
Which class is used to create cookies in servlets?
A. javax.servlet.Cookie
B. javax.servlet.http.Cookie
C. javax.servlet.util.Cookie
D. javax.servlet.net.Cookie
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Web Services Development

🚀 Start Quiz Now