Home > PHP & Programming > Quizzes > PHP Programming Basics Practice Test: Session Handling
PHP Programming Basics Practice Test: Session Handling
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 0% Most missed: “If session.use_cookie is set to 0, this results in use of _____________”
PHP manages sessions by storing session variables in files on disk. The session ID is used as part of the filename. PHP allows user-defined handlers to be written that change how sessions are managed.  Start your PHP script with session_start() The session_start() function either creates a new session, if one does not exist, or it continues an existing session The session creates a temporary file that stores various session variables and their values The session ID is stored in a cookie within the user's browser The cookie is called PHPSESSID by default The session is destroyed when you... Show more
PHP Programming Basics Practice Test: Session Handling
Time left 00:00
20 Questions

1. An attacker somehow obtains an unsuspecting user’s SID and then using it to impersonate the user in order to gain potentially sensitive information. This attack is known as __________
2. Which one of the following is the very first task executed by a session enabled page?
3. The session_start() function must appear _________
4. Which function is used to erase all session variables stored in the current session?
5. What is the default number of seconds that cached session pages are made available before the new pages are created?
6. What will be the output of the following PHP code? (Say your previous session username was nachi.)
unset($_SESSION['username']);
printf("Username now set to: %s", $_SESSION['username']);
7. Which one of the following statements should you use to set the session username to Nachi?
8. Which function effectively deletes all sessions that have expired?
9. Which one of the following function is used to start a session?
10. Neglecting to set which of the following cookie will result in the cookie’s domain being set to the host name of the server which generated it.
11. Which one of the following is the default PHP session name?
12. Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?
13. How many ways can a session data be stored?
14. What is the return type of session_set_save_handler() function?
15. What will the function session_id() return is no parameter is passed?
16. If the directive session.cookie_lifetime is set to 3600, the cookie will live until ____________
17. Which directive determines how the session information will be stored?
18. What is the default time(in seconds) for which session data is considered valid?
19. Which function is used to transform PHP’s session-handler behavior into that defined by your custom handler?
20. If session.use_cookie is set to 0, this results in use of _____________