AP CSP Day 52: Binary Arithmetic & Overflow

Big Idea 2
Day 52 Practice
Focus: Binary Arithmetic & Overflow

Practice Question

A computer stores unsigned integers using 8 bits. What happens when you add 255 + 1?
Why This Answer?

8 bits can represent 0-255. 255 = 11111111 in binary. Adding 1 causes overflow, wrapping around to 00000000 = 0.

Why Not the Others?

A) 256 requires 9 bits, can't store in 8 bits.

C) Overflow happens silently in most systems.

D) -1 requires signed integers, question specifies unsigned.

Common Mistake
Watch Out!

Not recognizing overflow behavior. With fixed bits, adding beyond maximum wraps to minimum.

AP Exam Tip

Overflow: adding past maximum value wraps to minimum. Example: 8-bit unsigned: 255 + 1 = 0.

Keep Practicing!

Daily practice builds AP CSP mastery.

Study Guide Get Tutoring
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.