Skip to main content
EnglandComputer ScienceSyllabus dot point

How do you add two binary numbers, apply binary shifts, and what is overflow?

Add together two positive binary patterns, apply logical and arithmetic binary shifts, and understand the concept of overflow in relation to the number of bits available to store a value.

A focused answer to Edexcel GCSE Computer Science 2.1.4 and 2.1.5, covering binary addition of two positive patterns, logical and arithmetic binary shifts, and the concept of overflow when a result needs more bits than are available.

Generated by Claude Opus 4.89 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. Binary addition
  3. Binary shifts
  4. Overflow
  5. Try this

What this dot point is asking

Edexcel wants you to add two positive binary numbers, carry out logical and arithmetic binary shifts and state their effect, and explain overflow: what it is, when it happens, and why the stored result is then wrong.

Binary addition

Edexcel asks you to add two positive binary patterns, so each column totals at most 3 (two bits plus a carry), and the carry is never more than 1. The processor does this in its arithmetic logic unit: a full adder adds two bits plus a carry-in and produces a sum bit and a carry-out, which feeds the next column, which is why addition runs right to left.

Binary shifts

Shifting is much faster for the CPU than full multiplication or division, which is why it is used to multiply or divide by powers of 2. For a logical shift, always fill with 0. Examples: 0000011000000110 (6) shifted left by 1 gives 0000110000001100 (12, that is 6×26 \times 2); 0001010000010100 (20) shifted right by 2 gives 0000010100000101 (5, that is 20÷420 \div 4). Bits pushed off the right in a right shift are discarded, so precision can be lost, and bits pushed off the left in a left shift can cause overflow.

An arithmetic right shift differs only in the fill: it copies the most significant (sign) bit into the vacated left positions, so a negative two's complement number stays negative. This keeps division by 2 correct for signed numbers.

Overflow

For an unsigned 8-bit register the largest value is 11111111=25511111111 = 255, so any addition whose true total exceeds 255 overflows. For example 11111111+0000000111111111 + 00000001 should be 256, which needs the 9 bits 100000000100000000; the leading 1 is lost and the register holds 0000000000000000, the wrong answer. Overflow also strikes shifts: a left shift that pushes a 1 off the left end loses it, so the multiply-by-2 result is wrong. The fixed number of available bits is the root cause, so a question about overflow always comes back to "the result needs more bits than the register holds".

Try this

Q1. Add the 8-bit binary numbers 0000111100001111 and 0000000100000001. [2 marks]

  • Cue. 0001000000010000 (15+1=1615 + 1 = 16).

Q2. State the effect on the denary value of a logical right shift of 1. [1 mark]

  • Cue. It divides the value by 2 (with any bit shifted off the right discarded).

Exam-style practice questions

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

Edexcel 20233 marksAdd together the 8-bit binary numbers 01001101 and 00101011. Give your answer as an 8-bit binary number and show your working.
Show worked answer →

Add column by column from the right, carrying a 1 whenever a column totals 2 or 3.

01001101+0010101101001101 + 00101011: working right to left with carries gives 0111100001111000. Check in denary: 01001101=7701001101 = 77 and 00101011=4300101011 = 43, and 77+43=120=0111100077 + 43 = 120 = 01111000 (64+32+16+864 + 32 + 16 + 8).

Markers reward correct column-by-column carrying, a valid 8-bit answer, and a denary cross-check. One carry error loses a mark even if the method is right, so show every carry.

Edexcel 20223 marksAn 8-bit register holds 11110000. State the result of a logical left shift of 2 and explain the effect on the denary value, including any problem that occurs.
Show worked answer →

A logical left shift of 2 moves every bit two places left and fills the two vacated right-hand positions with 0. So 1111000011110000 becomes 1100000011000000.

A left shift of 2 should multiply by 22=42^2 = 4, but here the two 1s shifted off the left are lost, so the result is wrong: 11110000=24011110000 = 240, and 240×4=960240 \times 4 = 960, which is far too large for 8 bits, so overflow has occurred and the stored value 11000000=19211000000 = 192 is incorrect.

Markers reward the correct shifted pattern, the zero-fill on the right, the multiply-by-4 intention, and recognising the lost bits cause overflow so the answer is wrong.

Related dot points

Sources & how we know this