← ACARA Digital Technologies Years 9–10

Decompressing a file

Reversing compression to turn a compressed file back into usable data. Only lossless decompression restores the exact original; lossy data that was removed is gone for good.

Understanding Decompressing a file in ACARA Digital Technologies Years 9–10

What it does: The comparison is true only for lossless methods, because decompressing exactly reverses the compression. Lossy compression permanently removes data, so the decompressed result differs from the original. Decompression undoes compression so the data can be opened and used. Compression is what makes files smaller. Lossless decompression must give back every character, otherwise the text would be corrupted. Compressed data is stored in a shortened form. Decompression turns it back into the normal form that programs can open.

Common mistakes: Only lossless decompression gives back an exact copy of the original. With a lossy method the program would not print "Exact copy". Line 1 should be method ← "lossless". Unzipping a ZIP file is decompression, which reverses compression. Calling compress() would shrink the file again. It should be files ← unzip(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 155–225) and word search (Modules 116–225).

Take this worksheet further — free with Cloodit

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

Learning
Duo
What does decompression do to a compressed file?
Makes the file smaller againReverses compression to make the file usable again
Matches
Open photo.jpg to get the exact original back
↓
JPG is lossy, so opening or decompressing it cannot restore the exact original. The removed detail is gone for good.
Applying
Meanings
Term
decompression
Meaning
Reversing compression to turn a compressed file back into usable data. Only lossless decompression restores the exact original; lossy data that was removed is gone for good.
Practice
zipFile ← "photos.zip"
Testing
Gaps
z.("photos")
Check Answer
Spots
1method ← "lossy"
2restored ← decompress(zip)

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

The 'Giraffe' badge — High Perspective, 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. What does decompression do to a compressed file?
A. Makes the file smaller again
B. Reverses compression to make the file usable again ✓
Decompression undoes compression so the data can be opened and used. Compression is what makes files smaller.
2. You unzip a ZIP file of your Year 10 assignment. What do you get back?
A. The exact original files ✓
B. Lower quality copies of the files
ZIP uses lossless compression, so unzipping restores every bit of the original data.
3. Which type of compression can be fully reversed by decompression?
A. Lossy compression
B. Lossless compression ✓
Lossless compression keeps all the data, so decompression can rebuild the exact original. Lossy compression throws data away.
4. You save a photo as a low quality JPEG, then open it again. Can you get the original detail back?
A. No, the removed detail is gone for good ✓
B. Yes, decompressing brings back all the detail
JPEG is lossy. The data that was removed was permanently deleted, so decompression cannot restore it.
5. Which is true about decompressing a lossy file?
A. It only rebuilds an approximation of the original ✓
B. It rebuilds a perfect copy of the original
A lossy file can be played or viewed again, but it is only close to the original because some data was discarded.

Match the Pairs

unzip photos.zip → Decompresses a ZIP archive so the original files are restored exactly, because ZIP is lossless
decompress(song.mp3) → Turns the MP3 back into playable sound, but the detail removed when it was made is not restored
Lossless decompression gives back a file identical to the original → original == decompress(compress(original))
A lossy file cannot be restored to the original after decompression → original != decompress(compress_lossy(original))
Open photo.jpg to get the exact original back → JPG is lossy, so opening or decompressing it cannot restore the exact original. The removed detail is gone for good.
A ZIP file must be used without unzipping → A ZIP file must be unzipped (decompressed) first to get usable files back. Unzipping restores the originals exactly.

Key Term

decompression
Reversing compression to turn a compressed file back into usable data. Only lossless decompression restores the exact original; lossy data that was removed is gone for good.

Fill in the Blanks

1. import zipfile z = zipfile.ZipFile("photos.zip") z.extractall("photos")
Hint: Type the method name that unpacks every file from the ZIP archive into a folder.
2. letter = "A" count = 5 decoded = letter * count
Hint: Type the operator that repeats a string a number of times, which decodes run-length data.
3. original = "AAAABBB" restored = decompress(compress(original)) print(original == restored)
Hint: Type the comparison operator that checks if two values are equal. It is True for lossless compression.
4. method = "lossless" if method == "lossless": print("Exact original restored")
Hint: Type the keyword that starts a decision based on a condition.
5. original = "AAAAABB" packed = compress(original) restored = decompress(packed)
Hint: Type the function name that reverses compress and turns packed data back into usable data.

Spot the Error

Question 1
A method ← "lossy"
B restored ← decompress(zip)
C IF restored = original THEN
D OUTPUT "Exact copy"
E ENDIF
Line A — Only lossless decompression gives back an exact copy of the original. With a lossy method the program would not print "Exact copy". Line 1 should be method ← "lossless".
Question 2
A zip ← "report.zip"
B files ← compress(zip)
C OUTPUT files
Line B — Unzipping a ZIP file is decompression, which reverses compression. Calling compress() would shrink the file again. It should be files ← unzip(zip).
Question 3
A file ← "holiday.jpg"
B type ← "lossy"
C OUTPUT "Original restored"
Line C — A lossy file like a JPEG has had data permanently removed, so decompression cannot restore the original. The output should say the original cannot return.
Question 4
A IF method = "lossy" THEN
B OUTPUT "Exact original"
C ELSE
D OUTPUT "Data lost for good"
E ENDIF
Line A — The exact original is only restored when the method is lossless. The condition should test method = "lossless". Otherwise the messages are the wrong way round.
Question 5
A zip ← "essay.zip"
B essay ← unzip(zip)
C OPEN zip
Line C — The ZIP file is still compressed, so it is not usable data yet. After decompressing, the program should open the extracted file: OPEN essay.

Student with a class code? Join your class →