AQA GCSE CS · 3.3.3
Binary Arithmetic and Shifts
Name
Class
Date
Mark / 21
Section A
Circle the letter of the correct answer. One mark each.
- 1What is 01011100 + 00101101 in binary?1
- A01111001
- B10000101
- C10001001
- D10001011
- 2What is the result of 1 + 1 + 1 in one binary column?1
- A3
- B0 carry 1
- C1 carry 0
- D1 carry 1
- 3When does overflow occur?1
- AWhen a program divides by zero
- BWhen the result needs more bits than are available
- CWhen a shift moves bits to the right
- DWhen two negative numbers are added
- 4What is 00010110 shifted left by 2 places?1
- A00000101
- B00101100
- C01011000
- D10110000
- 5What happens to a bit that is shifted off the end of a register?1
- AIt is discarded
- BIt is stored in a carry flag permanently
- CIt becomes the sign bit
- DIt wraps round to the other end
- 6What is 00011011 shifted right by 1 place, and what does it show in denary?1
- A10001101, showing 27 becomes 141
- B00001110, showing 27 becomes 14
- C00110110, showing 27 becomes 54
- D00001101, showing 27 becomes 13
- 7Why does a left shift of one place multiply a binary number by two?1
- ABecause binary uses only two digits
- BEach place value is twice the one to its right
- CBecause a zero is added on the right
- DBecause the most significant bit is doubled
- 8A program adds two 8 bit values and stores 00000010, but the correct answer is 258. What has happened?1
- AA right shift was applied
- BThe values were added in the wrong order
- CThe carry row was written incorrectly
- DOverflow, and the ninth bit has been lost
- 9Why do processors use shifts instead of multiplication where they can?1
- AA shift is a single hardware operation and is much faster
- BShifts use fewer bits of storage
- CA shift gives a more accurate answer
- DMultiplication is not supported by most processors
- 10What is 11000000 + 01000000 in 8 bits?1
- A01000000
- B100000000
- C00000000 with overflow
- D10000000
Section B
Answer in the space provided. The number of marks tells you how many separate points to make.
- 1AddAdd the binary numbers 00110110 and 01001101. Give your answer in binary.2
- 2ExplainExplain what is meant by overflow, and why it is a problem.3
- 3GiveThe binary value 00101100 is shifted left by two places. Give the result and explain the effect on the denary value.3
- 4ExplainExplain why a right shift can produce a result that is not exactly the original value divided by two.3
Mark scheme
Section A
Section B
1 Add the binary numbers 00110110 and 01001101. Give your answer in binary. 2
One mark for each of the following, to a maximum of 2.
- Shows column addition with the carries
- Gives the answer 10000011
Model answer. Working from the right: 0 plus 1 is 1, 1 plus 0 is 1, 1 plus 1 is 0 carry 1, 0 plus 1 plus the carry is 0 carry 1, 1 plus 0 plus the carry is 0 carry 1, 1 plus 0 plus the carry is 0 carry 1, 0 plus 1 plus the carry is 0 carry 1, and 0 plus 0 plus the carry is 1. The answer is 10000011, which is 131, and 54 plus 77 does equal 131.
2 Explain what is meant by overflow, and why it is a problem. 3
One mark for each of the following, to a maximum of 3.
- The result of the calculation needs more bits than are available
- A carry is produced out of the most significant bit and is lost
- The value stored is therefore incorrect, and usually no error is reported
Model answer. Overflow occurs when the result of a calculation is too large to be represented in the number of bits allocated to it. A carry is produced out of the most significant bit, and because there is no further bit to hold it the carry is simply discarded. The value that ends up stored is therefore wrong. What makes this a serious problem rather than a minor one is that the program normally carries on running with no error reported at all, so the incorrect value is used in later calculations and the fault can go unnoticed for a long time.
3 The binary value 00101100 is shifted left by two places. Give the result and explain the effect on the denary value. 3
One mark for each of the following, to a maximum of 3.
- Gives the result 10110000
- States that a left shift of two multiplies by four
- Relates it to the denary values, 44 becomes 176
Model answer. Shifting every bit two places to the left and filling the two vacated positions on the right with zeros gives 10110000. Each place a value is shifted left doubles it, because every column is worth twice the one to its right, so a shift of two places multiplies by four. In denary the original value is 44, and 44 times four is 176, which is what 10110000 represents.
4 Explain why a right shift can produce a result that is not exactly the original value divided by two. 3
One mark for each of the following, to a maximum of 3.
- Bits shifted off the right hand end are discarded
- For an odd number the least significant bit is a 1, which represents the remainder
- So the result is the integer part of the division and precision is lost
Model answer. A right shift moves every bit one place towards the least significant end, and the bit that moves out of the rightmost position is discarded rather than stored anywhere. For an even number that bit is a 0 and nothing is lost, so the division by two is exact. For an odd number the least significant bit is a 1, and that 1 represents the remainder of the division. Discarding it means the result is the whole number part of the division only, so 25 shifted right by one gives 12 rather than 12.5 and precision has been lost.