Cookies Cambridge IGCSE Computer Science (9–1) revision

Not started

Learn it

In plain words

A web server has no memory of you between one request and the next. A cookie is the note it leaves on your device to recognise you: a small piece of data, sent by the web server, stored by your browser, and sent back each time you return.

4 things to know

  1. A cookie is a small file of data that a web server sends to a browser, which stores it on the user's device.
  2. A session cookie is temporary. It is deleted when the browser is closed.
  3. A persistent cookie is stored on the device until it reaches its expiry date or the user deletes it.
  4. Cookies are used for saving personal details, tracking user preferences, holding items in an online shopping cart and storing login details.

Worked example

A shopper adds two items to an online basket, closes the browser by accident, and finds the basket empty on return. The site still greets her by name. Which kinds of cookie are in use?

  1. The basket was lost when the browser closed, so it was held in a session cookie.
  2. The name was remembered after the browser closed, so it is stored in a persistent cookie.

Tips and tricks

  • Session: gone when the browser closes. Persistent: stays until it expires or is deleted. That difference is the whole question.
  • A cookie is data, not a program. It cannot run and it is not a virus.
5 questions, about 2 minutes.

It lands in your notebook with its questions as flashcards.

Cookies: 5 questions and answers

These are the quiz’s questions. Do the quiz first, then come back here for the ones that got you.

  1. What is a cookie?
    • a type of virus
    • a small file of data sent by a web server and stored by the browser (the answer)
    • a web page
    • a kind of password

    It lets a website recognise a returning user.

  2. What happens to a session cookie when the browser is closed?
    • It is deleted. (the answer)
    • It is sent to the DNS.
    • It becomes a persistent cookie.
    • It is printed.

    Session cookies are temporary.

  3. Which cookie would keep you logged in to a site for a month?
    • a session cookie
    • a persistent cookie (the answer)
    • neither
    • an encrypted packet

    It is stored until its expiry date.

  4. Which of these is a use of cookies?
    • increasing the clock speed
    • holding the items in an online shopping cart (the answer)
    • compiling a program
    • detecting transmission errors

    The others have nothing to do with cookies.

  5. Where is a persistent cookie stored?
    • on the web server only
    • on the user's device (the answer)
    • in the CPU
    • in the router

    The browser stores it and sends it back on each visit.

Still stuck on this one?Ask in the Papermunch Discord, or help someone else who is. Discord is for ages 13 and up.Join the server

Things you can type

Or go straight to

Or browse a shelf