← ACARA Digital Technologies Years 5–6

Decoding a colour-by-number grid

To decode a grid of numbers, look up each number in the colour key, then colour that square the matching colour. Doing this for every square rebuilds the picture.

Understanding Decoding a colour-by-number grid in ACARA Digital Technologies Years 5–6

What it does: This shows the decode step: read the number, look it up in the key, then colour the square with that colour. The key only works for numbers it lists. A number like 7 has no matching colour, so it needs checking. Decoding means following the key. The number tells you exactly which colour to use. Decode one number at a time: 1 is black, 0 is white, 1 is black. Every square needs to be decoded. Doing this for all the squares rebuilds the whole picture. If a number is not in the key, you cannot guess its colour. Check the key and ask for a fix or a new key entry.

Common mistakes: In a colour key, each number stands for only one colour. Here 1 is used for both black and red, so you could not decode a 1. The last entry should be 2=red. The number in the grid is not the colour. You must look the number up in the key to find its colour. It should be colour ← lookup(key, square).

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 59–71) and word search (Modules 44–71).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A colour key says 0 = white, 1 = blue, 2 = red. What colour is a square with the number 2?
BlueRed
Matches
key says 1 = black, but you colour a 1 square white
↓
The square was coloured without checking the key. A 1 should be black, so the picture is rebuilt wrongly.
Applying
Meanings
Term
decode
Meaning
To decode a grid of numbers, look up each number in the colour key, then colour that square the matching colour. Doing this for every square rebuilds the picture.
Practice
key ← {0: white, 1: black, 2: red}
Testing
Gaps
colour = lookup(, square)
Check Answer
Spots
1key: 0=white 1=black 1=red
2square ← 2

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Deer' badge — Forest Streak, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A colour key says 0 = white, 1 = blue, 2 = red. What colour is a square with the number 2?
A. Red ✓
B. Blue
Look up the number in the colour key. The key says 2 stands for red.
2. Which step is the right way to decode a number in a colour-by-number grid?
A. Look up the number in the colour key, then colour the square ✓
B. Pick any colour you like for the square
Decoding means following the key. The number tells you exactly which colour to use.
3. Key: 0 = white, 1 = black. A row reads 1 0 1. Which row of squares does it make?
A. black, white, black ✓
B. white, black, white
Decode one number at a time: 1 is black, 0 is white, 1 is black.
4. What do you do after you colour one square when decoding a grid?
A. Stop, because the picture is finished
B. Move on to the next number and look it up in the key ✓
Every square needs to be decoded. Doing this for all the squares rebuilds the whole picture.
5. Key: 1 = green, 2 = yellow. The grid has a square with the number 3. What should you do?
A. Colour it green because 3 is close to 2
B. Check the key and notice that 3 is not in it ✓
If a number is not in the key, you cannot guess its colour. Check the key and ask for a fix or a new key entry.

Match the Pairs

key = {0: white, 1: black, 2: red} → A colour key that says which colour each number stands for
row 1: 2 0 1 → Look up 2, then 0, then 1 in the key and colour three squares in that order
To decode a square, find its number in the colour key and use the matching colour → square = 2, key says 2 = red, so colour it red
If a number is not in the key, you cannot colour that square until you check the key again → square = 7, key has only 0, 1, 2, so 7 has no colour
key says 1 = black, but you colour a 1 square white → The square was coloured without checking the key. A 1 should be black, so the picture is rebuilt wrongly.
row 1: 2 0 1 coloured as red, black, white → The colours do not follow the key. With 0 = white and 1 = black, the row should be red, white, black.

Key Term

decode
To decode a grid of numbers, look up each number in the colour key, then colour that square the matching colour. Doing this for every square rebuilds the picture.

Fill in the Blanks

1. key: 0 = white, 1 = black, 2 = red square = 2 colour = lookup(key, square)
Hint: Type the name of the table that matches each number to a colour.
2. key: 0 = white, 1 = blue, 2 = green number = 2 if number = 2 then colour ← green
Hint: Type the colour that the table gives for this number.
3. key: 0 = white, 1 = black number = 5 if number not in key then say("No colour")
Hint: Type the words that check whether a number is missing from the colour table.
4. for each square in grid do look up square in key colour the square
Hint: Type the variable name that stands for one cell of the grid.
5. grid ← [[0, 1], [1, 2]] key ← {0: white, 1: black, 2: red} picture ← decode(grid, key)
Hint: Type the name of the function that turns the grid of numbers back into a picture.

Spot the Error

Question 1
A key: 0=white 1=black 1=red
B square ← 2
C colour ← lookup(key, square)
Line A — In a colour key, each number stands for only one colour. Here 1 is used for both black and red, so you could not decode a 1. The last entry should be 2=red.
Question 2
A key: 0=white 1=blue 2=green
B square ← 1
C colour ← square
D fill square with colour
Line C — The number in the grid is not the colour. You must look the number up in the key to find its colour. It should be colour ← lookup(key, square).
Question 3
A key: 0=white 1=black 2=red
B for each square in key:
C look up number in key
D colour square to match
Line B — You decode by going through the squares of the grid, not the entries in the key. It should be for each square in row 1:.
Question 4
A row ← 0 1 3
B key: 0=white 1=blue 2=red
C check 3 is in the key: yes
Line B — The row has a 3, so the key needs an entry for 3. This key has 2 instead, so the check on line 3 would fail. It should be key: 0=white 1=blue 3=red.
Question 5
A key: 0=white 1=black
B square ← 4
C if square is in key:
D show error, skip square
Line C — The number 4 is not in the key, so the error should show when the number is NOT in the key. It should be if square is not in key:.

Student with a class code? Join your class →