Tag: architecture

Questions Related to architecture

  1. Communication Support

  2. Life-cycle Management

  3. Multithreading support

  4. All of the above


Correct Option: D
  1. Model – Java Class, JSP, View – HTML, Controller – Servlet

  2. Model – Java Class, View – JSP, Controller – Servlet

  3. Model – Java Class, View – JSP, Container – Servlet

  4. Model – Java Beans, View – JSP, HTML, Controller – Servlet, EJB


Correct Option: B
  1. GET

  2. POST

  3. PUT

  4. HEAD


Correct Option: B
Explanation:

To answer this question, the user needs to have a basic understanding of HTTP methods.

An HTTP method is a type of request that a client sends to a server to perform a specific action. HTTP defines several standard methods, each of which is designed to be used for different purposes.

A non-idempotent request is a request that changes the state of the server. This means that if the same request is made multiple times, the result may be different each time.

OPTIONS:

A) GET: This option is not correct. The GET method is used to retrieve data from the server and is considered idempotent. This means that multiple identical requests will return the same response every time.

B) POST: This option is correct. The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server. POST requests are non-idempotent, meaning that multiple identical requests will not produce the same response.

C) PUT: This option is not correct. The PUT method is used to replace all current representations of a target resource with the request payload. Like the POST method, PUT requests are non-idempotent.

D) HEAD: This option is not correct. The HEAD method is used to retrieve the headers that would be returned if the HEAD request's URL was instead requested with the GET method. The HEAD request is considered idempotent because it does not change the state of the server.

Therefore, the correct answer is:

The Answer is: B. POST

  1. HttpServletRequest getParameter(...) retrieves the parameter value from the request

  2. HttpServletResponse getAttribute(...) retrieves the attribute value from the response

  3. HttpServletResponse getParameter(...) retrieves the parameter value from the response

  4. HttpServletRequest setParameter(...) sets the parameter value to the request


Correct Option: A
  1. sendURL()

  2. redirectURL()

  3. sendRedirect()

  4. getRequestDispatcher()


Correct Option: C
  1. Write servlet code to extend ThreadSafeServlet.

  2. Have the servlet implement SingleThreadModel

  3. Synchronize the service method of the servlet

  4. Use local variables exclusively, and if you have to use instance variables, synchronize access to them.


Correct Option: D
  1. A session whose timeout period has been set to -1 will never expire.

  2. A session will become invalid as soon as the user closes all the browser windows.

  3. A session will become invalid after a timeout period defined by the servlet container.

  4. A session may be explicitly invalidated by calling HttpSession.invalidateSession().


Correct Option: C
  1. URL rewriting may be used by a server as the basis for session tracking.

  2. SSL has a built-in mechanism that a servlet container could use to obtain data used to define a session.

  3. When using cookies for session tracking, the name of the session tacking cookie must be JSESSIONID.

  4. IF a user has cookies disabled in the browser, the container may choose to use a javax.servlet.httpCookielessHttpSession object to track the user's session.


Correct Option: D
  1. req.getSession(false);

  2. req.getSession(true);

  3. both the above

  4. none of the above


Correct Option: B