Decoding 0s and 1s into an image

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Decoding 0s and 1s into an image

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. You are decoding a black-and-white image. What do you do for a 1 in the code?
A Leave that square white
B Colour that square in
2. You are decoding a black-and-white image. What do you do for a 0 in the code?
A Leave that square white
B Colour that square in
3. Which way do you fill in the grid when you decode a code?
A Row by row, starting at the top left
B Any square you like, in any order
4. A grid is 4 squares wide. The code is 1001 0110 0110 1001. How many squares are in the first row?
A 4 squares: 1001
B 8 squares: 10010110
5. You have decoded a grid and the picture looks like a messy jumble. What should you do?
A Decide the picture is finished and stop
B Check the code and the grid size, then try again

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
101110 AA row where all 5 squares are coloured in
211111 BA row of 5 squares: leave the first white, colour the next three, leave the last white
3Decode a grid by reading the code one row at a time, from the top row down C1 = colour, 0 = white
4A 0 means leave the square white and a 1 means colour it DThe row has 5 digits but the grid is only 4 squares wide, so the code and the grid do not match. Check the picture makes sense before sharing it.
5Code 0110: colour squares 1 and 4, leave 2 and 3 white EThe colours are swapped. The 1s are in squares 2 and 3, so those get coloured, and the 0s in squares 1 and 4 stay white.
6Row 1 of a 4-square grid: 10101 so colour 5 squares FRow 1: 10001 Row 2: 01010

Definitions

decode

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
IF bit = _ THEN colour the square
2.
ELSE leave the square _____
3.
FOR each ___ in the grid read the bits from left to right colour a square for each 1
4.
row1 ← "0110" square 1 is 0, so leave it white square 2 is _, so colour it
5.
1. Decode the code into a grid 2. _____ the picture makes sense

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A read the code row by row
B if digit is 1, colour it in
C if digit is 0, colour it in
Question 2
A grid = 4 columns by 4 rows
B start at the top left square
C read the first row of digits
D move down after each digit
Question 3
A Code: 0110 1001 1001
B Row 1 is 0110, so: X _ _ X
C Row 2 is 1001, so: X _ _ X
Question 4
A Grid is 3 columns wide
B Each row needs 4 digits
C Row code 101 fits the row
Question 5
A A colours a 3x3 grid
B A writes 1 for coloured cells
C A writes 2 for white cells
D A gives the code to B

Answer Key

Decoding 0s and 1s into an image
Section A: Quick Questions
Q1
B — Colour that square in
Q2
A — Leave that square white
Q3
A — Row by row, starting at the top left
Q4
A — 4 squares: 1001
Q5
B — Check the code and the grid size, then try again
Section B: Match the Pairs
Q1
01110 → A row of 5 squares: leave the first white, colour the next three, leave the last white
Q2
11111 → A row where all 5 squares are coloured in
Q3
Decode a grid by reading the code one row at a time, from the top row down → Row 1: 10001 Row 2: 01010
Q4
A 0 means leave the square white and a 1 means colour it → 1 = colour, 0 = white
Q5
Code 0110: colour squares 1 and 4, leave 2 and 3 white → The colours are swapped. The 1s are in squares 2 and 3, so those get coloured, and the 0s in squares 1 and 4 stay white.
Q6
Row 1 of a 4-square grid: 10101 so colour 5 squares → The row has 5 digits but the grid is only 4 squares wide, so the code and the grid do not match. Check the picture makes sense before sharing it.
Section C: Definitions
Q1
decode — To turn a code back into a picture: fill the grid row by row, colouring a square for each 1 and leaving it white for each 0. Then check the picture makes sense.
Section D: Fill in the Blanks
Q1
IF bit = 1 THEN colour the square
Q2
ELSE leave the square white
Q3
FOR each row in the grid read the bits from left to right colour a square for each 1
Q4
row1 ← "0110" square 1 is 0, so leave it white square 2 is 1, so colour it
Q5
1. Decode the code into a grid 2. Check the picture makes sense
Section E: Spot the Error
Q1
C — A 0 means the square stays white. Only a 1 is coloured in, so the line should be: if digit is 0, leave it white.
Q2
D — Each row is read from left to right, so after each digit you move right along the row. You only move down when the row is finished.
Q3
B — 0110 means white, coloured, coloured, white. The broken line colours the wrong squares. It should be: _ X X _.
Q4
B — The grid is 3 columns wide, so each row of the code needs exactly 3 digits. It should say 3 digits, not 4.
Q5
C — Binary code only uses 0 and 1. White cells are written as 0, so the line should be: A writes 0 for white cells.