Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Data storage and compression

EasyMedium
1234567891011121314151617
Question 5

An 8x8 pixel grid image representing a simple house icon is shown below. The image uses two colors: White (W) and Black (B).

An 8x8 grid representing a house. Row 1: 3 white, 2 black, 3 white. Row 2: 2 white, 4 black, 2 white. Row 3: 1 white, 6 black, 1 white. Row 4: 8 black. Row 5: 2 white, 4 black, 2 white. Row 6: 2 white, 4 black, 2 white. Row 7: 2 white, 4 black, 2 white. Row 8: 2 white, 4 black, 2 white.

Give the result of compressing the first 4 rows of the icon using Run-Length Encoding (RLE).

You should:

  • Represent each run of pixels as the number of pixels followed by the color character (e.g., 5W for 5 white pixels).
  • Encode each row individually, separating rows with a comma or a new line.
[3]

Data storage and compression Questions

  1. IGCSE
  2. /Computer Science
  3. /Data storage and compression