Chapter Questions
A cookie can send a virus to your computer system.a. trueb. false
A cookie can read any file stored on your computer’s hard disk.a. trueb. false
You can use a cookie to________a. keep track of the items a customer purchasedb. keep track of the number of times a user visits a Web sitec. record the information entered on a formd. All of the above.
In addition to sending one or more cookies to the browser, the header functionalso sends the statement______a. print "Content-type: text/html\n\n";b. use CGI qw( : standard) ;c. use strict;d. All of the above.
Session cookiesare_____a. stored in your computer’s internal memoryb. stored on your computer’s hard diskc. removed when you close your browserd. Both a and c.
Which type of cookie remains on your computer’s hard disk until itsexpiration date?a. persistentb. sessionc. temporaryd. Both a and c.
You can use the_____ function to create a cookie.a. cookiesb. createc. create_cookied. None of the above.
You can use the ______ function to access the data stored in a cookie.a. accessb. cookiec. datad. None of the above.
Which functions are defined in the CGI.pm module?a. cookieb. headerc. paramd. All ot the above.
Which of the following cookie function arguments tells the browser to remove the cookie after 30 minutes?a. $\operatorname{expires} \Rightarrow "+30 \mathrm{~m} "$b. $-\operatorname{expires}=>"+30 \mathrm{~m} "$c. $\operatorname{expires} \Rightarrow "+30 \mathrm{M} "$d. -expires $<="+30 \mathrm{M} "$
Where are session cookies stored?
Which two arguments are required when using the cookie function to create a cookie?
Write the statement to create a temporary cookie whose key is "Number" and whose value is the contents of the $$\$part$$ num variable. The cookie should be passed to the scripts contained in the "/cgi-bin/chap 11" directory. Assign the cookie to a variable named $$\$C_num$$.
Modify the statement from Question 13 so that it creates a persistent cookie that will expire two years from its creation date.
Write the statement to send the cookie created in Question 14 to the browser.
Write the statement to retrieve the cookie created in Question 14. Assign the cookie's value to the $$\$part$$ variable.
Write the statement to send three cookies to the browser. The cookies are stored in variables named $$\$ C_{-}$$name, $$\$ C_{-}$$email, and $$\$ C_{-}$$age.
The "corresponds to" operator looks like this:___________
Write the cookie function argument that tells the browser to delete the cookie immediately.
Write the cookie function argument that tells the browser to delete the cookie in 24 hours.