¡GoConqr estrena diseño! Cuéntanos qué te parece.

Test

Questões - The Servlet's Environment

Luis Felipe Guariento 20 preguntas

Hacer el test

Preguntas del test (20)

  1. 1Why do the client and server need a unique session id for conversations?
    1. ABecause HTTP is a stateful protocol.
    2. BBecause HTTP is a stateless protocol
    3. CFTP is a stateful protocol
    4. DNone of the above
  2. 2What is the method in the HttpSession interface to know if a session is new or not?
    1. AgetSession();
    2. BisSessionNew();
    3. CsessionNew();
    4. DisNew();
  3. 3What is the method in the HttpServletRequest interface to know if a session exists or not?
    1. AgetSession(boolean);
    2. BsessionExists();
    3. CgetSession();
    4. DdoesSessionExists()
  4. 4URL encoding is done by:
    1. AHttpServletRequest
    2. BServletContext
    3. CServletRequest
    4. DHttpServletResponse
  5. 5What type of session tracking is used for static pages?
    1. ACookies
    2. BURL rewriting
    3. CBoth Cookies and URL rewriting
    4. DNone of the mentioned
  6. 6What is wrong with the following line of code?
    String sessid = request.getParameter("jsessionid");
    1. A"jsessionid" is not a parameter that can be passed.
    2. BNothing is wrong with this code.
    3. CThe getParameter should take an object as its parameter.
    4. DThe code should be re-written as:
      String sessid = request.getAttribute("jsessionid");
  7. 7In the setMaxInactiveInterval() method in the HttpSession interface, the parameter 'interval' specified below is represented in:
    void setMaxInactiveInterval(int interval);
    1. AHours
    2. BMinutes
    3. CSeconds
    4. DMilliseconds
  8. 8When you set the session timeout in the deployment descriptor as in the following example, the timeouts are specified in...
    Imagen de la pregunta 8
    1. AHours
    2. BMinutes
    3. CSeconds
    4. DMilliseconds
  9. 9Consider the code:

    What will be the output of the following code?

    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class SampleServlet extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException{
    response.setContentType("text/html");
    PrintWriter out=response.getWriter();
    HttpSession sess1=request.getSession();
    sess1.invalidate();
    if(sess1.isNew()){
    System.out.println("A new session has been created");
    }else{
    System.out.println("The session cannot be created");
    }
    }
    }
    Imagen de la pregunta 9
    1. AThe message "A new session has been created" is output.
    2. BThe message "The session cannot be created" is output.
    3. CCompile error.
    4. DIllegalStateException
  10. 10Consider the following code:

    Cookie c = new Cookie("user",name);
    c.setMaxAge(-10);

    What happens when the above code is implemented?
    1. AThe Cookie lives for 10 minutes.
    2. BThe Cookie will be erased once the web browser quits.
    3. CThe Cookie lives for 10 seconds.
    4. DThe Cookie is deleted.

Información

Descripción
Concursos Públicos (OCEJWCD 6 ONLINE COURSE) Desenvolvimento de Software Test sobre Questões - The Servlet's Environment, creado por Luis Felipe Guariento el 19/02/2018.
Idioma
Português
Visitas
0
Valoración
Aún sin valoraciones
Valora este test
Valora este test

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?