Signed up recently but had issues with the confirmation email?
Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.
Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.
The nature, benefits and drawbacks of caching.
2.1.2 Thinking ahead
Practise exam questionsThinking ahead — Note 3 of 4
Candidates need to understand the purpose of caching in programming and how it can be used when writing a program. Candidates need to be able to apply caching to a scenario and understand the benefits and drawbacks of using it.
Caching stores data that has been used recently, or is likely to be needed soon, in a location that is faster to access. It is an example of thinking ahead, used in processors, web browsers and programs.
cache = {}
def slow_square(n):
if n in cache: # cache hit: return the stored result
return cache[n]
result = n * n # imagine this takes a long time
cache[n] = result # store for next time
return resultTemporarily storing data or instructions that have been used, or are likely to be needed, so they can be accessed more quickly next time.
Past exam questions
Ready to test yourself?
Practise 2.1.2 questions