Beginner
Compilers & Programming Language Theory
Q39 / 100
What is memoization and how is it used in PL implementations?
Correct! Well done.
Incorrect.
The correct answer is B) Caching function results for previously computed inputs — used to optimize recursive functions and implement lazy evaluation in languages
B
Correct Answer
Caching function results for previously computed inputs — used to optimize recursive functions and implement lazy evaluation in languages
Explanation
Memoization makes pure functions fast: fib(40) goes from exponential to O(n) with memo. Languages use it for lazy evaluation (Haskell thunks cache results on first evaluation) and dynamic programming.
Progress
39/100