← Year 6 computing worksheets

Year 6 Using variables in programming to develop a game worksheet

“Labelled boxes that change” is free to print, with no account. It is the first sheet in the Year 6 computing unit “Using variables in programming to develop a game”, for children aged 10 to 11, and takes about 20 minutes.

Print it on A4. The child's pages come first; the answers, and what each wrong answer tells you, are on the grown-up page that follows. Weeks 13 to 18 of the year, 6 sheets in the unit.

Free sample · answers on the last page

Labelled boxes that change

Name: ____________ · Date: ____________
Year 6 · Computing · about 20 minutes
Answers are on the grown-up page

Today I can explain what a variable is and how its value can change.

A Look back4 min

  1. 1.

    The robot starts at the top left. The star is at the right, one row down. Circle the arrows that take the robot to the star.

    → → ↓↓ ↓ →← → ↓
  2. 2.

    A loop repeats 3 times. Each time, the robot moves forward 2 steps. How many steps in total?

    move 2move 2move 2
  3. 3.

    Put these steps in order. Write 1 to 4 in each box.

    1. Brush for two minutes
    2. Rinse your mouth
    3. Take the brush from the cup
    4. Put toothpaste on the brush

B Watch me, then you4 min

Mia's game has a variable called lives. It starts at 3. Each hit takes away 1 life.

A simple arcade game screen with a yellow star and a red ball on a blue background
Watch me
lives0123StartAfter hit 1After hit 2

The name of the variable is lives. Its value starts at 3.

Hit 1: change lives by −1. So 3 − 1 = 2.

Hit 2: 2 − 1 = 1. The value of lives is now 1.

Now you
  1. 1.

    Mia's program has the block: set team to Red. Which word is the name of the variable? Circle it.

    Label boxInside box
    teamRedMia

C Your turn7 min

Each row is about one variable. Decide which part is the name and work out the value it holds.

  1. 1.

    Sort these cards. Write each card in the right column: name or value.

    Label boxInside box
    lives3playerNamePriya
    NameValue
  2. 2.

    A variable called team holds 'Red'. The program then sets team to 'Blue'. What does team hold now?

    team = Red
    BlueRedBlue Red
  3. 3.

    score starts at 0. Each coin adds 1. After 3 coins, what is score?

    score0123StartCoin 1Coin 2Coin 3
  4. 4.

    A variable called playerName holds 'Priya'. The program sets it to 'Sam'. Which part stayed the same, and which part changed?

    playerName:PriyaplayerName:Sam

Say it out loud: What stayed the same in each row, and what changed? Which part is the name?

D Spot the mistake3 min

Kit says: “A variable can only hold a number, so it cannot hold a name like Priya.”
Name:playerNameValue: Priya
  1. 1.

    Write one sentence to tell Kit what is wrong.

E Think deeper4 min

  1. 1.

    Ali's game has a variable called score. It starts at 0. Ali wins 10 points and says the name has changed to 10. Explain what is really changing, and what stays the same.

    Startof gameAli wins10 points

How did it feel?

I can do it Nearly Not yet
StudyDen · Year 6 · Computing · Using variables in programming to develop a gameAnswers are on the grown-up page

For the grown-up

Labelled boxes that change · 2 minutes to read

Answers, and what a wrong one tells you

A

1. → → ↓

2. 6 If your child writes 5, they added the repeat count and the step size. Ask your child how many times the move happens, then how many steps each time.

3. 1 Take the brush from the cup · 2 Put toothpaste on the brush · 3 Brush for two minutes · 4 Rinse your mouth The order is wrong. Ask your child what must happen first before the brush can get toothpaste.

B

1. team If your child circles Red, they have picked the value. In set team to Red, Red goes inside the box and team is the label on it.

C

1. Name: lives, playerName · Value: 3, Priya If your child puts Priya under Name, they may think the name is the thing inside the box. Point to the label and ask what word is written on it.

2. Blue If your child circles Red, they kept the old value. Setting team to Blue replaces Red, so the box now holds Blue.

3. 3 If your child writes 1, they counted only one coin. Ask your child to add 1 for each coin, one coin at a time.

4. Look for: Says the name playerName stays the same and the value changes from Priya to Sam. If your child says the name changed, point to the label on the box and ask what word is written on it.

D

1. Look for: A sentence saying that a variable can hold a word or name such as Priya, not only numbers. If your child agrees with Kit, the misconception is still there. Show a box labelled playerName with the word Priya inside, and ask what kind of value it holds.

E

1. Look for: Explains that the value changes from 0 to 10 while the name score stays the same.

Words to use

Say“Point to the label on the box. What is inside it right now?”
Instead of“Tell them variables are only for numbers, or just give them the answer.”

After the sheet

Take three cups or boxes and write a label on each, such as score, lives and team. Put a number or a word in each, then swap the contents and ask: has the label changed?

Tick what your child got right in StudyDen. Anything missed comes back in a later Look back box, so there's no need to redo the sheet.

The rest of this unit

5 more sheets come with a StudyDen plan, in teaching order:

  1. Changing a Variable's Value(with a plan)
  2. Tracking the score(with a plan)
  3. Plan before you code(with a plan)
  4. From design to catching game(with a plan)
  5. Test, listen, improve(with a plan)

Every Year 6 computing worksheet

The worksheets plan opens a printable sheet for every lesson in Years 1 to 6, each with its answers on a separate page for you. It costs £6.99 a month or £59 a year for the whole family, with no free trial.

The full StudyDen plan adds the lessons themselves, marked as your child works, with the worksheets included. It is 7 days free, then £29.99 a month.

Both start with a free account; you choose the plan when you sign up.