Home

Tutoring

Subjects

Live Classes

Study Coach

Essay Review

On-Demand Courses

Colleges

Games


Sign up

Log in

Opening subject page...

Loading your content

Practice

  • All Subjects
  • Algebra Flashcards
  • SAT Math Practice Tests
  • Math Question of the Day
  • Live Classes
  • On-Demand Courses

Varsity Tutors

  • Find a Tutor
  • Test Prep
  • Online Classes
  • K-12 Learning
  • College Search
  • VarsityTutors.com

© 2026 Varsity Tutors. All rights reserved.

← Back to quizzes

AP Computer Science Principles Quiz

AP Computer Science Principles Quiz: Data Compression

Practice Data Compression in AP Computer Science Principles with focused quiz questions that help you check what you know, review explanations, and build confidence with test-style prompts.

Question 1 / 20

0 of 20 answered

Read the passage. In a streaming service, compression shrinks data so videos load quickly and use less bandwidth. The text explains that lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files. For digital media, JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames. This creates a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts. In contrast, text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning. Based on the text, why is lossy compression preferred in streaming video?

Select an answer to continue

What this quiz covers

This quiz focuses on Data Compression, giving you a quick way to practice the rules, question types, and explanations that matter most for AP Computer Science Principles.

How to use this quiz

Try each quiz question before looking at the correct answer. Use the explanations to review missed ideas, then come back to similar questions until the pattern feels familiar.

All questions

Question 1

Read the passage. In a streaming service, compression shrinks data so videos load quickly and use less bandwidth. The text explains that lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files. For digital media, JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames. This creates a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts. In contrast, text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning. Based on the text, why is lossy compression preferred in streaming video?

  1. It keeps every pixel identical while using more bandwidth.
  2. It reduces data enough for smooth delivery, accepting some quality loss. (correct answer)
  3. It replaces repeated words to make subtitles smaller.
  4. It prevents any artifacts by storing uncompressed frames.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically why lossy compression is preferred for streaming video applications. Data compression in streaming contexts must balance file size, bandwidth usage, and acceptable quality levels, with lossy compression offering the best compromise for real-time delivery. The passage explains that compression 'shrinks data so videos load quickly and use less bandwidth' and that the trade-off of 'smaller files and smoother streaming versus potential blur or blocky artifacts' is acceptable for streaming. Choice B is correct because it captures this essential balance: lossy compression reduces data sufficiently for smooth delivery over limited bandwidth while accepting some quality degradation. Choice A is incorrect because lossy compression reduces bandwidth usage rather than increasing it, and Choice D contradicts the passage's mention of potential artifacts. To help students: Discuss real-world bandwidth limitations and how they necessitate compression. Use examples of streaming services that offer different quality settings based on available bandwidth.

Question 2

Read the passage. A media company publishes articles, photos, and videos and uses different compression methods depending on content. Compression reduces the number of bits needed by encoding patterns more efficiently, helping files download faster and cost less to store. Lossless compression preserves exact data and is favored for text, where accuracy matters, while lossy compression discards some information to achieve smaller files and is common for images and video. Huffman coding and LZW are lossless techniques often used for text or general data, while JPEG is a popular lossy format for still images. MPEG is widely used for video compression, often balancing quality against file size. Selecting the right method depends on whether perfect fidelity or smaller size is the priority.

Based on the text, how does Huffman coding differ from JPEG compression?

  1. Huffman is lossless for symbols; JPEG is lossy for images. (correct answer)
  2. Huffman is a video standard; JPEG compresses text files.
  3. Huffman discards details; JPEG preserves every original bit.
  4. Huffman increases size; JPEG always eliminates artifacts entirely.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically comparing the fundamental differences between Huffman coding and JPEG compression. Data compression uses different methods for different content types, with Huffman coding being a lossless technique for text and symbols, while JPEG is a lossy format designed specifically for images. In the provided passage, Huffman coding is described as a 'lossless technique often used for text,' while JPEG is identified as 'a popular lossy format for still images.' Choice A is correct because it accurately captures this fundamental distinction: Huffman is lossless and works with symbols/text, while JPEG is lossy and designed for images, as explicitly stated in the passage. Choice C is incorrect because it reverses their characteristics - Huffman preserves data (lossless) while JPEG discards details (lossy). To help students: Create comparison tables showing compression methods grouped by lossless vs. lossy and their typical applications. Emphasize that the choice of compression method depends on both the content type and whether perfect accuracy is required.

Question 3

An email client offers the user a choice when attaching a photo: send as 'Actual Size' or 'Small'. The 'Small' option results in a much faster email delivery. This functionality is most likely implemented using which of the following techniques?

  1. The 'Actual Size' option uses lossy compression, while the 'Small' option uses lossless compression.
  2. The 'Actual Size' option sends the photo uncompressed, while the 'Small' option applies lossy compression. (correct answer)
  3. The 'Actual Size' option uses a single network packet, while the 'Small' option uses multiple packets.
  4. The 'Actual Size' option uses a secure, encrypted connection, while the 'Small' option does not.

Explanation: The 'Small' option prioritizes file size and transmission speed, which is the primary use case for lossy compression. It reduces the image data at the cost of some quality. The 'Actual Size' option preserves the original file, which would be sent uncompressed or with lossless compression to maintain full quality.

Question 4

Which of the following is guaranteed when using a lossless data compression algorithm?

  1. The compressed file will always be at least 50 percent smaller than the original file.
  2. The time required to compress the file will be less than the time required to decompress it.
  3. The compressed file can be used by applications without needing to be decompressed first.
  4. The original data can be restored in its entirety from the compressed data without any loss. (correct answer)

Explanation: The defining feature and guarantee of any lossless compression algorithm is perfect fidelity. The decompression process is able to reconstruct the original data stream perfectly, bit for bit, from the compressed version.

Question 5

Which of the following statements best describes a significant trade-off of using lossy compression?

  1. In exchange for a smaller file size, some amount of the original data is permanently discarded. (correct answer)
  2. The process is always reversible, but it requires special software to decompress the file to its original state.
  3. It can only be applied to text data, making it unsuitable for multimedia files like images and videos.
  4. It typically results in a larger file than the original, but the data can be transmitted much more quickly.

Explanation: The core trade-off of lossy compression is quality for size. To achieve a smaller file size than what is typically possible with lossless methods, some of the original information is permanently removed. This trade-off is often acceptable for media files where the loss is not easily perceived.

Question 6

Why is data compression a useful technique when sending information over the Internet?

  1. Compression increases the security of the data by adding a layer of encryption that is difficult to break.
  2. Compression reduces the number of bits that need to be transmitted, which can decrease download and upload times. (correct answer)
  3. Compression automatically corrects any errors that occur during transmission, ensuring data integrity.
  4. Compression increases the resolution of images and the quality of audio files for the recipient.

Explanation: The primary benefit of compression for data transmission is efficiency. By making the file size smaller, fewer bits need to be sent across the network, which reduces the time it takes to transfer the data and consumes less bandwidth.

Question 7

A video streaming service prioritizes providing a smooth, uninterrupted playback experience for its users, who have a wide range of Internet connection speeds. Which compression strategy best supports this goal?

  1. Lossless compression, to ensure that every frame of the video is delivered with perfect quality, which is the most important factor for viewer satisfaction.
  2. Lossy compression, because it can significantly reduce the amount of data needed for streaming, preventing buffering even at the cost of some visual detail. (correct answer)
  3. Sending the video uncompressed, to eliminate any processing delay from decompressing the video on the user's device and ensure immediate playback.
  4. A hybrid approach where the video is compressed losslessly but the audio is compressed with a lossy algorithm to balance file size and quality.

Explanation: Streaming services use lossy compression to manage bandwidth constraints. By reducing the file size significantly, the video can be streamed smoothly over various internet speeds. The trade-off is a slight, often imperceptible, loss in quality, which is acceptable for the goal of avoiding buffering.

Question 8

An e-commerce website displays small thumbnail images of products in its catalog. To ensure the catalog page loads as quickly as possible, which is the most appropriate strategy for handling these thumbnails?

  1. Use lossy compression, because a small reduction in the quality of a thumbnail is an acceptable trade-off for faster page loading. (correct answer)
  2. Use lossless compression, because it is essential that the thumbnail image is a perfect representation of the product.
  3. Do not use any compression, to avoid putting extra processing load on the web server which could slow down the site.
  4. Store the thumbnails in a text-based format, as text compresses better than image data and will result in faster load times.

Explanation: For preview images like thumbnails, the primary goal is fast delivery. A slight loss of quality is generally unnoticeable at such a small size and is a worthwhile trade-off for the significant reduction in file size and consequently faster page load times, which improves user experience.

Question 9

Which statement accurately describes a key characteristic of lossy compression?

  1. It is a fully reversible process, meaning the original data can always be perfectly restored after decompression.
  2. It is an irreversible process because the compression algorithm permanently removes some of the original data. (correct answer)
  3. It is most effective on data with high redundancy, such as plain text documents with repeated words.
  4. It typically results in a compressed file that is larger than the original but is optimized for faster network transfer.

Explanation: The core principle of lossy compression is the permanent removal of data. This makes the process irreversible; once the data is discarded to reduce file size, it cannot be recovered. This is in direct contrast to lossless compression, which is a reversible process.

Question 10

Read the passage. A cloud platform stores millions of customer documents and wants to reduce storage costs without changing any file contents. Data compression helps by representing repeated patterns more efficiently, lowering the number of bits needed to store data. Lossless compression is used when exact recovery matters, such as for text files, code, and spreadsheets, while lossy compression is common for media where small imperfections are acceptable. LZW is a lossless algorithm that builds a dictionary of repeated sequences and substitutes short codes, which can be effective when the same phrases or patterns appear many times. Huffman coding is also lossless, using shorter bit patterns for more frequent symbols. JPEG and MPEG, by contrast, are typically lossy and focus on shrinking images and video.

Which scenario best demonstrates the use of LZW compression?

  1. Compressing repetitive server logs without altering any characters. (correct answer)
  2. Shrinking a photo by discarding subtle visual details.
  3. Reducing video size by predicting changes between frames.
  4. Improving audio clarity by adding extra data to the stream.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically identifying appropriate use cases for LZW compression. Data compression reduces file sizes by finding and encoding patterns, with LZW being a lossless method that builds a dictionary of repeated sequences and replaces them with shorter codes. In the provided passage, LZW is described as 'a lossless algorithm that builds a dictionary of repeated sequences and substitutes short codes, which can be effective when the same phrases or patterns appear many times.' Choice A is correct because server logs typically contain repetitive patterns (timestamps, IP addresses, error messages) that LZW can compress effectively without altering any characters, matching the lossless requirement. Choice B is incorrect because it describes lossy compression (discarding visual details), while LZW is explicitly lossless. To help students: Provide examples of repetitive data (logs, source code, structured documents) where LZW excels. Emphasize that LZW's dictionary approach works best with repeated patterns.

Question 11

Read the passage. In digital photography, compression makes it easy to store thousands of images on a phone and share them quickly online. Compression reduces file size by encoding information more efficiently, and it can be either lossless or lossy. Lossless methods keep every original detail and are important for text and certain data files, while lossy methods remove some information to achieve smaller sizes. JPEG is a common lossy image format that discards subtle visual details, which usually looks fine but can create artifacts at high compression levels. Huffman coding and LZW are examples of lossless algorithms that often appear in text or general-purpose compression. MPEG is commonly associated with video rather than still images.

Which scenario best demonstrates the use of JPEG compression?

  1. Saving a photo in a smaller file by losing some detail. (correct answer)
  2. Compressing source code so every character remains identical.
  3. Reducing a video by predicting changes between frames.
  4. Encoding frequent letters with shorter codes in a text file.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically identifying appropriate use cases for JPEG compression. Data compression reduces file sizes, with JPEG being a lossy compression format specifically designed for still images that achieves smaller files by discarding subtle visual details. In the provided passage, JPEG is described as 'a common lossy image format that discards subtle visual details' used in digital photography to make it 'easy to store thousands of images on a phone and share them quickly online.' Choice A is correct because it accurately describes JPEG's use case: saving a photo in a smaller file by losing some detail, which directly matches the passage's description of JPEG's lossy nature. Choice C is incorrect because it describes video compression techniques (frame prediction), while JPEG is specifically for still images as stated in the passage. To help students: Clarify the distinction between image compression (JPEG) and video compression (MPEG). Use visual examples showing the effects of different JPEG compression levels on image quality.

Question 12

Read the passage. Streaming services rely on compression to deliver content efficiently across networks with varying speeds. Compression reduces the number of bits sent, which can prevent buffering and lower data usage. Lossless compression preserves exact data and is common for text like subtitles, while lossy compression is common for images and video because it can shrink files much more by discarding information viewers are less likely to notice. JPEG is a familiar lossy format for still images, and MPEG is widely used for video, often combining multiple strategies to reduce size. The main challenge is balancing smaller files against visible artifacts or reduced clarity. Services tune compression levels to maintain acceptable quality while keeping playback smooth.

Why is lossy compression preferred in many streaming video applications?

  1. It achieves much smaller files, with tolerable quality loss. (correct answer)
  2. It ensures every frame is restored with perfect accuracy.
  3. It is required for subtitles because text can change safely.
  4. It works by assigning shorter codes to frequent letters only.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically why lossy compression is preferred for streaming video applications. Data compression reduces file sizes to enable efficient streaming, with lossy compression achieving much greater reduction by removing information viewers are unlikely to notice. In the provided passage, lossy compression for video is described as being able to 'shrink files much more by discarding information viewers are less likely to notice,' with the key benefit being prevention of buffering and smooth playback. Choice A is correct because it captures the essential trade-off: achieving much smaller files (enabling smooth streaming) with tolerable quality loss, as stated in the passage's discussion of balancing file size against artifacts. Choice B is incorrect because it describes lossless compression - the passage clearly states lossy compression discards information. To help students: Discuss real-world streaming constraints like bandwidth limitations and why perfect quality isn't always necessary. Use examples of quality settings in streaming platforms to illustrate the compression trade-offs.

Question 13

Read the passage. In a streaming service, compression shrinks data so videos load quickly and use less bandwidth. The text explains that lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files. For digital media, JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames. This creates a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts. In contrast, text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning. Based on the text, how does MPEG differ from JPEG?

  1. MPEG targets video; JPEG targets still images. (correct answer)
  2. MPEG is lossless text coding; JPEG is lossless for programs.
  3. MPEG assigns short codes to letters; JPEG repeats words.
  4. MPEG increases file size; JPEG always preserves perfect quality.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically differentiating between MPEG and JPEG compression standards. Data compression standards are optimized for different types of media, with JPEG designed for still images and MPEG for video sequences that can exploit temporal redundancy. The passage clearly distinguishes these: 'JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames.' Choice A is correct because it accurately identifies the fundamental difference: MPEG is designed for video compression (exploiting similarities across frames), while JPEG is designed for still image compression. Choice B incorrectly identifies both as lossless methods when the passage clearly describes them as lossy, and Choice D makes false claims about file size increases. To help students: Create visual diagrams showing how JPEG works on single images versus how MPEG exploits redundancy across video frames. Emphasize that both are lossy but optimized for different media types.

Question 14

Read the passage. In a streaming service, compression shrinks data so videos load quickly and use less bandwidth. The text explains that lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files. For digital media, JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames. This creates a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts. In contrast, text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning. Based on the text, which scenario best demonstrates the use of LZW compression?

  1. Shrinking a text document while keeping every character unchanged. (correct answer)
  2. Reducing video size by removing repeated frames across time.
  3. Making photos smaller by permanently discarding fine color detail.
  4. Improving internet speed by compressing wireless signals themselves.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically identifying appropriate applications for LZW lossless compression. Data compression methods must match the requirements of the data type, with LZW being a lossless algorithm particularly suited for text where data integrity is paramount. The passage groups LZW with Huffman coding as lossless methods used for 'text and program files...since even a missing character can change meaning,' emphasizing its ability to compress while preserving every character. Choice A is correct because it describes the ideal LZW scenario: shrinking a text document (achieving compression) while keeping every character unchanged (maintaining lossless integrity). Choice B describes video compression with temporal redundancy (MPEG territory), and Choice C describes lossy compression that permanently discards data. To help students: Explain how LZW builds a dictionary of repeated patterns to achieve compression without data loss. Practice identifying which scenarios require lossless compression based on the consequences of data alteration.

Question 15

Read the passage. In a streaming service, compression shrinks data so videos load quickly and use less bandwidth. The text explains that lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files. For digital media, JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames. This creates a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts. In contrast, text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning. Based on the text, what trade-offs are involved in using MPEG?

  1. It increases file size to guarantee perfect video accuracy.
  2. It reduces file size but may lower visual quality. (correct answer)
  3. It preserves every frame exactly with no bandwidth cost.
  4. It mainly compresses text by replacing repeated words.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically the trade-offs involved in lossy compression methods like MPEG. Data compression reduces file sizes through various methods, with lossy compression achieving smaller sizes by permanently removing some data that is deemed less important or noticeable. The passage specifically states that MPEG 'reduces repeated or less-noticeable visual information across frames' and creates 'a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts.' Choice B is correct because it accurately captures this trade-off - MPEG reduces file size (enabling smoother streaming) but may lower visual quality (through blur or artifacts). Choice A is incorrect because MPEG decreases, not increases, file size, and Choice C falsely claims no bandwidth cost when the passage emphasizes bandwidth savings. To help students: Focus on identifying key phrases about trade-offs in compression contexts. Practice recognizing that lossy compression always involves sacrificing some quality for efficiency gains.

Question 16

Read the passage. In a streaming-service setting, data compression reduces the number of bits needed to store or transmit information. Compression works by finding patterns and representing them more efficiently, which helps platforms deliver movies, music, and captions quickly over limited bandwidth. Two broad categories appear: lossless compression preserves every original detail so the decompressed data matches exactly, while lossy compression removes some information to achieve smaller files. For text such as subtitles and chat logs, lossless methods are common because even a small change can alter meaning; Huffman coding assigns shorter bit patterns to frequent symbols, and LZW replaces repeated sequences with short codes. For images and video, lossy methods often dominate because the human eye tolerates small changes; JPEG compresses still images by discarding subtle visual details, and MPEG compresses video by combining spatial compression with frame-to-frame prediction. The trade-off is constant: stronger compression usually means smaller files but more noticeable artifacts, so services adjust settings to balance quality and smooth playback.

Based on the text, what trade-offs are involved in using JPEG compression?

  1. It reduces file size but may introduce visible artifacts. (correct answer)
  2. It preserves every pixel while greatly shrinking files.
  3. It replaces repeated words with codes for perfect text accuracy.
  4. It increases file size to prevent any streaming delays.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically the trade-offs involved in lossy compression methods like JPEG. Data compression reduces file sizes by removing redundant information, with lossy compression achieving greater reduction by permanently discarding some data that may not be noticeable to users. In the provided passage, JPEG compression is described as discarding 'subtle visual details' to compress still images, while noting that 'stronger compression usually means smaller files but more noticeable artifacts.' Choice A is correct because it accurately captures both aspects of the JPEG trade-off: reduced file size (benefit) and potential visible artifacts (cost) as stated in the passage. Choice B is incorrect because it contradicts the lossy nature of JPEG - the passage clearly states JPEG 'discards subtle visual details,' not preserving every pixel. To help students: Focus on identifying key terms like 'trade-off' and 'artifacts' in compression contexts. Practice distinguishing between the benefits (smaller files) and costs (quality loss) of different compression methods.

Question 17

Read the passage. In digital media, compression makes it practical to store and share large photos and videos. The basic idea is to reduce the number of bits needed by using patterns and by removing information that people are unlikely to notice. Lossless compression keeps every detail, which is critical for text and some data files, while lossy compression trades perfect accuracy for smaller size. JPEG is a widely used lossy image format that discards subtle visual information to shrink photos, and MPEG is a family of video formats that compresses moving images by combining within-frame compression with prediction across frames. These approaches enable fast downloads and smooth playback, but aggressive settings can create blockiness, blurring, or other artifacts. Choosing a compression level therefore involves balancing file size, network speed, and acceptable quality.

Based on the text, what is the primary benefit of using MPEG compression?

  1. It reduces video file size for easier storage and streaming. (correct answer)
  2. It guarantees perfect recovery of every original video frame.
  3. It replaces repeated words in text using a dictionary.
  4. It increases resolution so videos look sharper after compression.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically the benefits of lossy compression methods like MPEG for video files. Data compression reduces file sizes, with lossy methods like MPEG achieving significant reduction by removing information that viewers are unlikely to notice, making video storage and streaming practical. In the provided passage, MPEG is described as 'a family of video formats that compresses moving images' which 'enable fast downloads and smooth playback.' Choice A is correct because it accurately identifies the primary benefit: reducing video file size for easier storage and streaming, as explicitly stated in the passage's discussion of how compression makes it 'practical to store and share large photos and videos.' Choice B is incorrect because it describes lossless compression - MPEG is lossy and does not guarantee perfect recovery of every frame. To help students: Emphasize the practical benefits of lossy compression for media files where perfect accuracy isn't required. Use examples of streaming services to illustrate why smaller file sizes are crucial for smooth playback.

Question 18

Read the passage. In a streaming service, compression shrinks data so videos load quickly and use less bandwidth. The text explains that lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files. For digital media, JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames. This creates a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts. In contrast, text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning. Based on the text, what is the primary benefit of using lossless compression for text?

  1. It guarantees smaller files by deleting extra letters.
  2. It preserves exact content while still reducing file size. (correct answer)
  3. It improves photo sharpness by removing subtle color detail.
  4. It converts text into video frames for faster streaming.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically why lossless compression is essential for text data. Data compression methods must be chosen based on the nature of the data and the consequences of data loss, with text requiring perfect preservation since even minor changes can alter meaning. The passage emphasizes that 'text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning.' Choice B is correct because it identifies the primary benefit: preserving exact content (no missing characters) while still achieving file size reduction through pattern recognition and encoding. Choice A is incorrect because lossless compression doesn't delete any letters - that would be lossy compression, which would corrupt text files. To help students: Use concrete examples showing how a single changed character in text or code can completely alter functionality. Practice identifying which data types require perfect preservation versus those that can tolerate some loss.

Question 19

Read the passage. In a streaming service, compression shrinks data so videos load quickly and use less bandwidth. The text explains that lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files. For digital media, JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames. This creates a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts. In contrast, text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning. Based on the text, how does lossy compression differ from lossless compression?

  1. Lossy removes some details; lossless preserves all information. (correct answer)
  2. Lossy always enlarges files; lossless always shrinks them.
  3. Lossy is used only for text; lossless is used only for video.
  4. Lossy uses Huffman; lossless is the same as JPEG.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically differentiating between lossless and lossy compression methods. Data compression can be categorized into two main types: lossless compression, which preserves all original data and allows perfect reconstruction, and lossy compression, which permanently removes some data to achieve greater compression ratios. The passage explicitly states that 'lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files.' Choice A is correct because it directly reflects this fundamental distinction between the two compression types. Choice B is incorrect because it reverses the typical outcomes - lossy compression generally achieves smaller files than lossless, and Choice C incorrectly assigns specific file types to each method when both can be used for various data types. To help students: Create comparison charts showing the characteristics of each compression type. Emphasize that the key difference is whether original data can be perfectly reconstructed after decompression.

Question 20

Read the passage. In a streaming service, compression shrinks data so videos load quickly and use less bandwidth. The text explains that lossless compression preserves every bit of information, while lossy compression removes some details to achieve smaller files. For digital media, JPEG commonly compresses photos by discarding subtle image data, and MPEG commonly compresses video by reducing repeated or less-noticeable visual information across frames. This creates a trade-off: smaller files and smoother streaming versus potential blur or blocky artifacts. In contrast, text and program files often use lossless methods such as Huffman coding and LZW, since even a missing character can change meaning. Based on the text, what trade-offs are involved in using JPEG?

  1. It reduces photo size but can slightly reduce image quality. (correct answer)
  2. It enlarges photos to ensure every detail remains perfect.
  3. It compresses video frames by comparing changes across time.
  4. It compresses text by assigning shorter codes to rare letters.

Explanation: This question tests AP Computer Science Principles skills in understanding data compression, specifically the trade-offs involved in JPEG compression for images. Data compression methods involve deliberate choices between file size and quality, with JPEG exemplifying lossy compression that prioritizes size reduction over perfect image fidelity. The passage states that 'JPEG commonly compresses photos by discarding subtle image data' and mentions the general trade-off of 'smaller files...versus potential blur or blocky artifacts.' Choice A is correct because it accurately captures the JPEG trade-off: reducing photo file size at the cost of slightly reduced image quality through the loss of subtle details. Choice B is incorrect because JPEG reduces, not enlarges, file sizes, and Choice C describes video compression (MPEG) rather than still image compression. To help students: Show side-by-side comparisons of images at different JPEG compression levels. Help students understand that 'subtle image data' refers to fine details that may not be immediately noticeable but contribute to overall quality.