What considerations should be made when choosing a software maintenance model for a legacy system?

  • Compatibility with existing tools and systems.
  • Cost is the only factor.
  • Ignore user feedback.
  • Only consider the latest technology trends.
When choosing a software maintenance model for a legacy system, compatibility with existing tools and systems is crucial. Cost, user feedback, and technology trends are also important but secondary factors.

A team is developing a safety-critical system. Which code review techniques would be most appropriate to ensure the reliability and correctness of the code?

  • Formal Inspections
  • Lightweight Code Reviews
  • No Code Review
  • Pair Programming
In the context of safety-critical systems, where reliability and correctness are paramount, formal inspections are the most appropriate code review technique. Formal inspections involve rigorous, structured reviews that can uncover potential issues and defects in the code that might be missed in less formal processes.

What is the main purpose of a user story in Agile methodologies?

  • To assign tasks to team members.
  • To capture end-user needs.
  • To describe technical details.
  • To track project timelines.
A user story in Agile serves to capture end-user needs and requirements in a simple, non-technical manner, fostering collaboration and understanding among team members.

A cookie's security can be enhanced by setting the _________ flag, which prevents its access via JavaScript.

  • HttpOnly
  • Max-Age
  • Path
  • Secure
The HttpOnly flag enhances a cookie's security by preventing its access via JavaScript.

How can servlet initialization parameters be used effectively for database connectivity?

  • By embedding database connection details directly in the servlet code.
  • By relying on default database configurations provided by the servlet container.
  • By storing database connection details as initialization parameters and retrieving them in the servlet's init() method.
  • By using context parameters instead of initialization parameters for database connectivity.
Servlet initialization parameters can be used effectively for database connectivity by storing database connection details in the web.xml file and retrieving them in the servlet's init() method for establishing connections.

Which method in a filter is responsible for cleaning up resources when the filter is taken out of service?

  • destroy()
  • doFilter()
  • filterInit()
  • init()
The destroy() method is responsible for cleaning up resources when the filter is taken out of service.

What is the best approach to maintain user sessions in a distributed web application environment?

  • Database Session
  • HTTP Session
  • Hidden Form Fields
  • URL Rewriting
The best approach to maintain user sessions in a distributed web application environment is to use HTTP Session. This allows for centralized session management across multiple servers.

To access all initialization parameters, the method ________ can be used, which returns an _________.

  • getInitParameterNames(), Enumeration
  • getInitParameters(), ArrayList
  • getParameters(), Array
  • getServletContext(), Enumeration
The correct method is getInitParameterNames(), which returns an Enumeration containing the names of the servlet's initialization parameters.

The __________ method is generally used for fetching data where the request does not affect server state.

  • DELETE
  • GET
  • POST
  • PUT
The GET method is generally used for fetching data where the request does not affect server state. It is considered idempotent.

HTTP persistent connections are managed using the _________ header in servlet responses.

  • Connection
  • Keep-Alive
  • Persistent
  • Session
HTTP persistent connections are managed using the Keep-Alive header in servlet responses.

What is the role of the Secure flag in a cookie?

  • Enables third-party access to the cookie
  • Ensures the cookie is encrypted
  • Indicates the cookie is safe for cross-site requests
  • Restricts the cookie to HTTPS connections
The Secure flag in a cookie indicates that the cookie should only be sent over secure, encrypted connections (HTTPS). This enhances the security of the cookie by preventing it from being transmitted over unsecured HTTP connections.

How would a servlet handle different initialization parameters for different deployment environments?

  • Create separate servlets for each environment
  • Leverage servlet annotations for environment-specific settings
  • Use a single set of parameters for all environments
  • Use conditional logic within the servlet
Servlets can handle different initialization parameters for different deployment environments by using conditional logic within the servlet. This allows the servlet to adapt its behavior based on the specific configuration for each environment.