← Years 9–10 Data & Information

Lossless compression

Shrinks a file so the exact original data can be rebuilt perfectly, with nothing lost. ZIP and PNG use it. Needed for text and programs.

Understanding Lossless compression in Years 9–10 Data & Information

What it does: A program must be restored exactly, so it is zipped with lossless compression and then unzipped to get the identical file. Lossless means nothing is lost. When you decompress, you get back a perfect copy of the original. PNG compresses image data without losing any pixels, so the picture can be restored exactly. Lossless compression shrinks files by finding patterns and redundancy, not by deleting information. Missing or altered characters (like a wrong number in a spreadsheet) can make the data wrong, so every bit must be restored.

Common mistakes: Lossy compression throws data away, so back would not equal file. The program tests for a perfect rebuild, so it should say type = "lossless". JPEG is lossy and would damage the text. Text needs lossless compression like ZIP, so the line should be method = "ZIP".

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 6–16) and word search (Modules 6–132).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which statement describes lossless compression?
The original data can be rebuilt exactlySome detail is thrown away for good
Matches
essay.docx -> compress -> 'a few words missing' -> OK
↓
Losing words means this is not lossless. Text must be restored exactly, so lossless compression is needed.
Applying
Meanings
Term
lossless compression
Meaning
Shrinks a file so the exact original data can be rebuilt perfectly, with nothing lost. ZIP and PNG use it. Needed for text and programs.
Practice
original ← "report.txt"
Testing
Gaps
restored ← (compressed)
Check Answer
Spots
1type = "lossy"
2packed = compress(file)

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

The 'African Wild Dog' badge — Savannah 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 statement describes lossless compression?
A. Some detail is thrown away for good
B. The original data can be rebuilt exactly ✓
Lossless means nothing is lost. When you decompress, you get back a perfect copy of the original.
2. You unzip a ZIP file of your English essay. What do you get back?
A. The exact essay, word for word ✓
B. An essay with a few words missing
ZIP uses lossless compression, so every character of the original is restored.
3. Which file format uses lossless compression for images?
A. PNG ✓
B. A format that discards detail to save space
PNG compresses image data without losing any pixels, so the picture can be restored exactly.
4. A program (app) file is compressed before download. Which type of compression must be used?
A. Lossy
B. Lossless ✓
Change even one instruction in a program and it may crash or behave wrongly. Programs need lossless compression.
5. True or false: A lossless file is smaller than the original, so some of its data is gone for good.
A. False - the data is stored more efficiently, not deleted ✓
B. True - smaller files always lose data
Lossless compression shrinks files by finding patterns and redundancy, not by deleting information.

Match the Pairs

report.txt -> report.zip -> report.txt → The file is shrunk into a ZIP and then unzipped to get back the exact original, with nothing lost
photo.bmp -> photo.png → The image file gets smaller but every original pixel can still be restored exactly
Lossless compression is needed for programs, because one missing or changed bit could break them → game.exe -> game.zip -> game.exe
After lossless compression, decompressing gives data identical to the original → original == restored # True
essay.docx -> compress -> 'a few words missing' -> OK → Losing words means this is not lossless. Text must be restored exactly, so lossless compression is needed.
ZIP file -> unzip -> slightly different file → ZIP is lossless, so unzipping must give back the exact original file, not a slightly different one.

Key Term

lossless compression
Shrinks a file so the exact original data can be rebuilt perfectly, with nothing lost. ZIP and PNG use it. Needed for text and programs.

Fill in the Blanks

1. compressed ← compress(original) restored ← decompress(compressed)
Hint: Type the function name that rebuilds the file from its compressed form.
2. restored ← decompress(compressed) IF restored = original THEN OUTPUT "Lossless"
Hint: Type the comparison operator that checks the two copies are identical.
3. IF format = "ZIP" OR format = "PNG" THEN type ← "lossless"
Hint: Type the logic keyword that makes either format count as lossless.
4. needsExact ← TRUE IF needsExact THEN method ← "lossless"
Hint: Type the variable that says whether the data must come back exactly, like text or programs.
5. zipFile ← compress(original) copy ← decompress(zipFile) differences ← 0
Hint: Type the number of differences between the copy and the original when nothing is lost.

Spot the Error

Question 1
A type = "lossy"
B packed = compress(file)
C back = decompress(packed)
D print(back == file)
Line A — Lossy compression throws data away, so back would not equal file. The program tests for a perfect rebuild, so it should say type = "lossless".
Question 2
A file = "essay.txt"
B method = "JPEG"
C lossless = True
D print(file, method)
Line B — JPEG is lossy and would damage the text. Text needs lossless compression like ZIP, so the line should be method = "ZIP".
Question 3
A file = "game.exe"
B needs_exact = False
C if needs_exact:
D use = "lossless"
Line B — A program must be rebuilt exactly or it may stop working. It should be needs_exact = True so that lossless compression is chosen.
Question 4
A format = "JPG"
B lossless = True
C print("No pixels lost")
Line A — JPG is a lossy format, so it does not match lossless = True or the message about no pixels lost. PNG is the lossless image format, so it should be format = "PNG".
Question 5
A original = "AAAAAB"
B packed = compress(original)
C restored = decompress(packed)
D same = restored != original
E print(same)
Line D — With lossless compression the restored data is identical to the original, so the test should use == (equal), not != (not equal).

Student with a class code? Join your class →