(a) Convert the denary number 141 to an 8-bit binary number. Show your working.
[2]
(b) Negative denary numbers can be represented in binary using two's complement.
Complete the 8-bit binary representation for the negative denary number -58. Show all your working.
[3]
(c) Two 8-bit binary numbers are given below. Add these two numbers together using binary addition. Show all your working, including any carry bits.
01101100
+ 00111010
[3]
(d) Explain what is meant by a binary overflow error and describe how it can occur during the addition of two 8-bit binary numbers.
[3]
Show answer & marking schemeHide answer & marking scheme
Worked solution
- 141 >= 128, so the 128-bit is 1 (Remaining: 141 - 128 = 13)
- 13 < 64, so the 64-bit is 0
- 13 < 32, so the 32-bit is 0
- 13 < 16, so the 16-bit is 0
- 13 >= 8, so the 8-bit is 1 (Remaining: 13 - 8 = 5)
- 5 >= 4, so the 4-bit is 1 (Remaining: 5 - 4 = 1)
- 1 < 2, so the 2-bit is 0
- 1 >= 1, so the 1-bit is 1 (Remaining: 0)
Result: 10001101
(b) To represent -58 using 8-bit two's complement:
1. Represent +58 in 8-bit binary: 00111010
2. Invert (flip) all bits (one's complement): 11000101
3. Add 1 to the result: 11000101 + 1 = 11000110
Result: 11000110
(c) Perform binary addition:
Carries: 11110000
01101100 (108)
+ 00111010 (58)
-----------
10100110 (166)
Result: 10100110
(d) An overflow error occurs when the sum of two binary numbers exceeds the maximum value that can be represented within the system's bit limit (for an 8-bit unsigned system, this is 255). A carry-out is generated from the most significant bit (MSB), requiring a 9th bit. Since the register only holds 8 bits, the 9th bit is lost, leading to an incorrect result.
Marking scheme
- 1 mark for correct working (e.g. division by 2 or subtraction of powers of 2).
- 1 mark for correct final 8-bit binary value: 10001101.
(b) [3 marks total]:
- 1 mark for converting +58 correctly to binary (00111010).
- 1 mark for showing correct method (inverting bits and adding 1).
- 1 mark for correct final two's complement representation: 11000110.
(c) [3 marks total]:
- 1 mark for showing correct carry bits (at least 3 correct carries shown).
- 1 mark for correct left-hand nibble (1010).
- 1 mark for correct right-hand nibble (0110).
(d) [3 marks total]:
- 1 mark for definition: An error that occurs when a calculation produces a value that exceeds the register storage capacity.
- 1 mark for context: The register has a fixed/predetermined size of 8 bits.
- 1 mark for cause: Adding two numbers produces a result greater than 255 (or a 9th bit is generated/carried out of the MSB) which cannot be stored.