IGCSE · Practice questions · Session and persistent cookies

Small files, long memory.

Six original Cambridge-style questions on session and persistent cookies, with mark-scheme style solutions.

Original questions All questions on this page are original work, written in the Cambridge IGCSE style. They are not from past papers. They test the same concepts and skills the syllabus rewards.
Keep these straight

How long does it last?

01
Recall
[2 marks]

State what is meant by a cookie.

  • A small text file sent by a web server / website. ✓
  • Stored by the web browser on the user's computer (holding data about the user's visit / preferences). ✓
02
Explain
[2 marks]

Explain the difference between a session cookie and a persistent cookie.

  • A session cookie is stored in temporary memory and is deleted when the browser is closed. ✓
  • A persistent cookie is stored on the hard drive and remains until its expiry date or until the user deletes it. ✓
03
Recall
[3 marks]

Identify three ways that cookies are used by websites.

  • Saving personal details. ✓
  • Tracking user preferences. ✓
  • Holding items in an online shopping cart / storing login details (any one). ✓
04
Apply
[2 marks]

An online shop wants customers to stay logged in for 30 days, even after they turn off their computer. Identify the type of cookie needed and explain your choice.

  • A persistent cookie. ✓
  • Because it is stored on the hard drive with an expiry date (30 days), so it is not deleted when the browser is closed or the computer turned off. ✓
05
Explain
[2 marks]

Explain how a cookie allows a website to keep items in a shopping cart as the user moves between pages.

  • The website stores the cart contents / an ID for the cart in a cookie on the user's device. ✓
  • The browser sends the cookie with each new page request, so the server can recognise the user and show the same cart. ✓
06
Analysis
[2 marks]

A student says that cookies are dangerous because they can run on your computer and delete files. Evaluate this statement.

  • Incorrect: cookies are small text files (data), not programs, so they cannot run or delete files. ✓
  • However, persistent cookies can track users' browsing / preferences, which raises privacy concerns. ✓

Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.