Intermediate Compilers & Programming Language Theory
Q69 / 100

What is the difference between eager (strict) evaluation and lazy evaluation?

Correct! Well done.

Incorrect.

The correct answer is D) Eager evaluation computes expressions as soon as they are bound; lazy evaluation defers computation until the value is actually needed, potentially never evaluating unused expressions

D

Correct Answer

Eager evaluation computes expressions as soon as they are bound; lazy evaluation defers computation until the value is actually needed, potentially never evaluating unused expressions

Explanation

Most imperative languages are eager: let x = expensiveCall() runs immediately. Haskell is lazy by default: a binding creates a thunk that is only forced when its value is demanded, which allows infinite data structures but complicates reasoning about memory usage.

Progress
69/100