Explain session and persistent cookies
Describe what cookies store, common uses, and how session and persistent cookies differ.
This sequence follows Cambridge IGCSE Computer Science 0478, 2026–2028 syllabus Version 6. It covers subject content sections 5.1–5.3 only. The separately published 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding.
Before you begin
- No programming language is required. Be comfortable with place value and multiplication; each lesson introduces the computer-science notation it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
What does a cookie store?
What you will learn
- Define a cookie
- Compare session and persistent cookies
- Explain common cookie uses and privacy choices
Cookies store data used by a website
A cookie is small data stored by a browser for a website. It can help save personal details, track preferences, keep items in a shopping cart or support a sign-in session. A cookie is not the whole web page or a program that automatically infects the device.
Apply and check the rule
A session cookie is usually removed when the browser session ends. A persistent cookie is stored with an expiry or duration and can remain for later visits. Cookies can improve convenience, but users should review privacy settings and avoid storing sensitive information carelessly.
Pause and explain
A cart disappears when the browser is closed. Which cookie type may have been used?
Worked example
A shop keeps a cart while a tab is open and remembers a language preference next month. Which cookie type may suit each?
Show the worked solution
- A short-lived cart can use a session cookie.
- A preference retained across visits needs a persistent cookie.
- The user can change cookie settings to manage tracking.
Answer Session cookie for the current visit; persistent cookie for the saved preference.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
State one use of a cookie for an online shop and one use for a returning learner.
Give me a hint
Think about retaining temporary choices.
Compare my reasoning
- The shop can keep shopping-cart items.
- A learning site can remember preferences or a sign-in session.
- Both are small website-related data stored by the browser.
A cookie may keep cart items and may remember a learner's preferences or sign-in session.
Look for these in your work
- Two relevant uses
- Browser storage stated
Classify a cookie that expires when the browser closes and one that remembers a preference for a month.
Give me a hint
Compare how long each item remains stored.
Compare my reasoning
- The first is tied to the current session.
- The second has a longer expiry across visits.
- These are session and persistent cookies respectively.
Session cookie; persistent cookie.
Look for these in your work
- Session identified
- Persistent identified
A website asks to store a long-term identifier for tracking preferences. Give one benefit and one privacy concern, then name a user control.
Give me a hint
Balance convenience with collection across visits.
Compare my reasoning
- It may keep preferences so the user need not set them again.
- A persistent identifier may support tracking across visits.
- Cookie or privacy settings can restrict or remove stored data.
The preference is convenient, but a persistent identifier may enable tracking. The user can review cookie or privacy settings and reject or remove it where available.
Look for these in your work
- Benefit
- Privacy risk
- User control
Common mistakes
- Treating all cookies as malware
- Assuming session and persistent cookies last for the same period
What can you explain now?
Which cookie can remain after the browser session ends?
Compare with the explanation
Persistent cookie
It has a set expiry or duration that can span multiple visits.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
What is the difference between a session cookie and a persistent cookie?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.