Close
« Tutorial

Spring MVC - HttpSession as Method Argument MCQ

0/13
0 ✓
0 ✗

1. What is the main purpose of an HttpSession in a web application?

2. Can HttpSession be used as a parameter of a Spring MVC controller method?

3. Can the HttpSession argument passed to a controller method be null?

4. What happens if a request does not have a session and the controller method has an HttpSession argument?

5. Which Servlet API method does Spring use in the background to get the HttpSession argument?

6. In Spring 6 and later, which is the correct type to use for a session argument in a controller method?

7. Which HttpSession method is used to store a value in the session?

8. Which HttpSession method is used to read a value from the session?

9. What does getAttribute() return when no value was stored under the given name?

10. HttpSession#getAttribute() returns an Object. What should you usually do before using the value as a specific type like Long?

11. Two different users send requests to the same web application. How are their sessions handled?

12. How long does data stored in an HttpSession normally stay available?

13. Which low-level option can you use in Spring MVC to keep session data if you cannot use session scoped beans?

14. Which HttpSession method returns the unique identifier of the session?

Join