AP Computer Science Principles Unit 2: Data
Study binary, data compression, metadata, data collection, visualization, filtering with exam-format practice and rubric-based scoring.
Start AP CSP Practice · Full Study Guide
AP and Advanced Placement are trademarks of College Board. AimFive is not affiliated with or endorsed by College Board.
Inside This Unit: The Full Breakdown
Data is central to computing. This unit covers how computers represent information using binary, how data is compressed and stored, and how large datasets are analyzed to extract useful information.
Why it matters
Data questions make up a significant portion of the AP CSP multiple-choice exam. Understanding binary representation, data compression, and the ability to draw conclusions from data are essential skills tested in multiple contexts.
Key concepts
- Computers represent all data in binary (0s and 1s). A bit is a single binary digit; a byte is 8 bits.
- Numbers, text, images, and sound are all encoded in binary using agreed-upon standards.
- Lossless compression preserves all data; lossy compression permanently removes some data to reduce size.
- Metadata is data about data — it describes the structure, origin, and characteristics of a dataset.
Binary and Data Representation
Computers store everything as sequences of bits — 0s and 1s. A group of 8 bits forms a byte. Numbers are represented in binary using place values that are powers of 2. Text uses encoding schemes like ASCII (7 bits per character) or Unicode (up to 32 bits per character for worldwide scripts). Images are grids of pixels, each represented by color values. Sound is sampled at regular intervals and each sample is stored as a number. The more bits used per sample or pixel, the higher the quality but the larger the file.
Data Compression
Compression reduces file size for storage and transmission. Lossless compression (like ZIP or PNG) reduces size without losing any information — the original file can be perfectly reconstructed. Lossy compression (like JPEG or MP3) permanently discards some data that humans are unlikely to notice, achieving much smaller files. The tradeoff is quality versus size. The AP exam asks you to understand this tradeoff and identify which type of compression is appropriate for different scenarios.
Using Data to Discover Information
Large datasets can reveal patterns, trends, and correlations that are not apparent in small samples. Cleaning data involves removing errors, filling gaps, and standardizing formats. Filtering and sorting help isolate relevant subsets. Visualization tools like charts and graphs make patterns visible. However, data has limitations: bias in collection can skew results, correlation does not imply causation, and incomplete data can lead to incorrect conclusions. The AP exam tests your ability to reason about what conclusions are and are not supported by data.
AP exam tip
When asked about overflow on the AP exam, remember that a fixed number of bits limits the range of values. For example, 8 bits can represent integers 0 to 255; values outside that range cause overflow errors.
Connections to other units
- Unit 3: Programs process and transform data — understanding representation helps you write correct algorithms.
- Unit 4: Data is transmitted across networks using protocols that rely on binary encoding.
- Unit 5: How data is collected, stored, and analyzed raises important privacy and ethical concerns.