A servlet can __________ to another servlet, JSP, or HTML page using the RequestDispatcher.

  • communicate
  • forward
  • redirect
  • transfer
A servlet can forward to another servlet, JSP, or HTML page using the RequestDispatcher.

In terms of design pattern, which one follows the Model View Controller (MVC) more closely?

  • Both follow MVC equally
  • JSPs
  • Neither follows MVC
  • Servlets
JSPs (JavaServer Pages) follow the Model-View-Controller (MVC) design pattern more closely than Servlets. JSPs provide a clear separation of concerns with HTML as the view, JavaBeans as the model, and tag libraries for controller logic.

Which method is used to get a reference to the ServletContext object?

  • context()
  • getServletConfig()
  • getServletContext()
  • initContext()
The method getServletContext() is used to obtain a reference to the ServletContext object within a servlet.

The __________ method is used by an HTTP servlet to handle PUT requests.

  • doPost()
  • doProcess()
  • doPut()
  • doUpdate()
The doPut() method is used by an HTTP servlet to handle PUT requests, allowing the servlet to process and respond to PUT requests.

How does a servlet handle a scenario where it needs to redirect a client to an external website for authentication?

  • request.getRequestDispatcher("externalURL").forward()
  • request.sendRedirect("externalURL")
  • response.forward("externalURL")
  • response.sendRedirect("externalURL")
To redirect a client to an external website, a servlet should use response.sendRedirect("externalURL"). This method sends a temporary redirect response to the client, changing the URL in the browser to the specified external URL.

In RESTful web services, a _______ request is often used to update existing resources.

  • DELETE
  • GET
  • POST
  • PUT
In RESTful web services, a PUT request is often used to update existing resources.

_________ balancing is a technique used to route user requests for a specific session to the same server.

  • Cluster
  • Load
  • Round Robin
  • Session
Session balancing is a technique used to route user requests for a specific session to the same server, ensuring continuity for the user session.

_________ is a strategy where new instances of the application are launched in different geographic locations to handle traffic.

  • Caching
  • Geographic Redundancy
  • Replication
  • Sharding
Geographic Redundancy is a strategy where new instances of the application are launched in different geographic locations to handle traffic and improve availability.

A web application experiences uneven load distribution despite using a load balancer. What could be the reason?

  • Database Bottleneck
  • Improper Load Balancer Configuration
  • Inefficient Frontend Code
  • Network Latency
Uneven load distribution may occur due to improper load balancer configuration, where it fails to distribute incoming requests evenly among the server instances.

How is a cookie sent from a client to the server in an HTTP request?

  • As a URL parameter
  • As a part of the request body
  • As a part of the request headers
  • As a separate HTTP request
Cookies are sent from a client to the server as a part of the request headers in an HTTP request.