For the questions that don’t fit in a textbook. Find their starting point
Fahahu

Ages 12–14 · Foundation

A destructive read inside an expression

Use the evidence in a destructive read inside an expression to select and justify a valid solution.

Understand the idea

Values references and evaluation order affect program state.

Your challenge

TAKE removes and returns the first item of a queue. Starting [4,9,2], evaluate x=TAKE()+TAKE() left to right. Which state follows?

  • x=13 and queue [2]
  • x=13 and queue [4,9,2]
  • x=8 and queue [9,2]

How to explore

  • Account for the state change caused by evaluating each operand.
  • Record the state after each executed operation, respecting the stated evaluation and stopping rules.
  • Check the selected response against the complete situation, including a case where a tempting alternative fails.

Open the activity to work with its controls and check your reasoning. Progress stays in this browser.

Keep exploring

DON’T LET THE QUESTION END HERE

Give that curiosity
somewhere to go.

Open the learning space

Discovery

Digital models simplify the real world. Explore with a grown-up and talk about what you notice.

Find something worth exploring

Explore free activities and printables, or learn about the separately paid Academy courses.