Tutorpip← About this lessonAHide the answer keyDownload PDF
Coding · Ages 8+ · Set A
Noor's apple game
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: A variable is a named box that holds a value until a block changes it. Set puts a value in, and change adds to it.

Read and answer

Read the story, then answer.

The box that said nineNoor held her basket under the apple tree, and plop, an apple dropped in. At Code Club she turned it into a game. She drew a basket and an apple that fell from the top of the stage. Ms. Ade said a game has to remember how many apples you catch, so Noor made a variable called apples and put a zero in it. Then she added a block: when the apple touches the basket, change apples by one. The box showed one, then two, then three. Teo played next and caught nine apples. When Noor pressed the flag for her own turn, the box said nine before she had caught a single apple! A variable keeps its value until a block changes it, and nobody had told the box to start again at zero. So Noor added set apples to zero, right under the flag block.
1
Which line puts the apples box back to zero?
line 4line 2line 3
2
The box apples holds 5. One change apples by 1 block runs. What does the box hold now?
165
3
The box apples holds 5. A set apples to 0 block runs. What does the box hold now?
056
4
A block puts a value into the box.
flagsetchange
5
A variable forgets its value by itself when a new game starts.
TrueFalse
6
Circle every thing on Noor's game screen that remembers a number.
📦the apples box🏁the flag💗the lives box🧺the basket🍎a falling apple

Match, order and fix

7
Join each block or word to its job.
  1. 1a variable
  2. 2set
  3. 3change
  4. 4the flag block
  • Aputs a value in the box
  • Badds to the value inside
  • Ca named box that holds a value
  • Dstarts the game
8
Put the steps of Noor's game in order.
  • Noor adds set apples to zero under the flag block
  • Noor makes a box called apples with a zero inside
  • Noor draws a basket and a falling apple
  • Teo plays and catches nine apples
  • Noor adds: change apples by one when the apple touches the basket
9
Noor presses the flag for her turn, and the box already says 9. What is the mix-up to fix?
The basket is too smallNothing told the box to start again at zeroThe apple falls too slowly
10
Noor's game also has a box called lives. Which block puts 3 into it at the start?
change lives by 1set lives to 3when flag clicked
11
The stack now starts with set apples to 0. Noor catches 2 apples. What does the box say at the end?
1192
12
Write the name of one more thing a game could count in a box.
13
Draw the apples box after Teo caught nine apples.
Scan the code at the top to mark this sheet on screenTake a photo of your answers or type them. It is marked for you automatically, and your score is kept.
Answer key · Set A
Noor's apple game
1line 2 Line 2, set apples to 0, puts a 0 in the box. Line 4 only adds one.
26 Change adds to the value already inside, so 5 + 1 = 6.
30 Set puts a new value in the box, so the 5 is replaced by 0.
4set Set puts a value in. Change adds to the value that is already inside.
5False A variable keeps its value until a block changes it. That is why Noor's box still held Teo's nine.
6the apples box, the lives box The apples box and the lives box are variables. The flag starts the game, and the basket and apple are sprites that remember nothing.
71-C, 2-A, 3-B, 4-D A variable is the box. Set puts a value in, change adds to it, and the flag starts the game.
85, 2, 1, 4, 3 Noor built the game first, Teo played, and then she fixed the box so each game starts at zero.
9Nothing told the box to start again at zero The box kept Teo's nine. Setting it to zero under the flag block gives every game a fresh start.
10set lives to 3 Set puts a value in the box. Change only adds to what is already there, and the flag block holds no number.
112 The box goes 0, then 1, then 2. Without the set block it would have carried on from Teo's 9, to 11.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.