awesome-everything RU
↑ Back to the climb

Base CS from zero

Variables and state: free-recall review

Crux Free-recall prompts across the variables unit — answer each from memory first, then reveal the model answer and compare.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at middle altitude — in the sky
◷ 13 min

Recall beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of reconstructing the memory model is what makes it stick.

Goal

Reconstruct the unit’s spine from memory: what a variable really is, what assignment and mutation do to a cell, what state is, and why copying a primitive differs from copying a reference.

Recall before you leave
  1. 01
    What is a variable, in terms of a name, a binding, and a cell?
  2. 02
    Explain assignment as a machine operation, and why '=' should be read as 'gets' rather than 'equals'.
  3. 03
    What is mutation, and how does state differ from the history of mutations?
  4. 04
    Contrast copy (value) semantics with reference semantics. What sits in the cell in each case?
  5. 05
    What is aliasing, why does it cause surprising bugs, and how do you avoid it?
  6. 06
    What exactly does const protect, and what does it NOT protect?
Recap

If you reconstructed each answer from memory, you hold the unit’s spine: a variable is a name bound to a cell, and the name and value are distinct; assignment is a destructive store read as ‘gets’; mutation changes a cell in place and state is the snapshot of all current cells; primitives copy by value while objects copy by reference, which is what makes aliasing — and the bugs it causes — predictable; and const seals the binding, never the contents behind it.

Continue the climb ↑Variables and state: code reading
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources2
expand
  1. 01
  2. 02

Trademarks belong to their respective owners. Editorial reference only.