AP CSP Day 16: Data Compression

Key Concepts

Data compression reduces file size by encoding information more efficiently. Lossless compression preserves all original data and allows exact reconstruction, while lossy compression permanently discards some data to achieve greater size reduction. AP CSP exam questions distinguish between lossless formats (like PNG or ZIP) and lossy formats (like JPEG or MP3) and ask students to identify tradeoffs between file size and data fidelity. Understanding when each type is appropriate is a key testable concept in Big Idea 2.

📚 Study the Concept First (Optional) Click to expand ▼

Data Compression: Lossless vs. Lossy

Why Compress Data?

Compression reduces file sizes for faster transmission and less storage use. A 4K video file uncompressed would be terabytes; compressed, it fits on a phone. The tradeoff is computation time to compress and decompress.

Two Types

Lossless compression preserves every bit of original data and allows perfect reconstruction. ZIP files and PNG images use lossless compression. Lossy compression permanently discards some data to achieve greater size reduction. JPEG images and MP3 audio use lossy compression.

Common Trap: Applying lossy compression multiple times to the same file. Each round of lossy compression discards more data, degrading quality progressively. Lossless compression can be applied repeatedly without any degradation.
Exam Tip: Match the compression type to the use case. Medical images must be lossless (no data loss acceptable). Streaming music can tolerate lossy compression. The AP exam often asks you to justify which type is appropriate.
Big Idea 2: Data
Cycle 1 • Day 16 Practice • Medium Difficulty
Focus: Data Compression

Practice Question

A music streaming service offers songs in two formats: one uses lossy compression and the other uses lossless compression. Which of the following statements is true?

Why This Answer?

Lossless compression reduces file size by finding patterns and redundancies, but it preserves all original data. When decompressed, the output is identical to the original. Lossy compression permanently removes some data to achieve even smaller sizes.

Why Not the Others?

B) Lossy files are smaller, not larger, because data is permanently removed. C) Lossy compression does permanently remove data — that is the defining characteristic of "lossy." D) Lossy compression produces significantly smaller files than lossless for the same content.

Common Mistake
Watch Out!

Students mix up which type permanently removes data. Remember: lossy = loss of data (smaller file, imperfect quality). Lossless = no loss (larger file, perfect reconstruction).

AP Exam Tip

The word "lossy" contains "loss" — data is lost permanently. Lossless means zero loss. Use this mnemonic to keep them straight on the exam.

Keep Practicing!

Consistent daily practice is the key to AP CSP success.

AP CSP Resources Get 1-on-1 Help
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.