← IGCSE Computer Science Paper 1

Persistent cookies

A cookie saved on the device until its expiry date or until the user deletes it, so it stays after the browser closes and is sent again on later visits.

Understanding Persistent cookies in IGCSE Computer Science Paper 1

What it does: The Expires attribute is the expiry date that makes the cookie persistent, so it is kept until that date. The Cookie header in the later request shows the stored cookie being sent again to the server so the site can recognise the returning user. A persistent cookie is saved on the device's storage, such as the hard drive, so it survives the browser closing. Session cookies are held in temporary memory.

Common mistakes: A persistent cookie is saved on the hard drive so it survives after the browser closes. RAM is cleared, so it should say: THEN store on hard drive. A persistent cookie is not deleted when the browser closes. It stays on the hard drive until its expiry date, so line 3 should say it stays.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 490–499) and word search (Modules 490–509).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What happens to a persistent cookie when the browser is closed?
It stays saved on the deviceIt is deleted straight away
Matches
A persistent cookie is deleted as soon as the browser is closed.
↓
This describes a session cookie. A persistent cookie stays on the device after the browser closes until its expiry date.
Applying
Meanings
Term
persistent cookie
Meaning
A cookie saved on the device until its expiry date or until the user deletes it, so it stays after the browser closes and is sent again on later visits.
Practice
Set-Cookie: lang=en; Expires=Wed, 01 Jan 2031 12:00:00 GMT
Testing
Gaps
: id=42; Expires=01 Jan 2027
Check Answer
Spots
1IF cookie has an expiry date
2 THEN store in RAM only

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Puffin' badge — Definition Diver, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What happens to a persistent cookie when the browser is closed?
A. It stays saved on the device ✓
B. It is deleted straight away
A persistent cookie remains after the browser is closed. It is a session cookie that is deleted when the browser closes.
2. When is a persistent cookie removed automatically?
A. When the user closes the tab
B. When its expiry date is reached ✓
Persistent cookies have an expiry date. They are kept until that date or until the user deletes them.
3. Where is a persistent cookie stored?
A. On the hard drive of the user's device ✓
B. Only in the computer's temporary memory (RAM)
A persistent cookie is saved on the device's storage, such as the hard drive, so it survives the browser closing. Session cookies are held in temporary memory.
4. A user visits a website, closes the browser, then visits the same website the next day. What happens to the persistent cookie?
A. The website has forgotten it, so nothing is sent
B. The browser sends it to the website again ✓
A persistent cookie is sent again on each later visit until it expires, so the website can recognise the user.
5. Which statement about persistent cookies is true?
A. They have an expiry date set ✓
B. They never have an expiry date
The expiry date is what makes a cookie persistent. It tells the browser how long to keep the cookie.

Match the Pairs

Set-Cookie: user=Ava; Expires=Fri, 01 Jan 2027 00:00:00 GMT → Creates a persistent cookie that stays on the device until the expiry date given
Set-Cookie: theme=dark; Max-Age=2592000 → Keeps the cookie for 30 days, then it is deleted, even if the browser has been closed in between
A persistent cookie has an expiry date, so it is removed only when that date is reached or the user deletes it → Set-Cookie: lang=en; Expires=Sat, 30 Jun 2029 12:00:00 GMT
A persistent cookie is sent back to the web server on each later visit to the website, even after the browser was closed → GET /home HTTP/1.1 Host: www.shop.com Cookie: user=Ava
A persistent cookie is deleted as soon as the browser is closed. → This describes a session cookie. A persistent cookie stays on the device after the browser closes until its expiry date.
A persistent cookie is kept in RAM and has no expiry date. → Persistent cookies are stored on the hard drive and have an expiry date. Cookies held only in memory without an expiry date are session cookies.

Key Term

persistent cookie
A cookie saved on the device until its expiry date or until the user deletes it, so it stays after the browser closes and is sent again on later visits.

Fill in the Blanks

1. Set-Cookie: id=42; Expires=01 Jan 2027
Hint: Type the name of the response header a server uses to tell the browser to store a cookie.
2. Set-Cookie: id=42; Expires=01 Jan 2027
Hint: Type the attribute that sets the date when a persistent cookie stops being valid.
3. GET /shop HTTP/1.1 Host: www.shop.com Cookie: id=42
Hint: Type the request header the browser uses to send the stored cookie back on a later visit.
4. IF today > expiry THEN DELETE cookie ENDIF
Hint: Type the comparison operator that is true once the expiry date has passed.
5. IF today < expiry THEN SEND cookie TO server ENDIF
Hint: Type the computer that receives the saved cookie again when the user visits later.

Spot the Error

Question 1
A IF cookie has an expiry date
B THEN store in RAM only
C ENDIF
Line B — A persistent cookie is saved on the hard drive so it survives after the browser closes. RAM is cleared, so it should say: THEN store on hard drive.
Question 2
A Visit 1: server sets cookie
B Browser is closed
C Cookie is deleted at once
D Visit 2: browser sends cookie
Line C — A persistent cookie is not deleted when the browser closes. It stays on the hard drive until its expiry date, so line 3 should say it stays.
Question 3
A name ← "theme"
B value ← "dark"
C expires ← NONE
D SAVE cookie TO hard drive
Line C — A persistent cookie must have an expiry date. With no expiry date it would be a session cookie. It should be something like expires ← "01/01/2027".
Question 4
A Persistent cookie ends on exit
B It is saved on the hard drive
C It is sent again on next visit
Line A — A persistent cookie does not end when the browser is closed. It lasts until its expiry date, so the line should say it has an expiry.
Question 5
A Day 1: user ticks Remember me
B Site sets a persistent cookie
C Day 2: cookie is not sent
D Site recognises the user
Line C — A persistent cookie is sent again to the website on each later visit, so the site can recognise the user. It should say the cookie is sent again.

Student with a class code? Join your class →