• Home
  • Textbooks
  • CGI/Perl (Web Warrior Series)
  • Cookies

CGI/Perl (Web Warrior Series)

Diane Zak

Chapter 11

Cookies - all with Video Answers

Educators


Chapter Questions

01:05

Problem 1

A cookie can send a virus to your computer system.
a. true
b. false

Joanna Quigley
Joanna Quigley
Numerade Educator

Problem 2

A cookie can read any file stored on your computer’s hard disk.
a. true
b. false

Check back soon!

Problem 3

You can use a cookie to________
a. keep track of the items a customer purchased
b. keep track of the number of times a user visits a Web site
c. record the information entered on a form
d. All of the above.

Check back soon!

Problem 4

In addition to sending one or more cookies to the browser, the header function
also sends the statement______
a. print "Content-type: text/html\n\n";
b. use CGI qw( : standard) ;
c. use strict;
d. All of the above.

Check back soon!
01:06

Problem 5

Session cookiesare_____
a. stored in your computer’s internal memory
b. stored on your computer’s hard disk
c. removed when you close your browser
d. Both a and c.

Emily Himsel
Emily Himsel
Numerade Educator
02:05

Problem 6

Which type of cookie remains on your computer’s hard disk until its
expiration date?
a. persistent
b. session
c. temporary
d. Both a and c.

Alexa Moschella
Alexa Moschella
Numerade Educator

Problem 7

You can use the_____ function to create a cookie.
a. cookies
b. create
c. create_cookie
d. None of the above.

Check back soon!

Problem 8

You can use the ______ function to access the data stored in a cookie.
a. access
b. cookie
c. data
d. None of the above.

Check back soon!

Problem 9

Which functions are defined in the CGI.pm module?
a. cookie
b. header
c. param
d. All ot the above.

Check back soon!

Problem 10

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} "$

Check back soon!

Problem 11

Where are session cookies stored?

Check back soon!

Problem 12

Which two arguments are required when using the cookie function to create a cookie?

Check back soon!

Problem 13

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

Check back soon!

Problem 14

Modify the statement from Question 13 so that it creates a persistent cookie that will expire two years from its creation date.

Check back soon!

Problem 15

Write the statement to send the cookie created in Question 14 to the browser.

Check back soon!
00:12

Problem 16

Write the statement to retrieve the cookie created in Question 14. Assign the cookie's value to the $$\$part$$ variable.

Brandon Fox
Brandon Fox
Numerade Educator

Problem 17

Write the statement to send three cookies to the browser. The cookies are stored in variables named $$\$ C_{-}$$name, $$\$ C_{-}$$email, and $$\$ C_{-}$$age.

Check back soon!

Problem 18

The "corresponds to" operator looks like this:___________

Check back soon!

Problem 19

Write the cookie function argument that tells the browser to delete the cookie immediately.

Check back soon!

Problem 20

Write the cookie function argument that tells the browser to delete the cookie in 24 hours.

Check back soon!