Reading a pixel grid row by row

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

Reading a pixel grid row by row

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Where do you start when reading a pixel grid?
A At the bottom-right pixel
B At the top-left pixel
2. Which way do you read across a row of pixels?
A Left to right
B Right to left
3. After you finish the top row, which row do you read next?
A The row just below it
B The row at the very bottom
4. A grid has 4 rows and 5 columns. How many pixels does it have?
A 20 pixels
B 9 pixels
5. A grid is 3 pixels wide and 3 pixels tall. How many numbers do you write down when you read it?
A 3 numbers, one for each row
B 9 numbers, one for each pixel

Match the Pairs

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

Left columnRight column
1row by row AA 4 by 3 grid written as 3 rows of 4 pixels, with a slash marking where each row ends
20 1 1 0 / 1 0 0 1 / 0 1 1 0 B1 0 1 / 0 1 0 / 1 0 1
3A grid with 3 rows and 4 columns has 12 pixels, because you multiply the rows by the columns C3 * 4 = 12
4Reading starts at the top row and goes left to right, so the first row of the picture is written first DThe pixels are counted by multiplying, not adding. The grid has 4 * 3 = 12 pixels.
5Read the grid from the bottom row up to the top row EA pixel grid is read from the top row down, not from the bottom up. Start at the top row and move down.
6A grid with 4 columns and 3 rows has 4 + 3 = 7 pixels FRead the pixels starting at the top row, going left to right, then moving down to the next row

Definitions

row by row

Fill in the Blanks

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

1.
row ← _ READ pixels across row 1, left to right
2.
width ← 4 height ← 3 total ← width _ height
3.
FOR each ___ from top to bottom FOR each pixel from left to right READ the pixel
4.
image ← "0110_1001/0110"
5.
START at the ___ row READ left to right across the row MOVE down to the next row

Spot the Error

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

Question 1
A Grid: 3 columns, 2 rows
B Start at the top row
C Read right to left, then go down
D Stop after row 2
Question 2
A Start at the bottom-left pixel
B Read across the row
C Move down to the next row
D Stop at the last pixel
Question 3
A Grid: 5 columns, 4 rows
B Pixels in one row: 5
C Total pixels: 5 + 4 = 9
Question 4
A Data: 0 1 1 | 1 0 0 | 0 0 1
B Each | shows a new column
C So the grid has 3 rows
D Each row has 3 pixels
Question 5
A Grid: 4 columns, 3 rows
B Row 1 is the top row
C Row 3 is the bottom row
D Last pixel: row 4, column 3

Answer Key

Reading a pixel grid row by row
Section A: Quick Questions
Q1
B — At the top-left pixel
Q2
A — Left to right
Q3
A — The row just below it
Q4
A — 20 pixels
Q5
B — 9 numbers, one for each pixel
Section B: Match the Pairs
Q1
row by row → Read the pixels starting at the top row, going left to right, then moving down to the next row
Q2
0 1 1 0 / 1 0 0 1 / 0 1 1 0 → A 4 by 3 grid written as 3 rows of 4 pixels, with a slash marking where each row ends
Q3
A grid with 3 rows and 4 columns has 12 pixels, because you multiply the rows by the columns → 3 * 4 = 12
Q4
Reading starts at the top row and goes left to right, so the first row of the picture is written first → 1 0 1 / 0 1 0 / 1 0 1
Q5
Read the grid from the bottom row up to the top row → A pixel grid is read from the top row down, not from the bottom up. Start at the top row and move down.
Q6
A grid with 4 columns and 3 rows has 4 + 3 = 7 pixels → The pixels are counted by multiplying, not adding. The grid has 4 * 3 = 12 pixels.
Section C: Definitions
Q1
row by row — Read a pixel grid in order: start at the top row, go left to right across it, then move down to the next row until the grid ends.
Section D: Fill in the Blanks
Q1
row ← 1 READ pixels across row 1, left to right
Q2
width ← 4 height ← 3 total ← width * height
Q3
FOR each row from top to bottom FOR each pixel from left to right READ the pixel
Q4
image ← "0110/1001/0110"
Q5
START at the top row READ left to right across the row MOVE down to the next row
Section E: Spot the Error
Q1
C — A pixel grid is read from left to right across each row. The line should say 'Read left to right, then go down'.}
Q2
A — Reading always starts at the top row, so the first pixel is the top-left one. The line should say 'Start at the top-left pixel'.
Q3
C — To count all the pixels, multiply the pixels in one row by the number of rows. It should be 5 x 4 = 20, not 5 + 4.
Q4
B — In this data the | marks where one row ends and the next row starts. It does not show a new column. The line should say 'Each | shows a new row'.
Q5
D — The grid has only 3 rows and 4 columns. The last pixel is at the end of the bottom row: row 3, column 4. Row 4 does not exist.