Comparing lossy and lossless compression

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

Comparing lossy and lossless compression

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which type of compression lets you restore the original file exactly?
A Lossy compression
B Lossless compression
2. Which type of compression usually gives the smaller file?
A Lossy compression
B Lossless compression
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
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
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

Match the Pairs

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

Left columnRight column
1Lossy compression AMakes the file smaller by permanently removing some data, so the original cannot be restored exactly
2Lossless compression BShrinks the file but keeps all the data, so the original can be restored exactly
3A lossless method: repeated values are stored as a count and a value, and every pixel can be restored CLossy compression usually gives smaller files because it throws data away. Lossless saves less space because it must keep everything.
4A lossy method: the image has fewer pixels, so the file is smaller but the lost detail cannot return DResolution: 1920x1080 -> 960x540
5Lossy compression: all data is kept, so the original can be restored ERLE: WWWWBB -> 4W2B
6Lossless compression always gives a smaller file than lossy compression FThis describes lossless compression. Lossy compression permanently removes data, so the original cannot be restored exactly.

Definitions

lossy vs lossless

Fill in the Blanks

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

1.
method ← "RLE" type ← "________"
2.
method ← "reduce resolution" type ← "_____"
3.
type ← "lossy" restorable ← _____
4.
lossySize ← 2 losslessSize ← 5 OUTPUT lossySize _ losslessSize
5.
original ← "AAAABB" encoded ← "_A2B" decoded ← "AAAABB"

Spot the Error

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

Question 1
A method = 'lossless'
B data_removed = True
C can_restore = False
Question 2
A method = 'lossless'
B data_removed = True
C can_restore = True
Question 3
A IF method = 'lossy' THEN
B OUTPUT 'data removed'
C OUTPUT 'can restore'
D ENDIF
Question 4
A data = 'AAAABBB'
B rle = '4A3B'
C type = 'lossy'
Question 5
A image = 'photo.bmp'
B type = 'lossless'
C method = 'lower resolution'

Answer Key

Comparing lossy and lossless compression
Section A: Quick Questions
Q1
B — Lossless compression
Q2
A — Lossy compression
Q3
A — Lossy, because pixels are removed for good
Q4
A — Lossless, because no data is lost
Q5
B — Lossy removes some data permanently; lossless keeps all of it
Section B: Match the Pairs
Q1
Lossy compression → Makes the file smaller by permanently removing some data, so the original cannot be restored exactly
Q2
Lossless compression → Shrinks the file but keeps all the data, so the original can be restored exactly
Q3
A lossless method: repeated values are stored as a count and a value, and every pixel can be restored → RLE: WWWWBB -> 4W2B
Q4
A lossy method: the image has fewer pixels, so the file is smaller but the lost detail cannot return → Resolution: 1920x1080 -> 960x540
Q5
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.
Q6
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.
Section C: Definitions
Q1
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.
Section D: Fill in the Blanks
Q1
method ← "RLE" type ← "lossless"
Q2
method ← "reduce resolution" type ← "lossy"
Q3
type ← "lossy" restorable ← FALSE
Q4
lossySize ← 2 losslessSize ← 5 OUTPUT lossySize < losslessSize
Q5
original ← "AAAABB" encoded ← "4A2B" decoded ← "AAAABB"
Section E: Spot the Error
Q1
A — Data is removed and cannot be restored, which describes lossy compression. Line 1 should be method = 'lossy'.
Q2
B — Lossless compression keeps all the data, so no data is removed. Line 2 should be data_removed = False.
Q3
C — Lossy compression permanently removes data, so the original cannot be restored. Line 3 should output 'cannot restore'.
Q4
C — Run-length encoding keeps all the data, so the original can be rebuilt exactly. It is lossless, not lossy.
Q5
B — Reducing the resolution throws away pixel detail permanently, so this is lossy compression. Line 2 should be type = 'lossy'.