nerdexam
GIAC

GSNA · Question #320

Which of the following statements about a session are true? (Choose two)

The correct answer is C. The time for the setMaxInactiveInterval() method of the HttpSession interface is specified in D. The isNew() method is used to identify if the session is new. The setMaxInactiveInterval() method sets the maximum time in seconds before a session becomes invalid. The syntax of this method is as follows: public void setMaxInactiveInterval(int interval) Here, interval is specified in seconds. The isNew() method of the HttpSession…

Database & Application Auditing

Question

Which of the following statements about a session are true? (Choose two)

Options

  • AThe creation time can be obtained using the getSessionCreationTime() method of the
  • BThe getAttribute() method of the HttpSession interface returns a String.
  • CThe time for the setMaxInactiveInterval() method of the HttpSession interface is specified in
  • DThe isNew() method is used to identify if the session is new.

How the community answered

(15 responses)
  • A
    13% (2)
  • B
    7% (1)
  • C
    80% (12)

Explanation

The setMaxInactiveInterval() method sets the maximum time in seconds before a session becomes invalid. The syntax of this method is as follows: public void setMaxInactiveInterval(int interval) Here, interval is specified in seconds. The isNew() method of the HttpSession interface returns true if the client does not yet know about the session, or if the client chooses not to join the session. This method throws an IllegalStateException if called on an invalidated session. Answer: B is incorrect. The getAttribute(String name) method of the HttpSession interface returns the value of the named attribute as an object. It returns a null value if no attribute with the given name is bound to the session. This method throws an IllegalStateException if it is called on an invalidated session. Answer: A is incorrect. The creation time of a session can be obtained using the getCreationTime() method of the HttpSession.

Topics

#HttpSession#session management#Java web#session methods

Community Discussion

No community discussion yet for this question.

Full GSNA Practice