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.
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
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: (6) shifted left by 1 gives (12, that is ); (20) shifted right by 2 gives (5, that is ). 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 , so any addition whose true total exceeds 255 overflows. For example should be 256, which needs the 9 bits ; the leading 1 is lost and the register holds , 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 and . [2 marks]
- Cue. ().
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.
: working right to left with carries gives . Check in denary: and , and ().
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 becomes .
A left shift of 2 should multiply by , but here the two 1s shifted off the left are lost, so the result is wrong: , and , which is far too large for 8 bits, so overflow has occurred and the stored value 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
- Understand how computers represent and manipulate unsigned integers and two's complement signed integers, and convert between denary and 8-bit binary numbers (0 to 255, and -128 to +127).
A focused answer to Edexcel GCSE Computer Science 2.1.2 and 2.1.3, covering unsigned and two's complement signed integers and converting between denary and 8-bit binary (0 to 255 and -128 to +127).
- Understand that computers use binary to represent data (numbers, text, sound, graphics) and program instructions, and determine the maximum number of states that can be represented by a binary pattern of a given length.
A focused answer to Edexcel GCSE Computer Science 2.1.1, covering why computers use binary to represent all data and instructions, and how to calculate the maximum number of states a binary pattern of a given length can represent.
- Understand why hexadecimal notation is used and convert between hexadecimal and binary.
A focused answer to Edexcel GCSE Computer Science 2.1.6, covering why hexadecimal notation is used as a shorthand for binary and how to convert between hexadecimal, binary and denary.
- Follow and write algorithms that use arithmetic operators (addition, subtraction, division, multiplication, modulus, integer division, exponentiation), relational operators (equal to, less than, greater than, not equal to, less than or equal to, greater than or equal to) and logical operators (AND, OR, NOT).
A focused answer to Edexcel GCSE Computer Science 1.2.3, covering the arithmetic operators including modulus and integer division, the relational operators, and the logical operators AND, OR and NOT in algorithms.
- Understand the von Neumann stored program concept and the role of main memory (RAM), the CPU (control unit, arithmetic logic unit, registers), the clock and the address, data and control buses in the fetch-decode-execute cycle.
A focused answer to Edexcel GCSE Computer Science 3.1.1, covering the von Neumann stored program concept, the roles of RAM, the CPU (control unit, ALU, registers), the clock and the three buses in the fetch-decode-execute cycle.
Sources & how we know this
- Pearson Edexcel GCSE (9-1) Computer Science (1CP2) specification — Pearson (2020)