AP Computer Science Principles Practice Quiz: Data Compression
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Test your understanding with short quizzes. This quiz has 16 questions to check your progress.
Question 1 of 16
All Questions (16)
A) To increase the amount of information in a file.
B) To reduce the number of bits needed to represent data.
C) To encrypt data for secure transmission.
D) To ensure data can never be lost.
Correct Answer: B
According to the provided content, 'Data compression can reduce the size (number of bits) of transmitted or stored data.' Its main purpose is to make data smaller in terms of storage space or transmission bandwidth.
A) It reduces file size by permanently discarding non-essential data.
B) It allows for the reconstruction of an approximation of the original data.
C) It reduces the number of bits while guaranteeing the original data can be perfectly reconstructed.
D) It is only effective for compressing images and audio files.
Correct Answer: C
The content states, 'Lossless data compression algorithms can usually reduce the number of bits stored or transmitted while guaranteeing complete reconstruction of the original data.' This means no information is lost.
A) It guarantees that the reconstructed data is identical to the original.
B) It can only be used on text files.
C) It allows for reconstruction of only an approximation of the original data.
D) It typically results in a larger file size but higher quality.
Correct Answer: C
The provided text specifies that 'Lossy data compression algorithms... only allow reconstruction of an approximation of the original data.' This is the fundamental trade-off of this compression type.
A) Lossy, because it will significantly reduce the storage space required.
B) Lossless, because the ability to perfectly reconstruct the original scans is maximally important for diagnosis.
C) Either lossy or lossless, as long as the file size is reduced.
D) Neither, as medical records cannot be compressed due to privacy laws.
Correct Answer: B
The content states, 'In situations where quality or ability to reconstruct the original is maximally important, lossless compression algorithms are typically chosen.' For medical records, perfect reconstruction is critical.
A) Lossless compression, to ensure every frame is perfect.
B) Lossy compression, where minimizing transmission time is more important than perfect quality.
C) No compression, to avoid processing delays.
D) Data redundancy, to send multiple copies of each frame.
Correct Answer: B
According to the text, 'In situations where minimizing data size or transmission time is maximally important, lossy compression algorithms are typically chosen.' Streaming services use lossy compression to adapt to network conditions.
A) Lossless algorithms always achieve greater size reduction.
B) Both algorithms reduce file size by the exact same percentage.
C) Lossy algorithms can usually achieve a greater reduction in size than lossless algorithms.
D) Size reduction is independent of the algorithm used.
Correct Answer: C
The provided content explicitly states, 'Lossy data compression algorithms can usually reduce the number of bits stored or transmitted more than lossless compression algorithms.'
A) The speed of the processor and the amount of RAM.
B) The file format and the operating system.
C) The amount of redundancy in the data and the algorithm applied.
D) The desired file size and the age of the file.
Correct Answer: C
The text states, 'The amount of size reduction from compression depends on both the amount of redundancy in the original data representation and the compression algorithm applied.'
A) The compressed file has fewer bits but contains the exact same information as the original.
B) The compressed file has lost 60% of its original information.
C) The compressed file has fewer bits and therefore less information.
D) Information was added to the file to make it smaller.
Correct Answer: A
The content explains that 'Fewer bits does not necessarily mean less information.' Since a lossless algorithm was used, it guarantees 'complete reconstruction of the original data,' meaning all information is preserved.
A) Minimizing the backup time is the most important factor, and lossless is fastest.
B) Even a minor change to the source code could make it unusable, so perfect reconstruction is essential.
C) Lossy compression would make the file much smaller, which is better for backups.
D) Source code has no redundancy and cannot be compressed effectively.
Correct Answer: B
This is a situation where the 'ability to reconstruct the original is maximally important.' Losing even a single character of source code can cause the entire program to fail, making lossless compression the only viable choice.
A) always choose the algorithm that produces the smallest file.
B) always choose a lossless algorithm to be safe.
C) compare algorithms to determine which is best for a particular context.
D) use lossy for text and lossless for images.
Correct Answer: C
The first point of the provided content is to 'Compare data compression algorithms to determine which is best in a particular context.' This highlights that there is no single 'best' algorithm for all uses.
A) Both files will compress to the same size.
B) The file with random sentences will compress more.
C) The file with the repeated sentence will compress more.
D) Neither file can be compressed.
Correct Answer: C
Compression effectiveness depends on the 'amount of redundancy in the original data.' The file with the repeated sentence has very high redundancy and will compress significantly, while the file with random sentences has low redundancy and will compress very little.
A) Lossy, to make the file easy to email.
B) Lossless, to preserve the maximum image quality for printing.
C) Lossy, because it reduces the number of bits more than lossless.
D) Lossless, because it is a faster algorithm.
Correct Answer: B
For a professional print, the 'quality or ability to reconstruct the original is maximally important.' Therefore, a lossless compression format (like TIFF or PNG) would be chosen to avoid any degradation of the image data.
A) The original data can be perfectly restored.
B) The file size will be reduced, but some original data will be lost permanently.
C) The compressed file will be larger than the original.
D) The compression process can be reversed without any data loss.
Correct Answer: B
The definition of lossy compression is that it achieves size reduction by creating an 'approximation of the original data,' which means some information is irreversibly lost.
A) Lossy for the logs and lossless for the dashboard data.
B) Lossless for both the logs and the dashboard data.
C) Lossless for the logs and lossy for the dashboard data.
D) Lossy for both the logs and the dashboard data.
Correct Answer: C
The financial logs must be perfectly preserved for auditing, making lossless compression essential (maximally important to reconstruct). The dashboard data can be an approximation to save space and speed up loading, so lossy is acceptable (minimizing size/time is important).
A) Because they need to be able to perfectly reconstruct the original data.
B) Because minimizing the data size is more important than preserving every detail of the original data.
C) Because lossy compression works on all file types, whereas lossless only works for text.
D) Because lossy compression adds error-checking bits to the data.
Correct Answer: B
The content states that lossy algorithms are chosen 'in situations where minimizing data size or transmission time is maximally important.' This implies a trade-off where perfect quality is sacrificed for a smaller file.
A) Lossy guarantees perfect reconstruction, while lossless creates an approximation.
B) Lossless guarantees perfect reconstruction, while lossy creates an approximation.
C) Lossy is used for storing data, while lossless is used for transmitting data.
D) Lossless reduces redundancy, while lossy reduces information.
Correct Answer: B
This directly synthesizes two key points from the text: 'Lossless data compression algorithms... [guarantee] complete reconstruction' and 'Lossy data compression algorithms... allow reconstruction of an approximation.'