PHP Sessions Multiple Choice Questions

PHP Sessions Multiple Choice Questions

1.
PHP sessions are created using the . . . . . function.

A) session_starts()
B) sessions_start()
C) session_start()
D) none of above

2.
When you want to store user data in a session use the . . . . array.

A) $_SESSION
B) SYS_SESSION
C) $SESSION
D) $_SESSIONS

3.
Sessions allow you to

A) store persistent user preference on a site
B) save user authentication information from page to page
C) create multipage forms
D) all of above

4.
A snapshot of the session data can be taken at any time and written out to a file.

A) True
B) False

5.
When the session data is written to a file, it can be read back, decoded and applied to the current session using the . . . . function.

A) session_reset()
B) session_get_cookie_params()
C) session_encode()
D) session_decode()

6.
session_destroy() instantly destroy elements of the $_SESSION array.

A) True
B) False

7.
Appending session data to an absolute URL does not represent a security risk.

A) True
B) False

8.
If the php.ini register_globals directive is set, session data becomes available in the . . . . namespace.

A) Global
B) Local

9.
No expiry date is set in the cookie that PHP sets for the session. The session remains current only as long as the browser is active. When the browser is restarted the cookie is not stored. This behavior can be changed by altering . . . . . setting in php.ini file.

A) cookie_lifetime
B) session.cookie_life_time
C) session.cookie_lifetime
D) cookie_life_time

10.
session_destroy() erases all session variable.

A) True
B) False

Answers