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
-
Question 1 Easy
What number does the sprite say at the end of the program?
set x to 3increase x by 6decrease x by 5say xShow the solution
Answer: 4How it works: Values of x: 3 → 9 → 4. The sprite says 4.
-
Question 2 Normal
What number does the sprite say at the end of the program?
set x to 2repeat 4increase x by 6decrease x by 9say xShow the solution
Answer: 17How it works: Values of x: 2 → 8 → 14 → 20 → 26 → 17. The sprite says 17.
-
Question 3 Hard
What number does the sprite say at the end of the program?
set x to 1repeat 5if x > 9 thendecrease x by 4elseincrease x by 5say xShow the solution
Answer: 8How it works: Values of x: 1 → 6 → 11 → 7 → 12 → 8. The sprite says 8.
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