• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock question regarding session

 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i came across the below question.
i doubt more than one answer is right. can any one explain which is right option.

In which of the following situations will a session be definitely invalidated?

Select 2 correct options.

1) The container is shutdown and brought up again.
2) No request comes from the client for more than "session timeout" period.
3) A servlet explicitly calls invalidate() on a session object.
4) If the session time out is set to 0 using setMaxInactiveInterval() method,
the session will never be invalidated automatically.
 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer 2 &3 :
2) No request comes from the client for more than "session timeout" period.
3) A servlet explicitly calls invalidate() on a session object.

Regards,
Shivani
 
Firas Zuriekat
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2) No request comes from the client for more than "session timeout" period


I don't understand why 2 is correct. I think for it to be correct it should be worded correctly (in terms of grammer and syntax). For it to be correct, it should be worded as follows (for e.g.):

2) No request comes from the client

You just can't talk apple and oranges. I mean you can't talk request and period. This is because request is not a form of time (period).

Please correct me if I am wrong.
 
Mohd Fuzail
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2) No request comes from the client


Question is till when container will wait for request for client, before it decides to invalidate the session being create for that client.

Here 'Session Timeout' comes into picture. Container will wait till 'Session Timeout' time and if no request comes from Client till then, Session is invalidated.

Hope it helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic