Skip to main content

Unit 2

17–22% of exam

Data

Everything a computer stores, from numbers and text to photos and songs, comes down to bits. In this unit you'll convert between binary and decimal by hand, see how files get compressed, and learn how people and programs pull useful information out of large data sets, along with the limits and biases of that data.

Study this unit

Flashcards (29)Practice questions (60)Computer Science Principles must-know sheet

Free-response questions on this unit

Write your own answer, then score it with the rubric or with AI.

Big ideas

  • All digital data is stored as bits, and the same bits can mean different things
  • Each extra bit doubles the number of values you can represent
  • Lossless compression can be undone exactly; lossy compression trades detail for size
  • Cleaning, filtering and visualizing data turns raw data into information
  • A correlation in data doesn't prove that one thing causes another

Full unit reviews

Longer videos that cover the whole unit. Good for a first pass or a final review.

A bit is a single 0 or 1 and a byte is 8 bits, and the same bits can stand for a number, a letter, a color or a sound depending on how they're read. You'll convert between binary (base 2) and decimal (base 10) using place values (1, 2, 4, 8, 16 and so on), see how a fixed number of bits leads to overflow and round-off errors, and see how sampling turns smooth analog data like sound into digital data.

Key terms

  • bit
  • byte
  • binary (base 2)
  • overflow error
  • round-off error
  • analog data and sampling
  • AP CS Principles Exam Review - Binary

    Flavio KupermanWatch on YouTube (opens in a new tab)

  • The binary number system

    Khan Academy ComputingWatch on YouTube (opens in a new tab)

  • How Computers Work: Binary & Data

    CodeAIWatch on YouTube (opens in a new tab)

  • Intro to Binary in 10 minutes! Binary numbers for the AP CSP exam, Code.org Unit 1.4

    Dr_WuWatch on YouTube (opens in a new tab)

  • Binary Rational Numbers, Overflow, and Rounding Errors (AP Computer Science Principles Unit 1)

    Professor CunninghamWatch on YouTube (opens in a new tab)

  • Converting Analog Data to Binary, Sampling, Quantization (AP Computer Science Principles Unit 1)

    Professor CunninghamWatch on YouTube (opens in a new tab)

Read the review notes: 2.1 Binary Numbers

A few quick questions on this topic, with the answers explained.

Compression reduces the number of bits needed to store or send data, and how much it saves depends on how much repetition the data has and on the method used. Lossless compression lets you rebuild the original exactly, while lossy compression throws away some detail for a much smaller file, so you pick lossless when you need a perfect copy and lossy when smaller size matters more.

Key terms

  • data compression
  • lossless compression
  • lossy compression
  • redundancy
  • trade-off
  • AP CS Principles Exam Review - Compression

    Flavio KupermanWatch on YouTube (opens in a new tab)

  • Text compression widget with Aloe Blacc

    CodeAIWatch on YouTube (opens in a new tab)

  • Compression, Lossy & Lossless (AP Computer Science Principles Unit 1: Digital Information)

    Professor CunninghamWatch on YouTube (opens in a new tab)

  • Compression: Crash Course Computer Science #21

    CrashCourseWatch on YouTube (opens in a new tab)

  • Lossy compression! Topic 2.2 and Code.org Unit 1.10 walkthrough. 8 mini-practice questions!

    Dr_WuWatch on YouTube (opens in a new tab)

  • Data Compression

    CodeHSWatch on YouTube (opens in a new tab)

Read the review notes: 2.2 Data Compression

A few quick questions on this topic, with the answers explained.

Large data sets can reveal trends and patterns, but data often needs cleaning first so it's complete and consistent, and metadata (data about data, like the date and place a photo was taken) helps you find and organize it. Data has limits: it can be incomplete or biased, and a correlation between two things doesn't prove that one causes the other.

Key terms

  • information
  • metadata
  • data cleaning
  • correlation vs. causation
  • bias in data
  • scalability
Read the review notes: 2.3 Extracting Information from Data

A few quick questions on this topic, with the answers explained.

Programs let you work with far more data than you could by hand: they can filter it (keep only what matches a condition), transform it (change every item, like converting units), combine it and turn it into tables and charts. Visualizing data makes patterns easier to spot and helps you test ideas about it.

Key terms

  • filtering data
  • transforming data
  • combining data
  • data visualization
  • patterns and trends
  • AP CSP Topic 2.4 - Using Programs with Data! - Explanations and 5 MCQs!

    Dr_WuWatch on YouTube (opens in a new tab)

  • Data Visualizations

    CodeHSWatch on YouTube (opens in a new tab)

  • Datasets and data structures | Intro to CS - Python | Khan Academy

    Khan AcademyWatch on YouTube (opens in a new tab)

  • AP CSP U9 L3 Filtering and Cleaning Data

    Janelle WhalenWatch on YouTube (opens in a new tab)

  • AP CSP Topic 2.4 - Using Programs with Data - Speedrun! 17 MCQs

    Dr_WuWatch on YouTube (opens in a new tab)

Read the review notes: 2.4 Using Programs with Data

A few quick questions on this topic, with the answers explained.