Unit 2: Data
AP Computer Science Principles: 51 practice questions with detailed explanations.
Unit Study Guide
Executive Summary
Computers store everything as bits. Compression shrinks data, tools extract meaning from it, and privacy concerns follow whenever data describes people.
Binary numbers
Bits are 0s and 1s; a byte is 8 bits. With n bits you can represent 2^n values (8 bits → 256 values, 0 to 255). Overflow happens when a result needs more bits than available. Converting: each position is a power of two; 1011 = 8 + 0 + 2 + 1 = 11.
Compression
Lossy compression drops information permanently (JPEG, MP3) — smaller files, some quality lost. Lossless compression restores the original exactly (PNG, ZIP, FLAC). Choose lossy for photos and audio where small loss is fine; lossless for text and data that must survive exactly.
Working with data
Metadata is data about data (photo date, location). Cleaning fixes bad entries; filtering keeps records matching a condition; sorting orders them. Programs search, filter, and compute statistics over datasets. Patterns come from comparing many records.
Privacy and bias
Data describing people raises privacy issues; PII includes names, addresses, and emails. Anonymization strips identifiers. Biased data — underrepresentation or skewed collection — produces unfair conclusions. A survey of app users misses non-users.
Exam traps
n bits give 2^n values, not 2n. Lossless vs lossy is about whether the original is exactly restorable. Metadata describes other data. Bias lives in the collection, not the analysis.