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 | |
|---|---|---|
| 13R2B | ADecodes to RRRBB: three red pixels followed by two blue pixels | |
| 21W4K1W | BThe number and the colour code have been copied as they are instead of being repeated. The count must be used to repeat the colour code, so 3R2B should give RRRBB. | |
| 3To rebuild a row, repeat each colour code as many times as its count says, working left to right | C4B2W3B -> 4+2+3 = 9 | |
| 4To check a decoded row has the right width, add up all the counts and compare the total with the image width | D2G3Y -> GGYYY | |
| 53R2B decoded as R3B2 | EThe decoded row has only 7 pixels (2+3+2 = 7), but the image width is 8. The check should show the row is one pixel short, so it is wrong. | |
| 6Image width 8, row 2R3B2R decoded as RRBBBRR and accepted as correct | FDecodes to WKKKKW: one white, four black, then one white pixel, a row 6 pixels wide |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
RLE decode — Repeat each colour code count times along the row to rebuild the pixels, e.g. 3R2B gives RRRBB. Then check the row adds up to the image width.3R2B decodes to RRRBB4W1K2W decodes to WWWWKWW3R2B1G: 3 + 2 + 1 = 6 pixels wideFOR i ← 1 TO count
row ← row + colour
NEXT iIF LENGTH(row) = width THEN
OUTPUT "Row is correct"
ENDIF