GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Quiz

Questões - The Servlet's Environment

Luis Felipe Guariento 20 Fragen

Quiz starten

Fragen in diesem Quiz (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...
    Bild zu Frage 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");
    }
    }
    }
    Bild zu Frage 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.

Informationen

Beschreibung
Concursos Públicos Desenvolvimento de Software (OCEJWCD 6 ONLINE COURSE) Quiz am Questões - The Servlet's Environment, erstellt von Luis Felipe Guariento am 19/02/2018.
Sprache
Português
Aufrufe
0
Bewertung
Noch keine Bewertungen
Bewerte dieses Quiz
Bewerte dieses Quiz

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck