Learn the vocabulary of caching a pure function's return value keyed by its input arguments.
0 / 5 completed
1 / 5
At standup, a dev mentions caching a pure function's return value keyed by its input arguments, so calling it again with the same arguments returns the cached result instead of recomputing it. What is this technique called?
Memoization caches a pure function's return value keyed by its input arguments, so a later call with the exact same arguments returns the cached result instantly instead of redoing the same computation. Garbage collection is an unrelated memory-reclamation mechanism, not a caching technique for function results. This technique works specifically because a pure function always returns the same output for the same input, which is what makes the cached result safe to reuse indefinitely.
2 / 5
During a design review, the team confirms the function being memoized has no side effects and its return value depends only on its arguments, never on external mutable state. Which capability does this property enable?
This property enables safely reusing a cached result for identical arguments, since a pure function's output can never differ from one call to the next given the same input, making the cached value permanently valid to reuse. A function whose return value depends on external mutable state could return a different result for the same arguments at different times, which would make blindly reusing a cached value incorrect. This purity requirement is exactly why memoization is applied selectively, to functions actually known to behave this way, rather than universally to every function in a codebase.
3 / 5
In a code review, a dev notices a memoization cache keyed by a function's arguments has no maximum size and no eviction policy, so every unique set of arguments ever seen stays cached forever. What does this represent?
This is an unbounded memoization cache risking unbounded memory growth, since if the memoized function is ever called with a large or effectively unlimited variety of distinct arguments, the cache keeps growing by one entry per unique input forever, with nothing ever evicted. A deadlock is an unrelated concurrency concept about blocked threads. This is exactly why a production memoization cache typically needs a maximum size or an eviction policy, unless the function's input space is genuinely known to be small and bounded.
4 / 5
An incident report shows a service's memory usage grew unbounded over time because a memoization cache keyed on a user-supplied search query string kept every distinct query ever seen cached forever, and the space of possible queries was effectively unlimited. What practice would prevent this?
Adding a maximum size and an eviction policy, such as least-recently-used, to the memoization cache ensures old, rarely reused entries are actually released once the cache reaches its bound, which is exactly what was missing in this incident's unbounded query cache. Continuing to memoize every distinct query forever with no bound at all is precisely the pattern that let memory grow without limit. This bounded, eviction-aware design is a standard requirement for memoizing any function whose input space isn't genuinely small and fixed.
5 / 5
During a PR review, a teammate asks why the team only memoizes functions confirmed to be pure, with no side effects and no dependency on external mutable state, instead of applying memoization broadly to any expensive function. What is the reasoning?
Memoizing a function whose output can change for the same arguments, because it reads some external mutable state, risks returning a stale cached result that no longer reflects that state's current value, silently producing an incorrect answer the caller has no way to detect. A pure function's cached result, by contrast, is always correct to reuse indefinitely, since its output is mathematically tied only to its input. The tradeoff is that this restricts memoization's applicability to a subset of functions, requiring the team to actually verify purity before caching, rather than applying the optimization indiscriminately.
What does the "Memoization Vocabulary" vocabulary exercise cover?
This exercise tests real IT vocabulary related to memoization vocabulary through 5 multiple-choice questions, each built from realistic workplace sentences rather than abstract definitions.
Is this vocabulary exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 5 questions. Each one shows a real-world sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question, and a full results screen at the end.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Are these vocabulary exercises connected to other topics?
Yes — browse the full vocabulary exercises hub to find related modules covering adjacent IT topics and roles.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more vocabulary exercises?
Browse the full Vocabulary exercises hub for hundreds of modules covering Agile, DevOps, security, databases, architecture, and more — organised by IT role and skill.