AP CSP Big Idea 2 Binary Numbers
AP CSP Binary Numbers & Digital Data Representation: Complete Guide (2025‑2026)
Computers store everything — text, images, sound, video — as sequences of 1s and 0s called bits. This works because any information can be represented as a number, and any number can be expressed in binary (base-2). AP CSP tests binary-to-decimal conversion, the relationship between bits and the range of values they can represent, and why all digital information ultimately reduces to bits.
Contents
Binary to Decimal Conversion
Each bit position represents a power of 2. Start from the rightmost bit (position 0) and multiply each bit by its place value.
To convert any binary number: write out the place values (powers of 2), multiply each bit by its place value, and sum the results.
Convert the binary number 10110 to decimal. Work through each bit position before revealing.
Write out the place values and multiply. What is the decimal equivalent?
Place values: 10110 has 5 bits, so positions 4 through 0.
1 x 2^4 = 1 x 16 = 16
0 x 2^3 = 0 x 8 = 0
1 x 2^2 = 1 x 4 = 4
1 x 2^1 = 1 x 2 = 2
0 x 2^0 = 0 x 1 = 0
16 + 0 + 4 + 2 + 0 = 22. Binary 10110 = Decimal 22.
Bits and the Range of Values
- 1 bit: 2 values (0 or 1)
- 2 bits: 4 values (00, 01, 10, 11)
- 4 bits: 16 values (0–15)
- 8 bits (1 byte): 256 values (0–255)
- 24 bits: 16,777,216 values (true color images)
- 1 bit: on/off switch
- 8 bits: one text character (ASCII)
- 16 bits: one audio sample
- 24 bits: one RGB color pixel
- 32-64 bits: typical integer in programs
A digital image uses 8 bits per color channel (red, green, blue). A student asks: how many different shades of red are possible? A second question: how many total colors can a single pixel represent?
Calculate both answers using the 2^n rule.
Shades of red: 8 bits = 2^8 = 256 possible values (0–255). Total colors per pixel: 24 bits total (8 red + 8 green + 8 blue) = 2^24 = 16,777,216 possible colors. This is why 24-bit color is called “true color” — more combinations than the human eye can distinguish.
What Binary Represents
- 01000001 as ASCII text = ‘A’
- 01000001 as an integer = 65
- 01000001 as part of a color = a specific blue value
- 01000001 as part of an instruction = a CPU operation
- The bits are identical — meaning comes from context
- Text: each character assigned a number (ASCII/Unicode)
- Images: grid of pixels, each pixel a color number
- Sound: pressure samples measured thousands of times/second
- Video: sequence of image frames + audio samples
- Programs: CPU instructions encoded as numbers
A student argues: ‘Photos are different from text files because photos contain actual pictures, not numbers. That’s why a photo file is so much larger than a text file.’
What is correct and incorrect about this argument?
The student is correct that photo files are larger than text files — a photo requires millions of pixel color values. But the student is incorrect that photos are not numbers. Every pixel is stored as three 8-bit numbers (RGB values). Every text character is also stored as a number. Everything in a computer is bits — the difference is how many bits and what the bits mean in context, not a fundamental difference in storage type.
Common Exam Pitfalls
Place value 2^0 = 1 is always the rightmost bit. Students frequently reverse the order. Always write place values right-to-left: ...8, 4, 2, 1.
With 3 bits you can represent 8 values: 000, 001, 010, 011, 100, 101, 110, 111. The range is 0 to 7 (eight values). The maximum value is 2^n - 1, but the number of values is 2^n.
All digital data is bits. Text, images, audio, and video differ in how many bits they use and how those bits are interpreted — not in whether they use bits.
In decimal, place values are powers of 10: 1, 10, 100, 1000. In binary, place values are powers of 2: 1, 2, 4, 8, 16. Students sometimes apply decimal rules to binary conversion.
Check for Understanding
1. What is the decimal value of binary 1010?
- 5
- 8
- 10
- 12
2. A system uses 4 bits to store a value. How many different values can it represent?
- 4
- 8
- 16
- 32
3. Consider statements about binary representation:
I. All digital data — text, images, and audio — is ultimately stored as bits.
II. Adding one bit to a representation doubles the number of possible values.
III. Binary uses base-10 place values starting from the rightmost position.
Which are correct?
- I only
- I and II only
- II and III only
- I, II, and III
4. An image uses 8 bits per pixel to represent 256 shades of gray. A new format uses 10 bits per pixel. How many shades of gray does the new format support?
- 320 shades (256 + 64)
- 512 shades
- 1,024 shades
- 2,048 shades
5. The bit sequence 01000001 represents the letter ‘A’ in ASCII (decimal 65) and the integer 65 in unsigned binary. What does this illustrate?
- Binary can only represent whole numbers, not text.
- The same bit pattern can represent different data depending on how the program interprets it.
- ASCII and integer encoding use different bit lengths.
- 65 is the only value that can be encoded as 01000001.
6. Which statement about bits and bytes is most accurate?
- A byte always stores exactly one character of text.
- One byte can represent 256 different values because 2^8 = 256.
- Bits are stored as physical 0s and 1s visible inside the computer chip.
- All computers use 8-bit bytes because that is required by all programming languages.
Frequently Asked Questions
How the AP Exam Tests This
- Convert a small binary number (4-8 bits) to decimal
- Convert a decimal number to binary
- Calculate the number of values representable with N bits (2^N)
- Identify the effect of adding or removing a bit from a binary representation
- I/II/III: which statements about binary representation are correct
7. What is the decimal value of the binary number 1011?
- 5
- 7
- 11
- 13
8. How many distinct values can be represented with 4 bits?
- 4
- 8
- 16
- 32
9. The binary number 1000 represents what decimal value?
- 1
- 4
- 8
- 10
10. Consider: I. Adding one bit to a binary representation doubles the number of possible values. II. The binary number 111 equals 7 in decimal. III. 8-bit storage can represent 256 distinct values.
- I only
- I, II, and III
- I and II only
- II and III only
Get in Touch
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Prefer email? Reach me directly at [email protected]