← IGCSE Computer Science Paper 1

Browser function: storing cookies

A small file a website sends to your browser. The browser stores it on your device and sends it back to that website on later visits. Browser settings can block or delete it.

Understanding Browser function: storing cookies in IGCSE Computer Science Paper 1

What it does: Browser settings let the user block cookies, so the browser will not store the ones websites send. The browser stores the cookie on the user's own device. The website sends it, but does not keep the only copy. A cookie is a small file of data. It is stored by the browser and is not a program that runs. Set-Cookie is the HTTP header a web server uses to give a cookie to the browser so the browser can store it.

Common mistakes: A server gives a cookie to the browser with a Set-Cookie header. Cookie is the header the browser uses to send it back. Line 2 should be 'SERVER sends Set-Cookie: id=7'. The browser returns a cookie only to the website that sent it. Line 4 should send it back to shop.com, not to another site.

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 477–489) and word search (Modules 464–489).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Where is a cookie stored after a website sends it?
Permanently on the web server onlyOn the user's device, by the browser
Matches
The website keeps the cookie on its own server and the browser never stores it.
↓
The browser stores the cookie on the user's device, not the website's server.
Applying
Meanings
Term
cookie
Meaning
A small file a website sends to your browser. The browser stores it on your device and sends it back to that website on later visits. Browser settings can block or delete it.
Practice
HTTP/1.1 200 OK
Testing
Gaps
: theme=dark
Check Answer
Spots
1BROWSER visits shop.com
2SERVER sends Cookie: id=7

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

The 'Gazelle' badge — Tuple Sprinter, 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. Where is a cookie stored after a website sends it?
A. Permanently on the web server only
B. On the user's device, by the browser ✓
The browser stores the cookie on the user's own device. The website sends it, but does not keep the only copy.
2. What does the browser do with a stored cookie when you visit the same website again?
A. Sends it to every website on the internet
B. Sends it back to that website ✓
The browser returns the cookie to the website that created it, so the site can recognise the user.
3. Which part of the process sets a cookie?
A. The website sends it to the browser, which stores it ✓
B. The browser invents it and keeps it secret from the website
Cookies come from the website. The browser's job is to store them and send them back later.
4. A student does not want a site to remember them. Which browser setting helps?
A. Block cookies in the browser settings ✓
B. Turn on the browser's bookmarks
Browser settings can block cookies so they are not stored. Bookmarks only save page addresses.
5. How can a user remove the cookies already saved on their device?
A. Delete them using the browser settings ✓
B. Wait for the web server to delete them
The user can delete stored cookies in the browser settings. The user controls the copy on their own device.

Match the Pairs

Set-Cookie: theme=dark → The website sends a cookie to the browser, which stores it on the user's device
Cookie: theme=dark → The browser sends the stored cookie back to the website on a later visit
A browser setting can stop websites from saving cookies on the device → Settings > Privacy > Block cookies
A browser setting can remove cookies that are already stored on the device → Settings > Privacy > Delete cookies
The website keeps the cookie on its own server and the browser never stores it. → The browser stores the cookie on the user's device, not the website's server.
The browser keeps every cookie and never sends it back to the website. → The browser returns the cookie to the website on later visits, which is how the site recognises the user.

Key Term

cookie
A small file a website sends to your browser. The browser stores it on your device and sends it back to that website on later visits. Browser settings can block or delete it.

Fill in the Blanks

1. HTTP/1.1 200 OK Set-Cookie: theme=dark
Hint: Type the header name a web server uses to send a cookie to the browser.
2. GET /index.html HTTP/1.1 Host: www.shop.com Cookie: theme=dark
Hint: Type the header name the browser uses to return its stored cookie to the website.
3. document.cookie = "theme=dark";
Hint: Type the document property that holds the cookies the browser stores for the site.
4. IF cookieStored = TRUE THEN SEND cookie TO website ENDIF
Hint: Type the pseudocode keyword that starts a selection, checking whether a cookie is stored before it is sent back.
5. IF blockCookies = TRUE THEN DELETE cookie ENDIF
Hint: Type the keyword that follows the condition when the browser setting to block cookies is checked.

Spot the Error

Question 1
A BROWSER visits shop.com
B SERVER sends Cookie: id=7
C BROWSER stores cookie on device
Line B — A server gives a cookie to the browser with a Set-Cookie header. Cookie is the header the browser uses to send it back. Line 2 should be 'SERVER sends Set-Cookie: id=7'.
Question 2
A Browser requests shop.com
B Server sends cookie id=7
C Browser stores cookie
D Browser sends it to ads.com
Line D — The browser returns a cookie only to the website that sent it. Line 4 should send it back to shop.com, not to another site.
Question 3
A Browser setting: Block cookies
B Site sends Set-Cookie: id=3
C Browser stores cookie
Line A — The browser only stores the cookie because cookies are allowed. If they were blocked, line 3 would not happen. Line 1 should say 'Allow cookies'.
Question 4
A First visit to shop.com
B Browser has no cookie for it
C Browser sends Cookie: id=5
D Server sends Set-Cookie: id=5
Line C — On a first visit the browser has no stored cookie for the site, so it has nothing to send. The server sends the cookie afterwards. Line 3 should say that the browser sends no cookie.
Question 5
A visit 1: server sends cookie
B browser saves cookie on device
C visit 2: server sends it back
Line C — On the later visit the browser is the one that returns the stored cookie to the website. The server does not send it back. Line 3 should say 'browser sends it back'.

Student with a class code? Join your class →