AP Computer Science Principles
Unit 2 Review Notes
Binary, Data Compression, Extracting Information, and Using Programs
These notes are written as a review for AP CSP Unit 2. The goal is to help you understand the big ideas in a simple, student-friendly way.
1. What is Binary?
Computers do not think in English words or decimal numbers like people do. Computers use binary, which is a number system made of only two digits:
A binary digit is called a bit.
Why do computers use binary?
Because computer hardware is built from electronic parts that are usually in one of two states, such as:
- on / off
- true / false
- high voltage / low voltage
Binary is a natural way for computers to store and process information.
2. Bits and Bytes
Bit
A bit is the smallest unit of data in computing.
Byte
A byte is 8 bits.
Common storage units:
- Kilobyte (KB) ≈ 1,000 bytes
- Megabyte (MB) ≈ 1,000,000 bytes
- Gigabyte (GB) ≈ 1,000,000,000 bytes
More bytes = more storage needed.
3. Binary Numbers
In decimal, we use digits 0–9. In binary, we use only 0 and 1. Each place value in binary is a power of 2.
| Binary Place Value |
8 |
4 |
2 |
1 |
| Binary Number |
1 |
0 |
1 |
1 |
This equals:
- 1 × 8 = 8
- 0 × 4 = 0
- 1 × 2 = 2
- 1 × 1 = 1
Total = 11
1011₂ = 11₁₀
4. How Computers Represent Data
Computers use binary to represent many kinds of information, including:
- numbers
- text
- images
- audio
- video
Even though these seem very different, inside the computer they are all stored as bits.
Part A: Binary and Data Representation
5. Representing Text
Text is stored by giving each character a binary code. A system such as ASCII or Unicode gives each character a number, and that number is stored in binary.
Text is not stored as letters. It is stored as numbers that represent letters.
6. Representing Images
A digital image is made up of tiny dots called pixels.
A pixel is the smallest unit of a digital image. Each pixel stores information about color.
Image quality depends on:
- the number of pixels
- the amount of color information per pixel
More pixels usually means:
- more detail
- better quality
- larger file size
Resolution is the number of pixels in an image.
Better quality usually means a larger file size.
7. Representing Sound
Computers store sound by taking many measurements of a sound wave.
Sampling means a computer records sound by measuring it many times per second.
Sample Rate is how often the sound is measured.
- Higher sample rate = better sound quality, but larger file size
- Lower sample rate = lower quality, but smaller file size
Bit Depth also affects sound quality and file size.
Part B: Data Compression
8. What is Data Compression?
Data compression means reducing the size of a file so it needs less storage space or less bandwidth to send.
Compression helps:
- save storage
- send files faster
- stream media more efficiently
9. Lossless Compression
Lossless compression reduces file size without losing any information. When the file is uncompressed, you get back the exact original file.
Examples:
- text files
- spreadsheets
- some image formats like PNG
With lossless compression, nothing is permanently deleted.
10. Lossy Compression
Lossy compression reduces file size by removing some data permanently.
This is often used for:
Trade-off: smaller file size, but possible loss of quality.
11. Compression Trade-Offs
Computing often involves trade-offs between:
- quality
- file size
- speed of transmission
Part C: Extracting Information from Data
12. What Does It Mean to Extract Information?
Raw data by itself is not always useful. People and computers often analyze data to find patterns, trends, or useful information.
This process is called extracting information.
13. Patterns and Trends
Computers can process data to discover:
- patterns
- relationships
- trends
- outliers
Trend = a general direction in data over time
Pattern = something that repeats or appears regularly
Outlier = a value that is very different from the others
14. Visualization Helps
A data visualization is a chart, graph, or other display that helps people understand data more easily.
Examples:
- bar graph
- line graph
- pie chart
- table
A graph can help explain data, but it can also be misleading if it is poorly designed.
15. Correlation vs. Causation
Correlation means two things appear related.
Causation means one thing directly causes the other to happen.
Just because two things happen together does not mean one caused the other.
16. Problems with Data
Data is powerful, but it is not perfect.
- Incomplete data – not enough information was collected
- Incorrect data – some values are wrong
- Biased data – the data does not fairly represent the group or situation
- Too much data – it may become difficult to find useful information
Bad data can lead to bad conclusions.
17. Privacy and Data
Collecting and storing data can create privacy concerns.
Examples of personal data include:
- name
- location
- age
- search history
- purchases
- health data
If personal data is misused, people can be harmed.
Part D: Using Programs with Data
18. Programs Can Process Data
A program can:
- collect data
- store data
- organize data
- analyze data
- display results
19. Programs Use Input, Processing, and Output
This is a basic model for many programs.
- Input – data entered into the program
- Processing – the program works with the data
- Output – the program gives a result
20. Programs Can Automate Tasks
Automation means using a program to do repeated tasks automatically.
Programs can:
- save time
- reduce human error
- handle large datasets efficiently
21. Programs Help Find Meaning in Data
A program can help answer questions like:
- What is the largest value?
- What is the smallest value?
- What is the average?
- How many values meet a condition?
- What trend appears over time?
22. Using Lists and Data in Programs
A list is used to store multiple data values in one variable.
Programs can use lists to:
- search data
- count data
- update values
- display results
23. Filtering Data
Programs often filter data, which means selecting only the values that match a rule.
Example: From a list of scores, show only scores above 70.
24. Finding and Calculating with Data
Programs can perform common operations on data such as:
- sum
- average
- maximum
- minimum
- count
25. Why Using Programs Matters in AP CSP
In AP CSP, programs are useful because they help people:
- process large amounts of data
- automate repeated tasks
- extract useful information
- solve real-world problems
Quick Review Summary
Binary
- Computers use binary: 0 and 1
- A bit is the smallest unit of data
- A byte is 8 bits
- Numbers, text, images, and sound are all stored in binary
Images and Sound
- Images are made of pixels
- More pixels = better detail but larger file size
- Sound is stored using samples
- Higher sample rate = better quality but larger file size
Compression
- Compression reduces file size
- Lossless = no data lost
- Lossy = some data lost permanently
- Smaller files are easier to store and send
Extracting Information
- Raw data can be analyzed to find patterns and trends
- Visualizations help people understand data
- Data can be incomplete, biased, or misleading
- Correlation does not always mean causation
Using Programs
- Programs collect, process, and display data
- Programs automate tasks
- Programs can find averages, sort values, filter data, and show patterns
- Programs help turn raw data into useful information
Key Vocabulary
- Binary: A number system using only 0 and 1
- Bit: Smallest unit of data
- Byte: 8 bits
- Pixel: Smallest unit of a digital image
- Resolution: Number of pixels in an image
- Compression: Reducing file size
- Lossless Compression: Compression with no data loss
- Lossy Compression: Compression with some permanent data loss
- Data Visualization: Graphic display of data
- Pattern: Repeated or recognizable data behavior
- Trend: General direction of data over time
- Outlier: Value very different from the others
- Bias: Unfair or unrepresentative data
- Input: Data given to a program
- Processing: Work the program does
- Output: Result produced by the program
- Automation: Using programs to perform repeated tasks automatically
Final Review Tips
- Why do computers use binary?
- How are text, images, and sound represented with bits?
- What is the difference between lossless and lossy compression?
- Why is compression useful?
- How can data be analyzed to extract useful information?
- What problems can happen with data collection?
- How do programs help people process and use data?