An overflow error occurs when a program tries to store a number that's too large for the fixed number of bits its data type allows, producing wrong or unexpected results. In AP CSP, it's the classic consequence of representing integers with a limited number of bits (EK DAT-1.B.1).
An overflow error happens when a calculation produces a value bigger than what the available bits can represent. Think of a car odometer with six digits. Once it hits 999,999, the next mile rolls it back to 000,000. Computers do the same thing. If a language stores integers in a fixed number of bits (say, 16 or 32), there's a hard ceiling on the biggest number that fits. Push past that ceiling and the value wraps around, gets cut off, or triggers an error, depending on the language.
The AP CED is specific about this: in many programming languages, integers are represented by a fixed number of bits, which limits the range of integer values and the math you can do on them (EK DAT-1.B.1). That limitation is what causes overflow. But here's the twist the exam loves. The pseudocode language on the AP exam reference sheet does NOT have this problem. It uses an abstraction where integer size is limited only by the computer's memory (EK DAT-1.B.2). So overflow is something you reason about conceptually, not something that breaks your exam pseudocode.
Overflow lives in Topic 2.1 (Binary Numbers) in Unit 2: Data, directly supporting learning objective AP Comp Sci P 2.1.B, "explain the consequences of using bits to represent data." That LO is basically asking one question over and over. If everything is bits, and bits are finite, what goes wrong? Overflow is the answer for integers (round-off error is the parallel answer for real numbers). It also reinforces 2.1.A, since you can't understand why 16 bits caps out at a certain value unless you understand how bits represent data in the first place. This is one of the most concrete, testable consequences in all of Big Idea 2, so it shows up frequently in multiple-choice questions.
Keep studying AP Computer Science Principles Unit 2Eugx1GAKQqZyKm7
Integer Overflow (Unit 2)
Integer overflow is the specific, most common flavor of overflow error. When a question gives you a fixed-bit integer like a 16-bit signed int maxing out at 32,767, integer overflow is exactly what's being tested.
Underflow Error (Unit 2)
Underflow is overflow's mirror image. Instead of a number being too big for its bits, it's too small (too close to zero, or below the minimum) to represent. Same root cause, opposite direction.
Data Type (Unit 2)
Overflow only exists because data types have boundaries. A type like a 32-bit integer is a contract about how many bits a value gets, and overflow is what happens when a value breaks that contract.
Binary Numbers (Topic 2.1, Unit 2)
Binary place value explains the math behind overflow ceilings. Each extra bit doubles the range, which is why n bits can only count so high. If you can compute powers of 2, you can predict exactly when a counter overflows.
Overflow shows up almost entirely in multiple-choice questions, usually in two flavors. The first is a scenario question. For example, a program stores ages in a 16-bit signed integer and then tries to store a value larger than 32,767. You need to recognize that the fixed bit representation causes an overflow error, not a syntax error or a logic bug in the algorithm. The second flavor is a design question, like a city installing traffic counters with limited memory, where you have to identify which question matters for preventing overflow (how high can the count go before it exceeds the bits available?). You should be able to do three things: explain why fixed-bit integers create a maximum value, predict what happens when a calculation exceeds it, and remember that the exam's own pseudocode language sidesteps overflow because its integers are limited only by memory. No released FRQ has required the term verbatim, but the Create task and written responses reward this kind of reasoning about data limitations.
Both come from having a fixed number of bits, but they hit different number types. Overflow happens with integers when a value exceeds the maximum the bits can hold. Round-off error happens with real numbers (decimals), where fixed bits limit precision, so values like 0.1 get stored as close approximations rather than exact values. Quick test: too BIG to store is overflow; not PRECISE enough is round-off.
An overflow error occurs when a program tries to store an integer value larger than the maximum its fixed number of bits can represent.
The root cause is EK DAT-1.B.1: many languages give integers a fixed number of bits, which caps the range of values and the math you can do with them.
The AP exam's pseudocode language does not have overflow errors because its integers are limited only by the computer's memory, an abstraction described in EK DAT-1.B.2.
Each additional bit doubles the representable range, so a 16-bit signed integer maxes out at 32,767 and exceeding that triggers overflow.
Round-off error is the parallel problem for real numbers, where fixed bits limit precision instead of maximum size.
On the exam, overflow questions usually describe a counter or stored value hitting its bit limit and ask you to identify the consequence or the prevention question.
It's the error that occurs when a program tries to store a value too large for the fixed number of bits allocated to it. For example, storing a number above 32,767 in a 16-bit signed integer causes overflow, which produces incorrect or unexpected results.
No. The language on the AP exam reference sheet uses an abstraction where integer size is limited only by the computer's memory (EK DAT-1.B.2), so its integers don't overflow. The exam tests whether you understand overflow conceptually, in languages with fixed-bit integers.
Overflow affects integers when a value exceeds the maximum the bits can hold. Round-off error affects real numbers, where fixed bits limit precision, so decimals get stored as approximations. Both are consequences of finite bits, but one is about size and the other is about precision.
A fixed number of bits. If a data type uses 16 or 32 bits for integers, there's a hard maximum value it can represent, and any calculation that exceeds it overflows. More bits raise the ceiling (each bit doubles the range) but never remove it.
They're opposites. Overflow means a value is too large to represent with the available bits, while underflow means a value is too small (too close to zero or below the minimum) to represent. Both come from the same limitation of fixed-bit representation.