Data Representation CS Thinking Example 4
Follow the full solution, then compare it with the other examples linked below.
Example 4
hardExplain the difference between lossless and lossy compression. Give an example of each and explain when you would choose one over the other.
Solution
- 1 Step 1: Lossless compression reduces file size without losing any data — the original can be perfectly reconstructed. Example: PNG for images, ZIP for files.
- 2 Step 2: Lossy compression achieves smaller files by permanently removing some data that is considered less important. Example: JPEG for images, MP3 for audio.
- 3 Step 3: Choose lossless when accuracy is critical (medical images, source code). Choose lossy when smaller size matters more and slight quality loss is acceptable (streaming music, web photos).
Answer
Lossless: no data lost (PNG, ZIP). Lossy: some data removed for smaller size (JPEG, MP3). Choose based on whether quality or size is more important.
Compression is essential for efficient storage and transmission. Understanding the trade-off between file size and data quality is important for choosing appropriate formats.
About Data Representation
The way information—numbers, text, images, and sound—is encoded as binary digits (0s and 1s) inside a computer. Different encoding schemes map real-world data to binary patterns, such as ASCII/Unicode for text, RGB for colors, and sampling for audio.
Learn more about Data Representation →More Data Representation Examples
Example 1 easy
A computer stores the character 'A' as the number 65 (ASCII). Explain why computers use numbers to r
Example 2 mediumExplain how a computer represents a colour image using binary. What are pixels and colour depth?
Example 3 mediumSound is analogue but computers are digital. Describe how analogue sound is converted to digital for