Revision Notes
OxfordAQA IGCSE Computer Science (9210): Binary arithmetic – Revision Notes
Revision notes for OxfordAQA IGCSE Computer Science 9210 section 3.3.4: binary addition with carries, logical shifts left and right, uses of shifts and a self-test.
- Subject
- Computer Science
- Level
- IGCSE
- Topic
- Topic 3: Data representation
- Author
- Marlbridge Academic Team
- Updated
- Reviewed by
- Harris Khan (what this means)
Aligned to OxfordAQA IGCSE Computer Science (9210), For teaching from September 2017, exams from May/June 2019. Official specification .
Syllabus page (what it covers and how it is assessed): OxfordAQA IGCSE Computer Science.
Syllabus points this page covers
9210
- 3.3.4 Binary arithmetic
This page covers 1 of the 8 subtopics in topic 3, Data representation.
Found an error? Report a correction.
Need help with this topic? Request a free trial class for IGCSE Computer Science (9210).
Condensed notes for section 3.3.4 Binary arithmetic of OxfordAQA International GCSE Computer Science (9210). Worked examples are in the Binary arithmetic study guide.
What the specification asks
- Add two binary numbers. Maximum 8 bits; the answer is at most 8 bits; no carry beyond the eighth bit.
- Apply a binary shift to a binary number. Maximum 8 bits; logical shift only; no fractions.
- Describe situations where shifts are used: simple multiplication or division by powers of 2.
Binary addition rules
| Column sum | Write | Carry |
|---|---|---|
| 0 + 0 | 0 | 0 |
| 0 + 1 | 1 | 0 |
| 1 + 1 | 0 | 1 |
| 1 + 1 + 1 (with a carry in) | 1 | 1 |
Work from the right to the left. Add the two bits and any carry into the column.
Example: 0100 1101 + 0101 0101
(77 + 85 = 162)
| Column | Bit 1 | Bit 2 | Carry in | Result | Carry out |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 0 | 1 |
| 2 | 0 | 0 | 1 | 1 | 0 |
| 3 | 1 | 1 | 0 | 0 | 1 |
| 4 | 1 | 0 | 1 | 0 | 1 |
| 5 | 0 | 1 | 1 | 0 | 1 |
| 6 | 0 | 0 | 1 | 1 | 0 |
| 7 | 1 | 1 | 0 | 0 | 1 |
| 8 | 0 | 0 | 1 | 1 | 0 |
Reading from column 8 to column 1 gives 1010 0010, which is 128 + 32 + 2 = 162.
Check: convert the numbers and the answer to decimal. Make sure no carry is forgotten.
Logical binary shifts
A shift moves all the bits sideways. Empty places are filled with 0. Bits shifted off the end are lost.
| Shift | Bits | Value |
|---|---|---|
| Left by n | Move left; n zeros enter on the right | × 2ⁿ |
| Right by n | Move right; n zeros enter on the left | ÷ 2ⁿ, whole-number part only |
Examples
| Start | Shift | Result | Meaning |
|---|---|---|---|
| 0000 0101 (5) | Left 3 | 0010 1000 (40) | 5 × 8 |
| 0001 0110 (22) | Left 1 | 0010 1100 (44) | 22 × 2 |
| 0000 1001 (9) | Left 2 | 0010 0100 (36) | 9 × 4 |
| 1100 1000 (200) | Right 2 | 0011 0010 (50) | 200 ÷ 4 |
| 1011 0000 (176) | Right 4 | 0000 1011 (11) | 176 ÷ 16 |
| 0001 0101 (21) | Right 2 | 0000 0101 (5) | 21 ÷ 4 = 5.25, so 5 |
Bits lost
- A left shift can push a 1 off the left end. 0010 0011 (35) shifted left by 3 gives 0001 1000 (24), not 280, because the leading 1 has been lost.
- A right shift loses the right-hand bits, so 21 shifted right by 2 gives 5, not 5.25. The remainder is discarded.
Uses of shifts
- Multiply a whole number by 2, 4, 8, 16 … (left shift by 1, 2, 3, 4 …).
- Divide a whole number by 2, 4, 8, 16 … (right shift) and keep the whole-number part.
- A quick operation for a processor compared with a general multiplication.
Sentence to use: “A left shift by n places multiplies by 2 to the power n; a right shift by n places divides by 2 to the power n.”
Checking by converting to decimal
Convert both numbers and the answer to decimal. For 0100 1101 + 0101 0101, 77 + 85 = 162, and 1010 0010 = 128 + 32 + 2 = 162, so the addition is right. For a shift, multiply or divide by the power of 2 and compare: 0000 0101 shifted left by 3 is 5 × 8 = 40 = 0010 1000.
Exam traps
- Forgetting a carry. 1 + 1 is 0 with a carry of 1.
- Writing 1 + 1 = 2 in a column of the answer.
- Adding from the left. Start at the right.
- Not filling shifted places with 0. The answer must have eight bits.
- Wrong direction. Left multiplies, right divides.
- Keeping a lost bit. A 1 shifted out of the left end is gone.
- Giving a fraction after a right shift. The shift discards the remainder.
- Using other shifts. Only the logical shift is on the specification.
- Only saying “faster”. Say that it multiplies or divides by a power of 2.
Key terms
| Term | Meaning |
|---|---|
| Carry | The 1 passed to the next column when a column totals 2 or more |
| Logical shift | A shift where empty places are filled with 0 and bits that fall off the end are lost |
| Power of 2 | 2, 4, 8, 16 and so on |
| Overflow | A result too large to fit in the available bits |
Self-test
- Add 0000 0101 and 0000 0011.
- Add 0101 1011 and 0010 0100.
- Add 0001 1011 and 0000 0111.
- Add 0011 0110 and 0100 1010 and state the decimal value of the answer.
- Shift 0000 0110 left by 2 and state the decimal result.
- Shift 0110 1000 right by 3 and state the decimal result.
- Shift 0000 1101 right by 2 and explain why the result is not 3.25.
- State what a left shift by 3 does to the value.
- Explain why shifting 1100 0000 left by 1 does not double the value.
- State one use of a binary shift.
Answers:
- 0000 1000 (5 + 3 = 8).
- 0111 1111 (91 + 36 = 127).
- 0010 0010 (27 + 7 = 34).
- 1000 0000, which is 128 (54 + 74).
- 0001 1000, which is 24.
- 0000 1101, which is 13 (104 ÷ 8).
- The result is 0000 0011, which is 3, because the bits shifted out of the right-hand end are lost, and so the remainder is discarded.
- Multiplies it by 8.
- The leading 1 is shifted out of the left end and lost, so the result is 1000 0000 (128), not 384, which does not fit in 8 bits.
- For example, a quick way to multiply or divide by a power of 2.
More resources on this topic
Related resources
-
Study guides
OxfordAQA IGCSE Computer Science (9210): Character encoding – Study Guide
Study guide to OxfordAQA IGCSE Computer Science 9210 section 3.3.5: character sets, 7-bit ASCII, Unicode, using encoding tables and calculating codes in sequence.
Computer Science · OxfordAQA · IGCSE
Read guide -
Practice questions
OxfordAQA IGCSE Computer Science (9210): Character encoding – Practice Questions
Original OxfordAQA IGCSE Computer Science 9210 practice questions with answers on character sets, 7-bit ASCII codes, sequences of codes and Unicode.
Computer Science · OxfordAQA · IGCSE
Try questions -
Revision notes
OxfordAQA IGCSE Computer Science (9210): Character encoding – Revision Notes
Revision notes for OxfordAQA IGCSE Computer Science 9210 section 3.3.5: character sets, 7-bit ASCII, Unicode, using encoding tables, sequences and a self-test.
Computer Science · OxfordAQA · IGCSE
Revise topic
Get free revision emails (optional)
Occasional emails with practice questions, worked explanations and links to free resources for the qualification and subjects you choose. No spam, and you can unsubscribe from any email. The free tools on this site never need an email.