How do computers add binary numbers and shift the bits?
Add binary numbers up to and including three 8-bit numbers, recognise overflow, and apply logical and arithmetic binary shifts.
A focused answer to AQA GCSE Computer Science 3.3.2, covering binary addition of up to three 8-bit numbers, overflow, and logical and arithmetic binary shifts.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
What this dot point is asking
AQA wants you to add binary numbers (up to three 8-bit numbers in one calculation), recognise when overflow occurs, and carry out logical and arithmetic binary shifts, knowing the effect each shift has on the value.
Binary addition
When AQA asks you to add up to three 8-bit numbers, the safest method is to add them in pairs rather than trying to total three bits plus a carry in one column (which can give a column total of 4, needing a carry of 2). Add the first two numbers, then add the third to that running total. This keeps each column total at 3 or less, so the carry is never more than 1.
The reason the method matters is that the processor does exactly this inside its arithmetic logic unit (ALU): a full adder circuit adds two bits plus a carry-in and produces a sum bit and a carry-out. The carry-out feeds the next column, which is why addition is done right to left.
Overflow
For an unsigned 8-bit register the largest value is . Any addition whose true total exceeds 255 produces overflow. For example should be 256, which needs the 9 bits ; the leading 1 is lost and the register holds , the wrong answer. Computers detect this with an overflow (or carry) flag in the status register, which a program can test.
Binary shifts
Shifting is far faster for the CPU than full multiplication or division, which is why compilers replace multiply-by-power-of-two with a shift. An arithmetic shift preserves the sign of a signed (two's complement) number, but AQA 8525 only requires logical shifts, so always fill with zeros and read the question for the direction and number of places.
For example, shifting (6) left by one gives (12), and shifting (20) right by two gives (5, that is ).
Try this
Q1. Add the 8-bit binary numbers and . [2 marks]
- Cue. ().
Q2. State the effect on the denary value of shifting a binary number left by two places. [1 mark]
- Cue. It multiplies the value by 4 ().
Exam-style practice questions
Practice questions written in the style of AQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
AQA 20224 marksAdd together the three 8-bit binary numbers 00101100, 00010011 and 00001001. Show your working and give your answer as an 8-bit binary number.Show worked answer →
Add the numbers one pair at a time, working right to left and carrying when a column totals 2 or 3.
First add (). Then add the third number: ().
The final answer is , which is in denary, confirming the result.
Markers reward correct column-by-column carrying, a valid 8-bit answer, and a denary cross-check. One mark is lost for a single carry error even if the method is sound, so show every carry.
AQA 20193 marksA programmer applies a logical right shift of 2 to the 8-bit value 11001000. State the result and explain the effect this has on the denary value.Show worked answer →
A logical right shift of 2 moves every bit two places right and fills the two vacated leftmost positions with 0. So becomes .
In denary and , so the value has been divided by ().
Markers reward the correct shifted pattern, the zero-fill on the left, and stating that a right shift of divides by (here divide by 4). Note that because the two bits shifted off the right were both 0, no precision was lost.
Related dot points
- Understand the binary, denary and hexadecimal number bases, why computers use binary, and convert between binary and denary.
A focused answer to AQA GCSE Computer Science 3.3.1, covering the binary, denary and hexadecimal number bases, why computers use binary, and how to convert between binary and denary.
- Understand hexadecimal, convert between binary, denary and hexadecimal, and explain why hexadecimal is used.
A focused answer to AQA GCSE Computer Science 3.3.3, covering hexadecimal, converting between binary, denary and hexadecimal, and why hexadecimal is used.
- Know that data is stored in bits and bytes, the units from bit to terabyte, and calculate file sizes and storage requirements.
A focused answer to AQA GCSE Computer Science 3.3.4, covering bits and bytes, the units from bit to terabyte, and calculating file sizes and storage requirements.
- Understand the purpose and components of the CPU, the fetch-execute cycle, and the factors that affect CPU performance.
A focused answer to AQA GCSE Computer Science 3.4.3, covering the purpose and components of the CPU, the fetch-execute cycle, and the factors that affect CPU performance.
Sources & how we know this
- AQA GCSE Computer Science (8525) specification — AQA (2020)