Skip to content
FocusED
Get started

Free Computer Science practice · 9618 information representation

Binary and two’s complement worksheet

A clear method, two worked examples and twelve questions to try yourself. Learn what an eight-bit word means before deciding whether its arithmetic is correct.

  • 12 questions
  • 24 marks
  • About 30 minutes
  • No account needed

Original FocusED practice for part of Cambridge International AS & A Level Computer Science 9618, section 1.1. This is not an official paper or mark scheme, and it is not accredited or endorsed by Cambridge.

01 / Understand the representation

The bits stay the same. Their interpretation matters.

A bit is 0 or 1. In an unsigned eight-bit word, the leftmost position is worth 128. In eight-bit two’s complement, that same position has weight −128. The remaining seven weights are unchanged. Always state the word length and whether the number is signed.

Weights from left to right
FormatBit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Unsigned1286432168421
Two’s complement-1286432168421

Eight bits give 256 patterns.

Unsigned values run from 0 to 255. Two’s-complement values run from −128 to +127. A leading 1 means a negative value in this signed format, but the remaining bits are not its ordinary positive magnitude.

To negate a representable value in a fixed word, invert every bit and add 1, retaining the stated width. Check the result using signed weights. The smallest negative value is the exception: +128 does not fit in eight-bit two’s complement, as question 12 explores.

Worked example 1: represent −26

Start with +26 in eight bits: 00011010, because 16 + 8 + 2 = 26. Invert every bit to get 11100101. Add 1 to get 11100110. Keep all eight positions.

Check using the signed weights: −128 + 64 + 32 + 4 + 2 = −26. The leftmost bit has weight −128; it is not a separate minus sign attached to a seven-bit magnitude.

Negate a representable eight-bit value
+26 in eight bits00011010
Invert every bit11100101
Add 1: the representation of −2611100110

To check a signed word, add the weights of its 1 bits using −128 for the leftmost position.

Worked example 2: calculate 18 − 31

Rewrite subtraction as 18 + (−31). Positive 18 is 00010010. Positive 31 is 00011111, so its two’s-complement negative is 11100001.

Add 00010010 + 11100001 = 11110011. Signed decoding gives −128 + 64 + 32 + 16 + 2 + 1 = −13. The result agrees with 18 − 31 and is inside the eight-bit signed range, so there is no signed overflow.

  00010010   +18
+ 11100001   −31
──────────
  11110011   −13

Check overflow against the signed range.

Signed overflow means the exact answer lies outside −128 to +127. When adding two positive operands, a negative stored result signals overflow; when adding two negative operands, a non-negative stored result signals overflow. Adding opposite signs cannot overflow the signed range. A carry out is a separate unsigned-arithmetic observation.

A reliable signed-arithmetic routine
  1. State the interpretation

    Use eight-bit two’s complement and its range −128 to +127.

  2. Encode and calculate

    Represent both operands, add their bit patterns and retain the eight result bits.

  3. Check independently

    Decode the stored pattern and compare with the exact denary result; decide whether signed overflow occurred.

A carry out is separate from signed overflow. The interpretation and available word length decide whether the exact answer can be represented.

02 / Try it independently

Twelve questions. Keep your working.

Use eight-bit two’s complement whenever the question specifies a signed interpretation. Hexadecimal is labelled explicitly. Write your answer on paper or in your own notes before opening a solution. Each question is worth 2 marks.

A printed copy includes writing space and a separate answer key after the questions. Keep the answer pages aside until you have finished.

  1. Q01 Read an unsigned word

    2 marks

    Convert unsigned binary 10110110 to denary. Show the place values you add.

    Check answer and working for question 1

    182

    The 1 bits select 128, 32, 16, 4 and 2. Their sum is 128 + 32 + 16 + 4 + 2 = 182. This question specifies unsigned interpretation.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: a correct place-value expansion using the set bits.
    • 1 mark: the denary result 182.
  2. Q02 Keep all eight positions

    2 marks

    Represent denary 93 as eight-bit unsigned binary. Show a place-value decomposition or an equivalent conversion method.

    Check answer and working for question 2

    01011101

    93 = 64 + 16 + 8 + 4 + 1. Under the weights 128, 64, 32, 16, 8, 4, 2, 1 this gives 0, 1, 0, 1, 1, 1, 0, 1. The leading zero keeps the stated eight-bit width.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: a correct conversion method, such as 64 + 16 + 8 + 4 + 1.
    • 1 mark: the complete eight-bit result 01011101.
  3. Q03 Use hexadecimal groups

    2 marks

    Convert hexadecimal A7 to eight-bit binary. Make the two four-bit groups clear.

    Check answer and working for question 3

    1010 0111

    Hexadecimal A represents ten, so its four-bit group is 1010. Hexadecimal 7 becomes 0111. Joining the groups gives 10100111; do not drop the zero at the start of the second group.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: A becomes the four-bit group 1010.
    • 1 mark: 7 becomes 0111, giving 1010 0111 overall.
  4. Q04 Interpret a negative value

    2 marks

    Interpret 11101100 as an eight-bit two’s-complement integer. Show how you obtain the denary value.

    Check answer and working for question 4

    −20

    Use −128 + 64 + 32 + 8 + 4 = −20. Alternatively, invert 11101100 to obtain 00010011 and add 1 to obtain 00010100, whose magnitude is 20; the original word is negative.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: a valid signed-weight calculation or invert-and-add-one method.
    • 1 mark: the signed denary result −20.
  5. Q05 Encode a negative value

    2 marks

    Represent −45 in eight-bit two’s complement. Show the negation steps from +45.

    Check answer and working for question 5

    11010011

    +45 is 00101101. Invert to obtain 11010010, then add 1 to obtain 11010011. Checking the signed weights gives −128 + 64 + 16 + 2 + 1 = −45.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: +45 = 00101101 and a valid inversion/add-one method.
    • 1 mark: the final eight-bit word 11010011.
  6. Q06 State the signed range

    2 marks

    State the smallest and largest denary integers representable in eight-bit two’s complement.

    Check answer and working for question 6

    Smallest −128; largest +127

    The smallest word is 10000000, worth −128. The largest is 01111111, worth 64 + 32 + 16 + 8 + 4 + 2 + 1 = 127. The range is asymmetric because zero is included and each of the 256 patterns represents one value.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: the minimum is −128.
    • 1 mark: the maximum is +127.
  7. Q07 Subtract by adding a negative

    2 marks

    Calculate 37 − 52 using eight-bit two’s complement. Give the stored result bits and their signed denary interpretation.

    Check answer and working for question 7

    11110001, representing −15

    +37 is 00100101. +52 is 00110100, so −52 is 11001100. Adding 00100101 + 11001100 gives 11110001. Decode −128 + 64 + 32 + 16 + 1 = −15. The exact result fits, so no signed overflow occurs.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: the eight-bit result 11110001 from signed subtraction.
    • 1 mark: its signed denary interpretation −15.
  8. Q08 Recognise positive signed overflow

    2 marks

    An eight-bit two’s-complement processor adds +100 and +40. Give its stored eight-bit result and explain whether signed overflow occurs.

    Check answer and working for question 8

    10001100; signed overflow occurs

    01100100 + 00101000 = 10001100. The exact denary answer is 140, outside the maximum +127. The stored pattern decodes to −116: two positive operands have produced a negative signed result.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: the stored result 10001100.
    • 1 mark: signed overflow, justified by 140 exceeding +127 or by two positive operands producing a negative stored result.
  9. Q09 Recognise negative signed overflow

    2 marks

    Add −60 and −75 in eight-bit two’s complement. Retain the low eight result bits, and explain whether signed overflow occurs.

    Check answer and working for question 9

    01111001; signed overflow occurs

    −60 is 11000100 and −75 is 10110101. Their full binary sum is 1 01111001; the stored eight bits are 01111001, which decode to +121. The exact result −135 is below −128, so signed overflow occurred. The carry out does not repair the stored signed value.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: the stored eight bits 01111001.
    • 1 mark: signed overflow, justified by −135 being below −128 or by two negative operands producing a positive stored result.
  10. Q10 Preserve the value in a wider word

    2 marks

    Extend eight-bit two’s-complement 11101100 to sixteen bits without changing its value. Explain which bits you add on the left.

    Check answer and working for question 10

    11111111 11101100

    Repeat the original sign bit, which is 1, in the eight new leftmost positions. The sixteen-bit word is 1111111111101100 and still represents −20. Adding zeros on the left would instead make the signed sixteen-bit value +236.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: the sixteen-bit result 1111111111101100.
    • 1 mark: repeat the sign bit 1 on the left to preserve the negative value.
  11. Q11 Separate carry from signed overflow

    2 marks

    Adding 11111111 and 00000001 produces a carry out and stored bits 00000000. Interpret the operands as eight-bit two’s complement: state the signed calculation and whether signed overflow occurred.

    Check answer and working for question 11

    −1 + 1 = 0; no signed overflow

    11111111 represents −1, not unsigned 255, under the stated signed interpretation. The calculation is −1 + 1 = 0, exactly represented by 00000000. The carry out would signal an out-of-range result for unsigned 255 + 1, but it does not by itself establish signed overflow.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: the signed calculation −1 + 1 = 0.
    • 1 mark: no signed overflow because the exact signed answer 0 fits; a carry out alone is insufficient.
  12. Q12 Explain the smallest-value exception

    2 marks

    A student negates the eight-bit two’s-complement word 10000000 by inverting and adding 1, then claims the result represents +128. Give the resulting eight bits and explain the error.

    Check answer and working for question 12

    10000000 again; +128 cannot be represented in eight-bit two’s complement

    Inversion gives 01111111; adding 1 gives 10000000. The original value is −128, while its mathematical negative +128 lies outside the eight-bit signed range. The retained word still decodes as −128, so this fixed-width negation cannot represent the required positive result.

    Original FocusED self-check scheme · 2 marks

    • 1 mark: invert-and-add-one retains 10000000.
    • 1 mark: +128 exceeds the signed maximum +127, so the word cannot mean +128 in this format.

03 / Review the reasoning

Use the marks to find your next practice step.

Award each listed mark once, using the stated criterion. A different correct method can earn the corresponding method mark. Add the twelve question scores for a total out of 24. This is a learning check, not a predicted examination grade.

  • Conversions: if questions 1–3 were difficult, write every place value and preserve four-bit hexadecimal groups.
  • Negative values: for questions 4–7, 10 and 12, check the word length, sign weight and signed range.
  • Overflow: for questions 8, 9 and 11, compare the exact signed answer with the permitted range before interpreting a carry.

Choose one error, explain why it happened, then retry that question without looking. Correct reasoning is more useful than remembering one bit pattern.

Continue the same topic in FocusED

The existing 9618 course starts with number systems and information representation, then follows its syllabus sequence.

Open the 9618 data-representation lessons

Original FocusED self-check scheme. Twelve questions, 2 marks each; total 24 marks. Equivalent correct working is acceptable. This is not an official Cambridge mark scheme.

Question 1 · Read an unsigned word

182

The 1 bits select 128, 32, 16, 4 and 2. Their sum is 128 + 32 + 16 + 4 + 2 = 182. This question specifies unsigned interpretation.

Original FocusED self-check scheme · 2 marks

  • 1 mark: a correct place-value expansion using the set bits.
  • 1 mark: the denary result 182.

Question 2 · Keep all eight positions

01011101

93 = 64 + 16 + 8 + 4 + 1. Under the weights 128, 64, 32, 16, 8, 4, 2, 1 this gives 0, 1, 0, 1, 1, 1, 0, 1. The leading zero keeps the stated eight-bit width.

Original FocusED self-check scheme · 2 marks

  • 1 mark: a correct conversion method, such as 64 + 16 + 8 + 4 + 1.
  • 1 mark: the complete eight-bit result 01011101.

Question 3 · Use hexadecimal groups

1010 0111

Hexadecimal A represents ten, so its four-bit group is 1010. Hexadecimal 7 becomes 0111. Joining the groups gives 10100111; do not drop the zero at the start of the second group.

Original FocusED self-check scheme · 2 marks

  • 1 mark: A becomes the four-bit group 1010.
  • 1 mark: 7 becomes 0111, giving 1010 0111 overall.

Question 4 · Interpret a negative value

−20

Use −128 + 64 + 32 + 8 + 4 = −20. Alternatively, invert 11101100 to obtain 00010011 and add 1 to obtain 00010100, whose magnitude is 20; the original word is negative.

Original FocusED self-check scheme · 2 marks

  • 1 mark: a valid signed-weight calculation or invert-and-add-one method.
  • 1 mark: the signed denary result −20.

Question 5 · Encode a negative value

11010011

+45 is 00101101. Invert to obtain 11010010, then add 1 to obtain 11010011. Checking the signed weights gives −128 + 64 + 16 + 2 + 1 = −45.

Original FocusED self-check scheme · 2 marks

  • 1 mark: +45 = 00101101 and a valid inversion/add-one method.
  • 1 mark: the final eight-bit word 11010011.

Question 6 · State the signed range

Smallest −128; largest +127

The smallest word is 10000000, worth −128. The largest is 01111111, worth 64 + 32 + 16 + 8 + 4 + 2 + 1 = 127. The range is asymmetric because zero is included and each of the 256 patterns represents one value.

Original FocusED self-check scheme · 2 marks

  • 1 mark: the minimum is −128.
  • 1 mark: the maximum is +127.

Question 7 · Subtract by adding a negative

11110001, representing −15

+37 is 00100101. +52 is 00110100, so −52 is 11001100. Adding 00100101 + 11001100 gives 11110001. Decode −128 + 64 + 32 + 16 + 1 = −15. The exact result fits, so no signed overflow occurs.

Original FocusED self-check scheme · 2 marks

  • 1 mark: the eight-bit result 11110001 from signed subtraction.
  • 1 mark: its signed denary interpretation −15.

Question 8 · Recognise positive signed overflow

10001100; signed overflow occurs

01100100 + 00101000 = 10001100. The exact denary answer is 140, outside the maximum +127. The stored pattern decodes to −116: two positive operands have produced a negative signed result.

Original FocusED self-check scheme · 2 marks

  • 1 mark: the stored result 10001100.
  • 1 mark: signed overflow, justified by 140 exceeding +127 or by two positive operands producing a negative stored result.

Question 9 · Recognise negative signed overflow

01111001; signed overflow occurs

−60 is 11000100 and −75 is 10110101. Their full binary sum is 1 01111001; the stored eight bits are 01111001, which decode to +121. The exact result −135 is below −128, so signed overflow occurred. The carry out does not repair the stored signed value.

Original FocusED self-check scheme · 2 marks

  • 1 mark: the stored eight bits 01111001.
  • 1 mark: signed overflow, justified by −135 being below −128 or by two negative operands producing a positive stored result.

Question 10 · Preserve the value in a wider word

11111111 11101100

Repeat the original sign bit, which is 1, in the eight new leftmost positions. The sixteen-bit word is 1111111111101100 and still represents −20. Adding zeros on the left would instead make the signed sixteen-bit value +236.

Original FocusED self-check scheme · 2 marks

  • 1 mark: the sixteen-bit result 1111111111101100.
  • 1 mark: repeat the sign bit 1 on the left to preserve the negative value.

Question 11 · Separate carry from signed overflow

−1 + 1 = 0; no signed overflow

11111111 represents −1, not unsigned 255, under the stated signed interpretation. The calculation is −1 + 1 = 0, exactly represented by 00000000. The carry out would signal an out-of-range result for unsigned 255 + 1, but it does not by itself establish signed overflow.

Original FocusED self-check scheme · 2 marks

  • 1 mark: the signed calculation −1 + 1 = 0.
  • 1 mark: no signed overflow because the exact signed answer 0 fits; a carry out alone is insufficient.

Question 12 · Explain the smallest-value exception

10000000 again; +128 cannot be represented in eight-bit two’s complement

Inversion gives 01111111; adding 1 gives 10000000. The original value is −128, while its mathematical negative +128 lies outside the eight-bit signed range. The retained word still decodes as −128, so this fixed-width negation cannot represent the required positive result.

Original FocusED self-check scheme · 2 marks

  • 1 mark: invert-and-add-one retains 10000000.
  • 1 mark: +128 exceeds the signed maximum +127, so the word cannot mean +128 in this format.

Scope and source

Cambridge 9618 syllabus, 2027–2029, version 2: section 1.1, page 14 establishes the relevant syllabus scope: number representations, integer arithmetic and overflow. This focused worksheet does not cover every part of section 1.1 or replace timed official practice. Check the syllabus for your examination year.

Questions, explanations and the self-check scheme were written for FocusED. No official examination questions or publisher mark schemes are reproduced.

You can print this worksheet for your own study or classroom practice. Keep the FocusED name and source details on shared copies.

Found an error or need help? umrzoqprimqulov48@gmail.com · Contact FocusED

FocusED · focused-edu.vercel.app