AP CSP Big Idea 2 Binary Numbers

AP CSP Topics › 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.

8Bits in one byte — enough to store 256 different values (0–255)
2^nUnique values representable with n bits: 2 bits = 4 values, 8 bits = 256 values
0Difference in how computers store text, images, or sound — everything is bits

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.

Binary Place Values: How to Convert 1101 to Decimal 2^3 = 8 Position 3 2^2 = 4 Position 2 2^1 = 2 Position 1 2^0 = 1 Position 0 1 1 0 1 1 x 8 = 8 1 x 4 = 4 0 x 2 = 0 1 x 1 = 1 8 + 4 + 0 + 1 = 13 Binary 1101 = Decimal 13

To convert any binary number: write out the place values (powers of 2), multiply each bit by its place value, and sum the results.

Scenario — Convert Binary to Decimal

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?

Answer

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

More Bits = More Values
The exponential relationship
  • 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)
Real-World Bit Counts
What each represents
  • 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
Scenario — Apply the Bit Range Rule

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.

Answer

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

The Same Bits, Different Meanings
Context determines interpretation
  • 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
How Different Data is Stored
Everything becomes numbers
  • 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
Scenario — Spot the Misconception

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?

Answer

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

1
Starting place values from the wrong end

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.

2
Forgetting that n bits represent 2^n values, not 2^n - 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.

3
Thinking different file types store data differently at the fundamental level

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.

4
Confusing binary (base-2) with decimal (base-10) place values

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
1 x 8 + 0 x 4 + 1 x 2 + 0 x 1 = 8 + 0 + 2 + 0 = 10. Place values from right: 1, 2, 4, 8.

2. A system uses 4 bits to store a value. How many different values can it represent?

  • 4
  • 8
  • 16
  • 32
2^4 = 16. With 4 bits you can represent 16 different values: 0000 through 1111 (decimal 0 through 15).

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
Statement I is correct — all digital data is bits. Statement II is correct — each additional bit doubles the range (2^n vs 2^(n+1) = 2 x 2^n). Statement III is false — binary uses base-2 place values (powers of 2), not base-10.

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
2^10 = 1,024. Adding 2 bits multiplies the number of values by 4 (2^8 = 256, 2^10 = 1,024). Each bit doubles the range.

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.
The same bits have different meanings in different contexts. Interpretation depends on the data type the program assigns — the bits themselves carry no inherent meaning.

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.
2^8 = 256. A byte (8 bits) can represent any one of 256 different values (0–255). While 8-bit bytes are by far the most common, the statement that 8 bits = 256 possible values is the universally accurate principle.

Frequently Asked Questions

Does the AP CSP exam require converting decimal to binary?
The exam primarily tests binary-to-decimal conversion and understanding of the 2^n principle. You may be asked to convert in either direction, but binary-to-decimal is more commonly tested. Practice multiplying each bit by its place value and summing.
What is the difference between a bit and a byte?
A bit is the smallest unit of digital data: a single 0 or 1. A byte is 8 bits. Bytes are the standard unit for measuring file and memory sizes. A kilobyte is approximately 1,000 bytes (1,024 in binary convention), a megabyte approximately 1 million bytes, and so on.
Why do computers use binary instead of decimal?
Electronic circuits have two stable states: high voltage and low voltage (or on and off). Binary maps directly onto these two states. Decimal would require 10 distinguishable voltage levels, which is far harder to build reliably in physical hardware.

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
1×8 + 0×4 + 1×2 + 1×1 = 8+0+2+1 = 11.

8. How many distinct values can be represented with 4 bits?

  • 4
  • 8
  • 16
  • 32
2^4 = 16. Each additional bit doubles the number of representable values.

9. The binary number 1000 represents what decimal value?

  • 1
  • 4
  • 8
  • 10
1×8 + 0×4 + 0×2 + 0×1 = 8.

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
All three are correct. Adding a bit: 2^N → 2^(N+1) = double. 111 = 4+2+1 = 7. 2^8 = 256.

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.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]