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.
1a counter
2the box called stars
3the new value
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.