Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1key = {0: white, 1: black, 2: red} | Asquare = 7, key has only 0, 1, 2, so 7 has no colour | |
| 2row 1: 2 0 1 | BLook up 2, then 0, then 1 in the key and colour three squares in that order | |
| 3To decode a square, find its number in the colour key and use the matching colour | Csquare = 2, key says 2 = red, so colour it red | |
| 4If a number is not in the key, you cannot colour that square until you check the key again | DThe square was coloured without checking the key. A 1 should be black, so the picture is rebuilt wrongly. | |
| 5key says 1 = black, but you colour a 1 square white | EThe colours do not follow the key. With 0 = white and 1 = black, the row should be red, white, black. | |
| 6row 1: 2 0 1 coloured as red, black, white | FA colour key that says which colour each number stands for |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
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.key: 0 = white, 1 = black, 2 = red
square = 2
colour = lookup(key, square)key: 0 = white, 1 = blue, 2 = green
number = 2
if number = 2 then colour ← greenkey: 0 = white, 1 = black
number = 5
if number not in key then say("No colour")for each square in grid do
look up square in key
colour the squaregrid ← [[0, 1], [1, 2]]
key ← {0: white, 1: black, 2: red}
picture ← decode(grid, key)