Intermediate Compilers & Programming Language Theory
Q44 / 100

What is the difference between static and dynamic scoping?

Correct! Well done.

Incorrect.

The correct answer is B) Static scoping: variable lookup uses the lexical nesting at definition; dynamic scoping: lookup uses the call stack at runtime

B

Correct Answer

Static scoping: variable lookup uses the lexical nesting at definition; dynamic scoping: lookup uses the call stack at runtime

Explanation

Static (lexical) scoping (most languages): name resolution at compile time from definition site. Dynamic scoping (older Lisps, Perl with local): name resolution at runtime from caller chain. Static is predictable; dynamic enables implicit parameter passing.

Progress
44/100