AQA A-Level Computer Science 7517
Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation
Fundamentals of Data Representation
Fundamentals of Computer Systems
Fundamentals of Computer Organisation and Architecture
Fundamentals of Communication and Networking
Consequences of Uses of Computing
Systematic Approach to Problem Solving
Fundamentals of Databases
Big Data
Fundamentals of Data Representation
Signed binary using two's complement
- 3 things to know
- Paper 2
Overview
Recall questions on what the most significant bit contributes, the invert-and-add-one and copy-and-invert methods, the range formula, and subtraction by addition.
What you need to know
Answer each one before you reveal it.
In eight-bit two's complement, what are −1 and −128, and why is the range lopsided?
Convert +45 and −45 to 8-bit two's complement.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is two's complement, and why is a coding scheme needed at all?
Model answer
Unsigned binary can only hold zero and positive values, so a coding scheme is needed to record negative integers as bit patterns. Two's complement is one such scheme: the most significant bit is given a negative place value of −2ⁿ⁻¹ while all the other bits keep their usual positive place values, so a single pattern encodes the sign and the magnitude together.
- 2
In a two's complement number, what does the most significant bit tell you?
Model answer
It tells you the sign: 0 means the number is zero or positive, 1 means it is negative. It is not merely a flag, though — it carries the place value −2ⁿ⁻¹, so in eight bits it is worth −128, and the value of the number is that weight plus the ordinary positive weights of the remaining bits.
- 3
Convert −5 to an 8-bit two's complement number using the invert-and-add-one method.
Model answer
11111011. Write +5 as 00000101, invert every bit to get 11111010, then add 1 to get 11111011. Checking, the place values are −128 + 64 + 32 + 16 + 8 + 2 + 1 = −5.
- 4
Describe the copy-and-invert shortcut for finding a two's complement negative, and apply it to −5 in 8 bits.
Model answer
Starting from the right-hand end of the positive value, copy the bits up to and including the first 1, then invert every remaining bit to the left. For +5 = 00000101, copy the final 1, then invert the seven bits to its left, 0000010, to 1111101, giving 11111011 — the same answer as invert-and-add-one, but with no addition to get wrong.
- 5
What decimal value does the 8-bit two's complement number 11101100 represent?
Model answer
−20. The most significant bit is 1 so the number is negative. Adding the place values gives −128 + 64 + 32 + 8 + 4 = −20. You can check by negating: inverting gives 00010011, adding 1 gives 00010100 = 20.
- 6
What decimal value does the 8-bit two's complement number 01101100 represent?
Model answer
+108. The most significant bit is 0 so the number is positive and is read exactly like unsigned binary: 64 + 32 + 8 + 4 = 108.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Fundamentals of Data Representation, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.