How are signed integers represented in two's complement, and how do you convert between denary and 8-bit binary?
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).
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
Edexcel wants you to represent whole numbers in binary both as unsigned integers (0 and up) and as two's complement signed integers (which can be negative), and to convert fluently between denary and 8-bit binary, covering the unsigned range 0 to 255 and the signed range -128 to +127.
Unsigned integers and conversion
Binary to denary is direct addition: . Denary to binary is repeated subtraction: for 100, 64 fits (leaving 36), 32 fits (leaving 4), 4 fits (leaving 0), giving . Always pad the answer to the requested number of bits (8 bits here), and cross-check by adding the place values back.
Two's complement signed integers
The clever part is that ordinary binary addition then works for negative numbers with no special cases, which is why processors use two's complement. The most significant bit doubles as a sign bit: 0 means positive (or zero), 1 means negative. To read a negative two's complement value, add the place values as usual but treat the leftmost as -128: .
Finding a two's complement representation
Ranges to remember
These ranges are worth memorising because questions often ask whether a value "fits". For example, +200 cannot be stored as an 8-bit two's complement number, because the maximum is +127; it would need more bits or an unsigned representation.
Try this
Q1. Convert the 8-bit two's complement number to denary. [1 mark]
- Cue. -1, because .
Q2. State the range of values that 8-bit two's complement can represent. [1 mark]
- Cue. -128 to +127.
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 marksConvert the denary number 75 into an 8-bit unsigned binary number. Show your working.Show worked answer β
Use the 8-bit place values 128, 64, 32, 16, 8, 4, 2, 1 and subtract the largest that fits, working left to right.
75 is less than 128 (place value 0). 64 fits, (bit 1). 32 does not fit (0). 16 does not fit (0). 8 fits, (bit 1). 4 does not fit (0). 2 fits, (bit 1). 1 fits, (bit 1).
So . Checking: .
Markers reward the correct place-value method, an 8-bit answer, and a denary cross-check. The result must be padded to 8 bits.
Edexcel 20223 marksUsing 8-bit two's complement, give the binary representation of -40. Show your method.Show worked answer β
Convert +40 to binary, then apply the two's complement method (invert all bits, then add 1).
. Invert: . Add 1: .
So in 8-bit two's complement. Check: the leftmost bit is 1 (negative), and the value is .
Markers reward converting +40 correctly, inverting all 8 bits, adding 1, and a valid 8-bit answer (with the sign bit set). Stating the most significant bit has place value -128 supports the check.
Related dot points
- 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.
- 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.
- 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.
- Understand how computers encode characters using 7-bit ASCII.
A focused answer to Edexcel GCSE Computer Science 2.2.1, covering how computers encode characters using a character set, the 7-bit ASCII system, its 128 codes, and the ordering of letters and digits.
- 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.
Sources & how we know this
- Pearson Edexcel GCSE (9-1) Computer Science (1CP2) specification β Pearson (2020)