GCSE · Computer Science · Edexcel · Spec 1CP2

Overflow

1111 + 1 should be 16. Put it in a four-bit register and you get 0000. How does a correct calculation turn into zero?

Computer Science · Data representation

1111 + 1 in a four-bit register

Four boxes. Watch the carry move left, box by box, until it has nowhere to go.

Make a prediction first: when the carry reaches the end, what will the four boxes hold?

1 1 1 1 1 (15)
2 + 0 0 0 1 (1)
3 _ _ _ _ only four boxes
ColumnBit of 1111Bit of 0001Carry inStoredCarry out
1st (right)11001

Output

Register: _ _ _ 0

Step 1: Start at the right-hand box. 1 + 1 makes 10 in binary, so we write 0 in the box and carry the 1 to the left.

1 / 5

Press Next to move the carry one box to the left. The Back button lets you replay it.

Step 1 of 5: Start at the right-hand box. 1 + 1 makes 10 in binary, so we write 0 in the box and carry the 1 to the left..

Computer Science · Data representation

Fits or overflows?

Each calculation must be stored in four bits. Work out the decimal result, then decide where it goes.

Still to sort

Fits in four bits (0)

The decimal result is 15 or less.

Where the line is: Exactly 15 still fits, because 1111 is the largest four-bit number.

Overflows (0)

The decimal result is more than 15.

Where the line is: The first result that overflows is 16, not 15.

8 of 8 still to sort.

Four bits again. Work out the decimal result, then compare it with 15.

Computer Science · Data representation

Find the slip

Does 1101 + 11 overflow when the answer must be stored in four bits? Here is one student's working. One line goes wrong. Which one?

A student's answer — which line goes wrong?

Computer Science · Data representation

Which idea is closest to yours?

A program has to store the result of a calculation in a fixed number of bits.

Which idea is closest to what you think about overflow?
How sure are you?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

When a correct answer is too big for the bits you gave it

What you need to know

  • A number is stored in a fixed number of bits, and those bits set the largest value it can hold.
  • The largest number four bits can store is 1111, which is 15 in decimal.
  • Have a goSam is confidently wrong: 'The biggest number four bits can hold is 10000, because that's 16.' What is the real biggest number, in binary and decimal?

    1111, which is 15 in decimal.

    10000 has five digits, so it cannot fit in four bits. 1111 is the largest four-digit pattern.

  • Overflow is when a number is too large to be stored in the bits allocated for it.
  • Add 1 to 1111 with four bits and 16 will not fit: an overflow error occurs and the stored answer is 0000, which is incorrect.
  • To check a sum, convert to decimal, add, then compare the result with 15 for four bits.
  • Have a goTry it before you look: does 0110 + 1011 fit in four bits? Convert, add, compare.

    No. 6 + 11 = 17, which is more than 15, so it overflows.

    The check is the decimal result against 15. Anything above 15 is too large for four bits.

  • 1101 + 11 overflows in four bits (13 + 3 = 16), but 1000 + 101 (13) and 101 + 111 (12) fit.
  • Shifting left multiplies by a power of 2, so a left shift can overflow too, not just addition.
  • Have a goPredict: 1000 is shifted left by 1 place in a four-bit register. Does it overflow? Say yes or no and show the decimal check.

    Yes. 8 × 2 = 16, which is more than 15.

    A left shift by 1 place doubles the value. It is not only addition that can push a result past 15.

  • Allocating more binary digits avoids overflow errors, but more digits need more storage space.
  • Have a goTom has a plan: 'Give every number loads of bits and overflow can never bother us. It's free!' What is the catch?

    More binary digits need more storage space.

    Extra bits do avoid overflow errors, but they cost storage, so it is a trade-off rather than a free fix.

  • Overflow errors can have serious consequences, so check that enough memory is allocated for the result.

The big picture

A number is stored in a fixed number of bits, so a calculation or a left shift can give a result too large to fit. That is an overflow error and the stored value is incorrect. More bits avoid it, but need more storage.

Key points

1Four bits can store at most 1111, which is 15 in decimal.
2A result larger than the allocated bits can hold is an overflow error, and the stored value is incorrect.
3Both addition and left shifting can produce a result that is too large.
4Allocating more binary digits avoids overflow errors, but needs more storage space.

Worked example

Problem

Four bits are allocated for the answer. Will 1011 + 110 fit?

⚠ Watch out

Thinking the computer will simply hold the bigger answer. Four bits stop at 1111 (15), and a larger result is an overflow error.

🧠

Memory hook

Four boxes, one ceiling: 15. A result that needs a fifth box has nowhere to go.

✓

Check yourself

0101 is shifted left by 3 places in a four-bit register. Without looking back, work out whether the result overflows, and show the decimal check.

Flashcards

(10)
What is the largest number four bits can store?
1111, which is 15 in decimal.
What is overflow?
A number too large to be stored in the bits allocated for it. It happens when the result of a calculation is too large.
Four bits, 1111 + 1. What goes wrong?
The result 16 is too large to fit, so an overflow error occurs. The stored answer is 0000, which is incorrect.
How do you check whether a binary sum fits in four bits?
Convert to decimal, add, then compare with 15. A result above 15 overflows.
Why does 1101 + 11 overflow in four bits?
13 + 3 = 16, and the largest number four bits can store is 15.
Is a result of exactly 15 an overflow in four bits?
No. 1111 is 15, the largest value four bits can hold. Overflow starts at 16.
Why can shifting left cause overflow?
It multiplies the number by a power of 2, so the result may be larger than the bits available can store.
How can overflow errors be avoided, and what is the cost?
Allocate more binary digits. More digits need more storage space.
Why check that enough memory has been allocated to a result?
Overflow errors can have serious consequences.
What does the 0000 in 1111 + 1 picture show?
A four-bit register keeping only the four right-hand digits of 10000. How a particular system reacts to overflow varies.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More Edexcel GCSE Computer Science topics

See the full Edexcel Computer Science curriculum →

How this lesson was checked. This Edexcel GCSE Computer Science (specification 1CP2)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 21 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.