Tutorpip← About this lessonABCHide the answer keyDownload PDF
Coding · Ages 8+ · Set A
The Star Catcher counter
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: A variable can count. Each time, it takes its old value and adds one, so the new value is the old value plus one.

Read and answer

Read the story, then answer.

One, one, oneAt the school fair, Mina and Tavi have a booth with a game called Star Catcher, where players catch falling stars in a basket. A screen above the booth must show how many stars each player caught. Bo runs the counter, and a counter is a variable that counts up. Tavi's rule says: when a star lands, put one in the box called stars. Whoosh! The first star lands, and the screen shows one. A second star lands, but the screen still shows one! Mina says that is a bug, because the rule forgets what was in the box. The fix is to take the old value out of the box, add one, and put the new value back. So Tavi changes the rule to put stars plus one into stars.
1
The rule below puts 1 in the box every time. Three stars land. What does the screen show?
310
2
The rule "put 1 in stars" forgets what was in the box.
TrueFalse
3
The box holds 6 and a star lands. With the fixed rule, what does the box hold?
167
4
The new value is the old value plus .
5
A counter starts at zero and adds one each time.
TrueFalse
6
With the fixed rule, the box starts at 0. After the third star it holds .

Count with a variable

7
Join each word to what it means.
  1. 1a counter
  2. 2the box called stars
  3. 3the new value
  4. 4put 0 in stars
  • Aholds the number of stars caught
  • Ba variable that counts up
  • Cstarts a new player fresh
  • Dthe old value plus one
8
Put what Bo does when a star lands in order.
  • Add one to it
  • Put the new value back in the box
  • Take the old value out of the box
  • A star lands
9
Circle every rule that makes a counter count up.
put stars + 1 into starsput 1 in starsput 0 in starstake out the old value, add one, put it back
10
Mix-up to fix: the screen stays at 1. Which line fixes Tavi's rule?
put stars + 1 into starsput 1 in stars againput 0 in stars
11
Stretch: one girl catches nine stars. Mina puts 0 in stars, and the next player catches 2 stars. The screen shows .
12
Write 0 on a piece of paper. Do four jumps. After each jump, cross out the number and write the old number plus one. Write all the numbers.
13
Draw the box called stars with a different number in it after each of three stars.
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
The Star Catcher counter
11 Putting 1 in the box every time gives 1, however many stars land.
2True It does not look at the old value, so it can never count up.
37 The new value is the old value plus one, and 6 + 1 = 7.
41 A counter takes its old value and adds one.
5True That is how a variable counts.
63 0 + 1 = 1, then 1 + 1 = 2, then 2 + 1 = 3.
71-B, 2-A, 3-D, 4-C A counter is a variable that counts. Mina sets the box back to zero between players.
83, 4, 2, 1 Take out, add one, put back: that is how a variable counts up.
9put stars + 1 into stars, take out the old value, add one, put it back Only the rules that use the old value and add one count up. Putting 1 or 0 in every time never goes anywhere.
10put stars + 1 into stars The rule must look in the box and add one to what is there.
112 The box was reset to 0, so the new player counts 0 + 1 = 1, then 1 + 1 = 2.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.