TopMyGrade

GCSE/Computer Science/AQA

CS3.4Binary arithmetic: addition of two 8-bit numbers; binary shifts (left/right) and their multiplicative effect; overflow

Notes

Binary arithmetic and shifts

Computers add, subtract, multiply and divide using binary. AQA's GCSE focuses on three things: 8-bit binary addition, binary shifts (left and right), and recognising overflow.

8-bit binary addition

Add bits column by column, right-to-left, just like decimal — but with the rules:

ABA+BCarry
0000
0110
1010
1101
1+1+1 (with carry-in)11

Worked example: 01101010 + 00010111.

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

Result: 10000001 (= 129 decimal). Verify: 106 + 23 = 129. ✓

Overflow

The result of an 8-bit addition has at most 8 bits. If the carry "spills off" the most significant bit, the answer can't be represented in 8 bits — this is overflow.

Worked example: 11111111 + 00000001.

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

The 9th bit (1) is dropped, giving 8-bit result 00000000. The hardware sets an overflow flag to signal this.

In an exam, when you spot the carry leaving the MSB column, write "overflow" — the answer is wrong (or wraps around) without more bits.

Binary shifts

A shift moves all bits left or right by a stated number of places, filling the gap with 0.

Left shift

Each left shift multiplies by 2.

00010110 << 1 = 00101100   (22 → 44)
00010110 << 2 = 01011000   (22 → 88)

Why? Each bit's place value doubles when it moves one column to the left.

Right shift

Each right shift divides by 2, discarding any remainder.

01100100 >> 1 = 00110010   (100 → 50)
01100100 >> 2 = 00011001   (100 → 25)
01100100 >> 3 = 00001100   (100 → 12, integer division of 12.5)

The bit shifted off the right end is lost — that's why right shifts of odd numbers lose precision.

Worked exampleWorked example — multiply by 8

Multiply 13 by 8 using shifts. 13 = 00001101. 00001101 << 3 (= shift left by 3 = × 8) = 01101000 = 64 + 32 + 8 = 104. ✓

Worked exampleWorked example — overflow with shift

Left-shift 11000000 by 1: the 1 in the MSB is lost.

11000000 << 1 → 10000000   (with overflow — original MSB lost)

192 × 2 should be 384 but we get 128. The shift caused overflow.

Why hardware uses shifts

Multiplication by powers of 2 by shifting is vastly faster than full multiplication — it's a simple bit movement, no adder required. Compilers optimise multiplications by known powers of 2 to shifts automatically.

Common mistakesPitfalls

  1. Forgetting the carry chain. Bits 1+1+1 → write 1, carry 1.
  2. Treating right shift like floor division and being surprised by integer-only result. 5 >> 1 = 2, not 2.5.
  3. Ignoring overflow. A 1 leaving the MSB column means the result needs more bits.
  4. Wrong direction shift. Left = ×2, Right = ÷2 — easy to confuse.
  5. Forgetting to fill with 0. Logical shifts always insert a 0 in the vacated bit; arithmetic shift on signed numbers fills differently (beyond GCSE).

Worked exampleWorked example — full 8-bit add with overflow

Add 10000001 + 10000010.

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

The leading 1 is the 9th bit — overflow. The 8-bit result wraps to 00000011.

Try thisQuick check

Compute 00111011 + 00010100 and state if there's overflow.

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

Result: 01001111 (= 79). No carry past the MSB → no overflow.

AI-generated · claude-opus-4-7 · v3-deep-computer-science

Practice questions

Try each before peeking at the worked solution.

  1. Question 13 marks

    8-bit addition

    Calculate 00110101 + 00101010 in 8-bit binary and convert your answer to denary.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  2. Question 24 marks

    Overflow detection

    Calculate 11001100 + 01000100 in 8-bit binary. State whether overflow occurs.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  3. Question 33 marks

    Left shift effect

    (a) Apply a logical left shift of 2 to 00001011.
    (b) State what arithmetic effect this has and verify with denary.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  4. Question 43 marks

    Right shift effect

    (a) Apply a logical right shift of 1 to 00010111.
    (b) Convert both before and after to denary and explain the loss of precision.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  5. Question 53 marks

    Multiply with shifts

    Multiply the 8-bit number 00001001 by 8 using shifts. State your answer in binary and denary.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  6. Question 63 marks

    Why shifts are fast

    Explain why CPUs use binary shifts to perform multiplication by powers of 2 instead of full multiplication.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

  7. Question 74 marks

    Shift causing overflow

    A pupil left-shifts the 8-bit number 11000000 by 1 to multiply by 2. State the result and explain why the answer is wrong.

    Ask AI about this

    AI-generated · claude-opus-4-7 · v3-deep-computer-science

Flashcards

CS3.4 — Binary arithmetic and shifts

11-card SR deck for AQA GCSE Computer Science topic CS3.4

11 cards · spaced repetition (SM-2)