← IGCSE Computer Science Paper 1

Comparing lossy and lossless compression

Lossy makes smaller files but permanently removes data; lossless keeps all data so the original can be restored, but saves less space.

Understanding Comparing lossy and lossless compression in IGCSE Computer Science Paper 1

What it does: Run-length encoding is lossless because decoding 4W2B gives back exactly WWWWBB, with no data lost. Reducing the resolution removes pixels permanently. The file size drops, but the original detail cannot be restored. Lossy throws data away, so it usually saves more space. Lossless keeps everything, so it saves less. RLE stores repeats as counts, so it can be decoded back to the exact original. That makes it lossless. Losing even one character could corrupt the file, so lossless is needed. The removed data cannot be put back, so the result is only an approximation of the original. The mistake reverses the size comparison. Lossless trades a bigger file for keeping all the data.

Common mistakes: Data is removed and cannot be restored, which describes lossy compression. Line 1 should be method = 'lossy'. Lossless compression keeps all the data, so no data is removed. Line 2 should be data_removed = False.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 86–109) and word search (Modules 86–120).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which type of compression lets you restore the original file exactly?
Lossy compressionLossless compression
Matches
Lossy compression: all data is kept, so the original can be restored
↓
This describes lossless compression. Lossy compression permanently removes data, so the original cannot be restored exactly.
Applying
Meanings
Term
lossy vs lossless
Meaning
Lossy makes smaller files but permanently removes data; lossless keeps all data so the original can be restored, but saves less space.
Practice
// Lossless: RLE keeps all the data
Testing
Gaps
type ← ""
Check Answer
Spots
1method = 'lossless'
2data_removed = True

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Deer' badge — Forest Streak, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which type of compression lets you restore the original file exactly?
A. Lossy compression
B. Lossless compression ✓
Lossless keeps all the data, so the original can be rebuilt exactly. Lossy removes data permanently.
2. Which type of compression usually gives the smaller file?
A. Lossy compression ✓
B. Lossless compression
Lossy throws data away, so it usually saves more space. Lossless keeps everything, so it saves less.
3. A student reduces an image's resolution to shrink the file. Which type of compression is this?
A. Lossy, because pixels are removed for good ✓
B. Lossless, because the image can be restored
Reducing resolution removes pixel data permanently. The original detail cannot be recovered.
4. Run-length encoding (RLE) is an example of which type of compression?
A. Lossless, because no data is lost ✓
B. Lossy, because the file gets shorter
RLE stores repeats as counts, so it can be decoded back to the exact original. That makes it lossless.
5. Which statement about data is true?
A. Lossless removes some data permanently; lossy keeps all of it
B. Lossy removes some data permanently; lossless keeps all of it ✓
Lossy = data removed. Lossless = all data kept.

Match the Pairs

Lossy compression → Makes the file smaller by permanently removing some data, so the original cannot be restored exactly
Lossless compression → Shrinks the file but keeps all the data, so the original can be restored exactly
A lossless method: repeated values are stored as a count and a value, and every pixel can be restored → RLE: WWWWBB -> 4W2B
A lossy method: the image has fewer pixels, so the file is smaller but the lost detail cannot return → Resolution: 1920x1080 -> 960x540
Lossy compression: all data is kept, so the original can be restored → This describes lossless compression. Lossy compression permanently removes data, so the original cannot be restored exactly.
Lossless compression always gives a smaller file than lossy compression → Lossy compression usually gives smaller files because it throws data away. Lossless saves less space because it must keep everything.

Key Term

lossy vs lossless
Lossy makes smaller files but permanently removes data; lossless keeps all data so the original can be restored, but saves less space.

Fill in the Blanks

1. method ← "RLE" type ← "lossless"
Hint: Type the kind of compression that keeps all the data so the original can be restored.
2. method ← "reduce resolution" type ← "lossy"
Hint: Type the kind of compression that permanently removes data to make the file smaller.
3. type ← "lossy" restorable ← FALSE
Hint: Type the Boolean value showing whether the original can be restored after lossy compression.
4. lossySize ← 2 losslessSize ← 5 OUTPUT lossySize < losslessSize
Hint: Type the comparison operator that checks the lossy file is smaller than the lossless file.
5. original ← "AAAABB" encoded ← "4A2B" decoded ← "AAAABB"
Hint: Type the run length (count) for the repeated A characters in this lossless RLE example.

Spot the Error

Question 1
A method = 'lossless'
B data_removed = True
C can_restore = False
Line A — Data is removed and cannot be restored, which describes lossy compression. Line 1 should be method = 'lossy'.
Question 2
A method = 'lossless'
B data_removed = True
C can_restore = True
Line B — Lossless compression keeps all the data, so no data is removed. Line 2 should be data_removed = False.
Question 3
A IF method = 'lossy' THEN
B OUTPUT 'data removed'
C OUTPUT 'can restore'
D ENDIF
Line C — Lossy compression permanently removes data, so the original cannot be restored. Line 3 should output 'cannot restore'.
Question 4
A data = 'AAAABBB'
B rle = '4A3B'
C type = 'lossy'
Line C — Run-length encoding keeps all the data, so the original can be rebuilt exactly. It is lossless, not lossy.
Question 5
A image = 'photo.bmp'
B type = 'lossless'
C method = 'lower resolution'
Line B — Reducing the resolution throws away pixel detail permanently, so this is lossy compression. Line 2 should be type = 'lossy'.

Student with a class code? Join your class →