ExamVeda
Login
Home
41
Which function is used to erase all session variables stored in the current session?
Discuss
Answer & Solution
Answer: Option D
Solution:
This will not completely remove the session from the storage mechanism. If you want to completely destroy the session, you need to use the function session_destroy().
42
What will the function session_id() return is no parameter is passed?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
43
Which one of the following statements should you use to set the session username to Nachi?
Discuss
Answer & Solution
Answer: Option B
Solution:
You need to refer the session variable ‘username’ in the context of the $_SESSION superglobal.
44
What will be the output of the following PHP code? Say your previous session username was nachi.
<?php
unset($_SESSION['username']);
printf("Username now set to: %s", $_SESSION['username']);
?>
Discuss
Answer & Solution
Answer: Option C
Solution:
To delete the session variable ‘username’ we use the unset() function.
45
An attacker somehow obtains an unsuspecting user’s SID and then using it to impersonate the user inorder to gain potentially sensitive information. This attack is known as.
Discuss
Answer & Solution
Answer: Option A
Solution:
You can minimize this risk by regenerating the session ID on each request while maintaining the session-specified data. PHP offers a convenient function named session_regenerate_id() that will replace the existing ID with a new one.
46
Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?
Discuss
Answer & Solution
Answer: Option B
Solution:
By default, this behavior is disabled.
47
Which function effectively deletes all sessions that have expired?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
48
Which function is used to transform PHP’s session-handler behavior into that defined by your custom handler?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
49
The session_start() function must appear.
Discuss
Answer & Solution
Answer: Option D
Solution:
Like this:
50
What is the return type of session_set_save_handler() function?
Discuss
Answer & Solution
Answer: Option A
Solution:
Returns TRUE on success or FALSE on failure.