Test Series - php

Test Number 22/39

Q: Which one of the following is the very first task executed by a session enabled page?
A. Delete the previous session
B. Start a new session
C. Check whether a valid session exists
D. Handle the session
Solution: The session variables are set with the PHP global variable which is $_SESSION. The very first task executed by a session enabled page is Check whether a valid session exists.
Q: How many ways can a session data be stored?
A. 3
B. 4
C. 5
D. 6
Solution: Within flat files(files), within volatile memory(mm), using the SQLite database(sqlite), or through user defined functions(user).
Q: Which directive determines how the session information will be stored?
A. save_data
B. session.save
C. session.save_data
D. session.save_handler
Solution: The class SessionHandler is used to wrap whatever internal save handler is set as defined by the session.save_handler configuration directive which is usually files by default.
Q: Which one of the following is the default PHP session name?
A. PHPSESSID
B. PHPSESID
C. PHPSESSIONID
D. PHPIDSESS
Solution: You can change this name by using the session.name directive.
Q: If session.use_cookie is set to 0, this results in use of _____________
A. Session
B. Cookie
C. URL rewriting
D. Nothing happens
Solution: The URL rewriting allows to completely separate the URL from the resource. URL rewriting can turn unsightly URLs into nice ones with a lot less agony and expense than picking a good domain name. It enables to fill out your URLs with friendly, readable keywords without affecting the underlying structure of pages.
Q: If the directive session.cookie_lifetime is set to 3600, the cookie will live until ________
A. 3600 sec
B. 3600 min
C. 3600 hrs
D. the browser is restarted
Solution: The lifetime is specified in seconds, so if the cookie should live 1 hour, this directive should be set to 3600.
Q: 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.
A. session.domain
B. session.path
C. session.cookie_path
D. session.cookie_domain
Solution: The directive session.cookie_domain determines the domain for which the cookie is valid.
Q: What is the default number of seconds that cached session pages are made available before the new pages are created?
A. 360
B. 180
C. 3600
D. 1800
Solution: The directive which determines this is session.cache_expire.
Q: What is the default time(in seconds) for which session data is considered valid?
A. 1800
B. 3600
C. 1440
D. 1540
Solution: The session.gc_maxlifetime directive determines this duration. It can be set to any required value.
Q: Which one of the following function is used to start a session?
A. start_session()
B. session_start()
C. session_begin()
D. begin_session()
Solution: A session is started with the function session_start() . The session variables are set with the PHP global variable which is $_SESSION.

You Have Score    /10