JPEG is usually:
Q1Explanation: JPEG drops detail for size.
AP Computer Science Principles · Unit 2 · Data
Unit 2 · Formats · ~8 min read
Pick PNG, JPEG, ZIP, or MP3 with AP-ready reasoning—perfect rebuild vs smaller files with acceptable loss.
Lossless compression restores every original bit; lossy compression removes detail for much smaller files. AP CSP asks you to match PNG, JPEG, ZIP, and MP3 to scenarios based on content, risk, and bandwidth. Name what is stored, whether any bit change matters, and why smaller size is worth tradeoffs for photos, music, or code archives.
Lossless compression restores every original bit; lossy compression removes detail for much smaller files. AP CSP asks you to match PNG, JPEG, ZIP, and MP3 to scenarios based on content, risk, and bandwidth. Name what is stored, whether any bit change matters, and why smaller size is worth tradeoffs for photos, music, or code archives.
Choose lossless when any change to a bit would matter—source code, tax forms, medical measurements, or UI screenshots with crisp text. ZIP archives for Create Task submissions are everyday lossless examples.
PNG preserves exact pixels, which helps diagrams and slides. FLAC keeps full audio for music editing, though file sizes stay large compared with MP3.
Lossless does not always mean tiny. Highly random data may shrink only a little, yet the rebuild stays perfect.
| Format | Type | Typical use |
|---|---|---|
| ZIP / GZIP | Lossless | Project folders, logs |
| PNG | Lossless | Screenshots, graphics |
| FLAC | Lossless | Audio masters |
Compare with compression ratios and RLE in the same unit.
Lossy formats target human perception. JPEG drops fine color detail in photos; MP3 removes frequencies many listeners cannot hear. Streaming a concert clip over school Wi-Fi is realistic because of lossy codecs.
A music app on your phone stores thousands of songs precisely because lossy compression shrinks each track. The trade is quality versus storage—acceptable for playlists, unacceptable for legal evidence photos.
Re-saving the same JPEG many times compounds artifacts. For class posters, export once at sensible quality instead of repeatedly screenshotting screenshots.
Compare with image bit depth in the same unit.
Strong answers name three pieces: content type, risk if bits change, and storage or bandwidth pressure. Example: “Yearbook photos can be JPEG because small color errors are invisible at print size, and files must fit on a shared drive.”
Weak answers only say “JPEG is smaller.” Add why the loss is acceptable or why it is not.
Create Task write-ups can mention compression when describing large data files. Connecting user impact to format choice shows the computational thinking AP lists in the rubric.
Compare with compression ratio math from the data-compression guide when stems include numbers.
Compare with photo metadata risks in the same unit.
Artifacts are visible or audible glitches from aggressive lossy settings—blocky JPEG skies, muddy MP3 cymbals, or rainbow bands around text in photos saved as JPEG.
Zoom into a highly compressed campus photo and you will see 8×8 blocks; that pattern is evidence of lossy algorithms cutting corners for size.
Artifacts differ from random noise. Noise exists in the original scene; artifacts appear only after compression.
Keywords like legal, medical, text, checksum, or exact pixels point lossless. Words like streaming, playlist, photo library, or satellite time-lapse point lossy.
If two answers are both lossy, pick the one matching the media type—JPEG for still photos, MP3 for music.
Explain in writing responses even when MCQs only demand a letter—practice sentences now so FRQ-style prompts feel familiar.
Work the eight MCQs here, then cross-study metadata when stems mention EXIF or location tags on photos.
Tap an answer to reveal the explanation. Choices shuffle on load. For a full mixed set, open 50 Unit 2 practice questions.
JPEG is usually:
Q1Explanation: JPEG drops detail for size.
Legal contract scan should use:
Q2Explanation: Text integrity needs lossless.
MP3 audio compression is:
Q3Explanation: MP3 removes inaudible frequencies.
PNG screenshots are typically:
Q4Explanation: PNG preserves exact pixels.
Satellite photos every 30s likely use:
Q5Explanation: Volume favors lossy imagery.
Lossy choice when:
Q6Explanation: Photos tolerate small loss.
Visible blockiness after saving indicates:
Q7Explanation: Artifacts come from aggressive lossy.
FLAC audio is:
Q8Explanation: FLAC keeps full audio data.
Check each skill when you can explain it without looking at notes.
0 of 4 ready
Lossless compression preserves every bit of the original file after decompression. Lossy compression removes some information permanently to achieve much smaller sizes. You cannot recover discarded lossy detail by decompressing again. AP items test whether you know which situation tolerates that permanent loss.
JPEG is lossy, designed for photographs where small color changes are hard to notice. It is a poor choice for text screenshots or UI assets with sharp edges because artifacts blur letters. PNG is usually better when exact pixels matter.
Choose PNG when you need exact pixels: logos, diagrams, screenshots with text, or images that will be edited repeatedly. Choose JPEG when you are sharing photos where file size matters more than perfect pixels. State the user goal in your answer so the grader sees content-aware reasoning.
ZIP is lossless for the files inside the archive. Extracting restores the same bytes you compressed, which is why software distributions and homework submissions use ZIP. Do not confuse ZIP with image codecs inside the archive—each inner file still has its own format.
MP3 removes sound details judged less audible to human ears. The result is far smaller than raw audio waveforms. Audiophiles may prefer lossless FLAC, but streaming platforms overwhelmingly use lossy codecs for bandwidth. Exam scenarios about music sharing usually accept that tradeoff.
Artifacts are visible or audible flaws from aggressive lossy settings—blocky JPEG regions, ringing around edges, or muddy music. They appear when compression is pushed too hard or a file is re-saved many times. Mentioning artifacts shows you understand that lossy is not free savings.
No. Already compressed or encrypted files may not get smaller and can grow slightly due to headers. Lossless algorithms need patterns like repeated text or empty space. If a stem describes encrypted ciphertext, expect poor compression gains.
Sentence one: name the content (medical scan, pop song, contract PDF). Sentence two: tie tolerance for error to lossless or lossy and name a format. That structure mirrors how AP written prompts score clarity without needing brand slogans.
Lossless choices such as PNG or TIFF for images, or ZIP for bundles of PDFs, keep every pixel of a signature or stamp intact. Lossy scans could alter fine lines and create legal doubt. Exams use that context to push lossless answers.
They memorize format names without scenarios, pick JPEG for text screenshots, or assume bigger file size always means lossless quality. Practice eight MCQs here, then explain aloud why a yearbook photo and a geometry diagram need different formats. Speaking the reasoning cements the distinction better than flashcards alone.