HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A weather website stores a persistent cookie that remembers a user's home town…
HardComputer ScienceHigh School (9–10)Computer Science › The Internet, the Web and Digital CurrencyNumericalConceptualIGCSE

A weather website stores a persistent cookie that remembers a user's home town…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A weather website stores a persistent cookie that remembers a user's home town. The cookie is saved on 3 March and lasts for 303030 days. The year is not a leap year, and March has 313131 days.

  1. On which date does the cookie expire? Give the day of April.
  1. On 20 March, how many days of the cookie's life are left?
  1. The user closes the browser on 10 March and opens it the next day. Is the home town still remembered? Explain.
  1. Would a session cookie remember the home town on 11 March? Explain.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

The browser sends the domain name to a domain name server (DNS). The DNS returns the IP address (asking another DNS if it does not know the name). The browser sends a request to the web server at that address, the server sends the page as HTML, and the browser renders it. A cookie is a small text file that a website stores on the device through the browser: a session cookie is deleted when the browser closes, a persistent cookie stays until its expiry date or until it is deleted.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. The expiry date. From 3 March, 282828 days take us to 31 March. Two more days take us to 2 April, which is 303030 days after 3 March.

Step 2. Days left on 20 March. From 20 March to 2 April is 111111 days to 31 March and 222 more: 11+2=1311 + 2 = 1311+2=13 days.

Step 3. Closing the browser. A persistent cookie is saved in the device's storage, not only in memory. So it is still there the next day, and the website still knows the home town.

Step 4. A session cookie. No. A session cookie is deleted when the browser is closed, so on 11 March the website would not know the home town.

Answer: (a) 2 April. (b) 131313 days. (c) Yes, a persistent cookie stays after the browser closes. (d) No, a session cookie is deleted when the browser closes.

Check. 28+2=3028 + 2 = 3028+2=30 days from 3 March to 2 April.

Log in to save this for later
← All Problems
← On a first visit to a website, the browser's domain name server does not know the name…An online bookshop uses two cookies. Cookie A holds the books in the shopping basket while the user… →
More onComputer Science › The Internet, the Web and Digital Currency

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. Part of a blockchain holds these payments, oldest first…Hard
  2. A blockchain has 56 blocks. A new block is added to the honest chain every 10 minutes…Hard
  3. Kemal pays Dana 9 units of a digital currency that uses a blockchain…Medium
  4. A blockchain is copied on 40 computers in a network…Medium
  5. A student designs a "blockchain" in which each block holds only its data, a time-stamp and its own…Hard
All problems on this topic →