Skip to main content
SingaporeComputer ScienceSyllabus dot point

How do we add binary numbers by hand, and what happens when the result is too big for the register?

Perform binary addition showing carries, and explain overflow when a result exceeds the fixed width of a register

A focused answer to the O-Level Computing point on binary addition. Adding binary numbers column by column with carries, checking the result against denary, and understanding overflow in a fixed-width register.

Generated by Claude Opus 4.86 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

SEAB wants you to add binary numbers by hand, showing the carries, and to explain overflow: what happens when an addition produces a result that does not fit in the fixed number of bits the register has. The central idea is that binary addition works exactly like denary addition, but you carry whenever a column reaches the base, which in binary is 22.

The answer

The four addition rules

Adding two bits (plus any carry coming in) follows four simple cases:

0 + 0 = 0
0 + 1 = 1
1 + 1 = 10   (write 0, carry 1)
1 + 1 + 1 = 11   (write 1, carry 1)

The last case happens when there is also a carry into the column.

Adding column by column

Start at the rightmost column (the least significant bit) and work left. Add the two digits and any incoming carry, write the result digit, and pass any carry to the next column:

  carries:   1 1 0
             0 1 0 1
           + 0 0 1 1
           ---------
             1 0 0 0

Here 01012=50101_2 = 5 and 00112=30011_2 = 3, and 10002=81000_2 = 8, which checks.

Checking with denary

Always confirm a binary addition by converting both numbers and the result to denary. If a+ba + b in denary does not equal the denary value of your binary result, you have dropped a carry somewhere.

Fixed-width registers

A register stores a fixed number of bits, often 88. An unsigned 8-bit register can hold the values 00 to 255255, because 28=2562^8 = 256 patterns. The largest unsigned value is 2n−12^n - 1 for nn bits.

Overflow

Overflow happens when an addition produces a carry out of the most significant bit, because the result needs more bits than the register has. The extra bit is lost, so the stored answer is wrong. You detect overflow by checking for a carry out of the top column, or by checking whether the true result exceeds 2n−12^n - 1.

Examples in context

Example 1. A counter wrapping round. An 8-bit counter that reads 255=111111112255 = 11111111_2 and is told to add 11 overflows: the carry ripples out of the top bit and the counter wraps to 000000002=000000000_2 = 0. This is why an odometer or a game score can suddenly reset to zero.

Example 2. Adding bytes in a program. When two byte values are added in low-level code, the programmer must know the register width. If two large bytes are added without room for the carry, the result silently wraps, causing a bug that a denary check during testing would reveal.

Try this

Q1. Add 00001111200001111_2 and 00000001200000001_2 and give the 8-bit result. [2 marks]

  • Cue. 15+1=16=00010000215 + 1 = 16 = 00010000_2; the run of ones rolls over with carries to set the next bit.

Q2. State the largest value an unsigned 8-bit register can hold, and why. [2 marks]

  • Cue. 255255, because 88 bits give 28=2562^8 = 256 patterns, from 00 to 255255.

Q3. Add 10000000210000000_2 and 10000000210000000_2 in an 8-bit register and explain the result. [3 marks]

  • Cue. 128+128=256128 + 128 = 256, which needs 99 bits; the carry out of the top bit is lost, so the register stores 000000002=000000000_2 = 0, an overflow.

Exam-style practice questions

Practice questions written in the style of SEAB exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Original4 marksAdd the 8-bit binary numbers 0011011000110110 and 0001110100011101. Show your carries and give the 8-bit result. Check your answer by converting to denary.
Show worked answer →

Add column by column from the right, carrying whenever a column reaches 22:

  carries:   1 1 1 1 1 0
             0 0 1 1 0 1 1 0
           + 0 0 0 1 1 1 0 1
           -----------------
             0 1 0 1 0 0 1 1

The result is 01010011201010011_2. Check: 001101102=5400110110_2 = 54 and 000111012=2900011101_2 = 29, and 54+29=8354 + 29 = 83. Also 010100112=64+16+2+1=8301010011_2 = 64 + 16 + 2 + 1 = 83. The two agree.

Markers reward correct carry propagation, the 8-bit result, and a denary check that matches.

Original4 marksAn 8-bit register stores unsigned integers. The values 1100100011001000 and 0101000001010000 are added. (a) Give the 9-bit sum. (b) Explain why overflow occurs and what the register would actually store.
Show worked answer →

(a) Adding the two 8-bit numbers:

             1 1 0 0 1 0 0 0
           + 0 1 0 1 0 0 0 0
           -----------------
           1 0 0 0 1 1 0 0 0

The full sum needs 99 bits: 1000110002100011000_2. In denary 200+80=280200 + 80 = 280.

(b) An unsigned 8-bit register can only hold 00 to 255255 (28−12^8 - 1). The sum 280280 needs a ninth bit, but there is no column for it, so the carry out of the most significant bit is lost. This is overflow. The register keeps only the lowest 8 bits, 000110002=2400011000_2 = 24, which is the wrong answer.

Markers reward identifying the carry out of the top bit, the range 00 to 255255, and the truncated stored value 2424.

Related dot points