PHP Cookies Aptitude Questions and Answers

PHP Cookies Aptitude: This section contains aptitude questions and answers on Cookies. By Nidhi Last updated : December 15, 2023

This section contains Aptitude Questions and Answers on PHP Cookies.

1) There are the following statements that are given below, which of them are correct about cookies in PHP?
  1. A cookie is used to identify the user.
  2. A cookie is a file which is stores in the user's computer by the web applications.
  3. The cookies are used to improve the performance of web applications.
  4. In PHP, we can create cookies and we can also retrieve data from cookies.

Options:

  1. A and B
  2. A and C
  3. B and C
  4. A, B, C, and D

2) Which of the following function is used to save a cookie in the user's computer?
  1. savecookie()
  2. createcookie()
  3. create_cookie()
  4. setcookie()

3) How can we retrieve information from the specified cookie?
  1. Using getcookie() function
  2. Using readcookie() function
  3. Using $_COOKIE superglobal variable
  4. None of the above

4) Which of the following function is used to check the cookie is set or not?
  1. iscookie_set()
  2. is_cookie_set()
  3. isset()
  4. is_set()

5) Is it true that the setcookie() function must be called before the HTML tag in the PHP script?
  1. Yes
  2. No

6) What is the default expire time of a cookie, if not specified in the setcookie() function?
  1. 1 day
  2. 1 week
  3. 8 hours
  4. When session expires

7) Can we modify the already created cookie in PHP?
  1. Yes
  2. No

8) Which of the following function is used to delete a cookie?
  1. setcookie()
  2. delete_cookie()
  3. deletecookie()
  4. removecookie()

9) Which of the following function is used to count cookie in PHP?
  1. count()
  2. cookie_count()
  3. total_cookie()
  4. None of the above

10) Can we set multiple values in a single cookie in PHP?
  1. Yes
  2. No

Learn PHP programming with our PHP tutorial.

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.