PHP Session MCQs

PHP Session MCQs : This section focuses on "Session" in PHP. These Multiple Choice Questions (mcqs) should be practiced to improve the PHP skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. A _________ is a way to store information (in variables) to be used across multiple pages.

A. cookies
B. filters
C. session
D. exception

View Answer


2. A session is started with the __________function.

A. session_first()
B. session_start()
C. session()
D. session_begin()

View Answer


3. _______ session variables stored by default in PHP?

A. Server Side
B. In Cookies
C. Client Side
D. None of the above

View Answer


4. Which of the following is used to destroy a PHP session?

A. destroy_session()
B. session_destroy()
C. stop_session()
D. end_session()

View Answer


5. By default, how long does a PHP session last?

A. 24 hours
B. 1 week
C. Until the browser is closed
D. Never

View Answer


6. Which of the following is a valid session ID in PHP?

A. 1234567890abcdef
B. session_id_123
C. A session ID can be any string
D. All of the above

View Answer


7. How to remove all global session variables?

A. session_unset()
B. session_reset()
C. session_end()
D. session_kill()

View Answer


8. How to destroy the session?

A. session_reset()
B. session_destroy()
C. session_end()
D. session_kill()

View Answer


9. Which of the following is the default name of the session cookie in PHP?

A. PHP_SESSION
B. session_id
C. PHPSESSID
D. session_cookie

View Answer


10. Regenerating the session ID after authentication methods can prevent session fixation attacks in PHP.

A. TRUE
B. FALSE
C. Can be true or false
D. None of the above

View Answer





Discussion



* You must be logged in to add comment.