Explore topic-wise MCQs in Php.

This section includes 10 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.

1.

Which one of the following function is used to start a session?

A. start_session()
B. session_start()
C. session_begin()
D. begin_session()
Answer» C. session_begin()
2.

What is the default time(in seconds) for which session data is considered valid?

A. 1800
B. 3600
C. 1440
D. 1540
Answer» D. 1540
3.

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
Answer» C. 3600
4.

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
Answer» E.
5.

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
Answer» B. 3600 min
6.

If session.use_cookie is set to 0, this results in use of _____________

A. Session
B. Cookie
C. URL rewriting
D. Nothing happens
Answer» D. Nothing happens
7.

Which one of the following is the default PHP session name?

A. PHPSESSID
B. PHPSESID
C. PHPSESSIONID
D. PHPIDSESS
Answer» B. PHPSESID
8.

Which directive determines how the session information will be stored?

A. save_data
B. session.save
C. session.save_data
D. session.save_handler
Answer» E.
9.

How many ways can a session data be stored?

A. 3
B. 4
C. 5
D. 6
Answer» C. 5
10.

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
Answer» D. Handle the session