Explore topic-wise MCQs in Php.

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

1.

What will be the output of the following PHP code? Say your previous session username was Manjesh.
unset($_SESSION['username']);
printf("Username now set to: %s", $_SESSION['username']);

A. Username now set to: System
B. Username now set to: Manjesh
C. Error
D. Username now set to:
E. None of these
Answer» E. None of these
2.

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.cookie_domain
B. session.cookie_path
C. session.path
D. session.domain
E. None of these
Answer» B. session.cookie_path
3.

Which one of the following statements should you use to set the session username to Manjesh?

A. session_start( Manjesh );
B. $SESSION_START[ username ] = Manjesh ;
C. $SESSION[ username ] = Manjesh ;
D. $_SESSION[ username ] = Manjesh ;
E. None of these
Answer» E. None of these
4.

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..

A. session-copy
B. session-hijack
C. session-fixation
D. session-fixing
E. None of these
Answer» D. session-fixing
5.

What will be the output of the following PHP code? Say your previous session username was Manjesh.

A. Username now set to: System
B. Username now set to: Manjesh
C. Error
D. Username now set to:
E. None of these
Answer» E. None of these
6.

Which function is used to transform PHP s session-handler behavior into that defined by your custom handler?

A. session_set_save_handler()
B. Session_handler()
C. session_save_handler()
D. session_set_save()
E. None of these
Answer» B. Session_handler()