Which of the following is used to specify a servlet's name in the deployment descriptor?

The element in the web.xml file is used to specify the name of a servlet. This name is then referenced in various configurations within the deployment descriptor and is essential for identifying and managing the servlet within the web application.

Which one directly interacts with the Java server pages (JSP) container?

  • CSS
  • HTML
  • JSP
  • Servlets
Servlets directly interact with the JavaServer Pages (JSP) container.

A ________ is a unique identifier generated by the server and sent to the client to maintain a session.

  • Cookie
  • Session ID
  • Token
  • URL Rewriting
The term for a unique identifier generated by the server and sent to the client to maintain a session is a Cookie.

For optimizing a web application with heavy presentation logic, which technology is more suitable?

  • Both
  • JSP
  • None of the above
  • Servlet
For optimizing a web application with heavy presentation logic, JSP (JavaServer Pages) is more suitable. JSP is specifically designed for creating dynamic web pages with a focus on presentation logic, making it easier to manage and optimize the presentation layer of a web application.

What is the primary purpose of cookies in web applications?

  • To execute server-side code
  • To handle database connections
  • To perform client-side validation
  • To store user preferences
The primary purpose of cookies in web applications is to store user preferences, enabling a personalized and persistent experience for users.

Servlets are often used for processing and sending the ______ to the client.

  • Data
  • HTML
  • Requests
  • XML
Servlets are often used for processing and sending HTML to the client.

How are servlet initialization parameters defined in the web.xml file?

Servlet initialization parameters are defined using the tag in the web.xml file.

For efficient handling of large file uploads in a servlet, one should implement __________ instead of using standard getParameter methods.

  • FileStreamReader
  • HttpServletRequest
  • InputStream
  • MultipartRequest
For efficient handling of large file uploads in a servlet, one should implement MultipartRequest instead of using standard getParameter methods for better control and performance in processing multipart/form-data requests.

The setMaxAge method sets the _________ of a cookie in seconds.

  • age
  • duration
  • expiration time
  • size
The setMaxAge method sets the expiration time of a cookie in seconds, specifying how long the cookie should persist.

Servlet initialization parameters are primarily used for ___________ configuration.

  • application
  • deployment
  • environment
  • runtime
Servlet initialization parameters are primarily used for application configuration.