Q37.Marks: +2.0UGC NET Paper 2: Computer Science 11 March 2023
Which one of the following allows the session to continue?
1.When a user quits a browser
2.When the user logs out and is invalidated by the servlet
3.When the session is timed out due to inactivity
4.When the user refreshes the browser and there is a persistent cookie✓ Correct
Solution
The correct answer is When the user refreshes the browser and there is a persistent cookie
Key Points
Persistent cookies are stored on the user's device and can persist across browser sessions.
When the user refreshes the browser, the persistent cookie allows the server to recognize and associate the user with an existing session, thus allowing the session to continue.
Persistent cookies are not affected by actions like quitting the browser or logging out, and they can help maintain session state even if there is some inactivity that would otherwise lead to a timeout.
Additional Information
Closing a browser often ends the session, especially if it relies on session cookies.
When a user is logged out and invalidated by a servlet, the session also ends, as the 'logout' action generally terminates the session.
A session timeout due to inactivity would definitely lead to the end of the active session.