Pickles AcademyStart for free

Variables in block programs – practice for Years 5–6

Sample questions on Variables in block programs with the right answer and a worked solution, from easy to hard. In the Pickles Academy app a child gets new questions of the same kind every time, so they can't just learn the answers by heart.

Subject
Computing
Year
Years 5–6
Curriculum area
Algorithms and programming

Question types: What does the sprite say?

Rule: Variables in block programs

A variable is a named box for a number. set puts a new value in it, increase and decrease change it.

Go through the blocks from top to bottom and write down the value after each one.

Example: set x to 5, increase x by 3, decrease x by 1 → x is 7

Watch out: set throws the old value away: after set x to 2, x is 2 whatever it was before.

Sample questions

  1. Question 1 Easy

    What number does the sprite say at the end of the program?

    set x to 3
    increase x by 6
    decrease x by 5
    say x
    Show the solution
    Answer: 4

    How it works: Values of x: 3 → 9 → 4. The sprite says 4.

  2. Question 2 Normal

    What number does the sprite say at the end of the program?

    set x to 2
    repeat 4
    increase x by 6
    decrease x by 9
    say x
    Show the solution
    Answer: 17

    How it works: Values of x: 2 → 8 → 14 → 20 → 26 → 17. The sprite says 17.

  3. Question 3 Hard

    What number does the sprite say at the end of the program?

    set x to 1
    repeat 5
    if x > 9 then
    decrease x by 4
    else
    increase x by 5
    say x
    Show the solution
    Answer: 8

    How it works: Values of x: 1 → 6 → 11 → 7 → 12 → 8. The sprite says 8.

All Computing topics

Keep practising in the app

In a minute, your child has their own avatar and a first task. Free, no ads, data in the EU.

Start for free