Checking a two's complement conversion

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Checking a two's complement conversion

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which check proves that 11111011 is the 8-bit two's complement of -5?
A 64+32+16+8+2+1 = 123, which matches
B -128+64+32+16+8+2+1 = -5, which matches
2. You convert 5 to 8-bit two's complement by flipping 00000101. You write 11111010. What went wrong?
A You forgot to add 1 after flipping
B You should have added 1 before flipping
3. A round-trip check on 10000001 uses -128 + 1. What denary value does it give?
A -127
B -1
4. You convert -20 to binary, then convert your answer back and get -19. What should you do?
A Treat it as an error and redo the conversion
B Accept it, because -19 is close enough
5. The check on 11110100 gives a negative result. Flipping gives 00001011 and adding 1 gives 00001100 (12). What is the value?
A 12
B -12

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1-128 64 32 16 8 4 2 1 A11111011 -> 00000100 -> 00000101 = 5
211111011 = -128+64+32+16+8+2+1 = -5 BThe student used only 4 bits instead of all 8 bits.
3If the checked result is negative, flip the bits and add 1 to get the positive value and confirm the size CA round-trip check: converting the binary back gives -5, which matches the starting number
4A 1 in the sign bit adds -128, so add the other place values to it to check a negative number DThe 8 place values used to convert an 8-bit two's complement number back to denary for checking
5-3 in 8 bits: 00000011 -> flip -> 11111100 EThe student forgot to add 1 after flipping the bits.
6-5 stored as 1011 F10000011 = -128 + 2 + 1 = -125

Definitions

-128 64 32 16 8 4 2 1

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Place values: -128 64 32 16 8 4 2 _
2.
11111011 = ____ + 64 + 32 + 16 + 8 + 2 + 1
3.
-128 + 64 + 32 + 16 + 8 + 2 + 1 = __
4.
11111011 flip = 00000100 00000100 + 1 = ________ So 11111011 is -5
5.
Always write _ bits: 00000101, not 101

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Start: -45
B Binary: 11010010
C Check: -128+64+16+2+1
D Total: -45
Question 2
A Start: -20
B Binary: 11101100
C Check: 128+64+32+8+4
D Total: -20
Question 3
A Start: -6
B Binary: 111010
C Check: -128+64+32+16+8+2
D Matches: yes
Question 4
A Binary: 1111000
B Check: -128+64+32+16
C Total: -16
Question 5
A Binary: 11010011
B Sign bit is 1: negative
C Flip: 11010100
D Add 1: 00101101
E Value: -45

Answer Key

Checking a two's complement conversion
Section A: Quick Questions
Q1
B — -128+64+32+16+8+2+1 = -5, which matches
Q2
A — You forgot to add 1 after flipping
Q3
A — -127
Q4
A — Treat it as an error and redo the conversion
Q5
B — -12
Section B: Match the Pairs
Q1
-128 64 32 16 8 4 2 1 → The 8 place values used to convert an 8-bit two's complement number back to denary for checking
Q2
11111011 = -128+64+32+16+8+2+1 = -5 → A round-trip check: converting the binary back gives -5, which matches the starting number
Q3
If the checked result is negative, flip the bits and add 1 to get the positive value and confirm the size → 11111011 -> 00000100 -> 00000101 = 5
Q4
A 1 in the sign bit adds -128, so add the other place values to it to check a negative number → 10000011 = -128 + 2 + 1 = -125
Q5
-3 in 8 bits: 00000011 -> flip -> 11111100 → The student forgot to add 1 after flipping the bits.
Q6
-5 stored as 1011 → The student used only 4 bits instead of all 8 bits.
Section C: Definitions
Q1
-128 64 32 16 8 4 2 1 — Check a two's complement answer by converting it back to denary with these place values, then compare the result with your starting number. They must match.
Section D: Fill in the Blanks
Q1
Place values: -128 64 32 16 8 4 2 1
Q2
11111011 = -128 + 64 + 32 + 16 + 8 + 2 + 1
Q3
-128 + 64 + 32 + 16 + 8 + 2 + 1 = -5
Q4
11111011 flip = 00000100 00000100 + 1 = 00000101 So 11111011 is -5
Q5
Always write 8 bits: 00000101, not 101
Section E: Spot the Error
Q1
B — The +1 step was forgotten. Flipping 00101101 gives 11010010, and adding 1 gives 11010011. The check would give -46, which does not match -45.
Q2
C — The leftmost place value is -128, not +128. It should be -128+64+32+8+4, which gives -20.
Q3
B — Only 6 bits were used. Two's complement needs all 8 bits, so -6 is 11111010. With fewer bits the sign bit is lost.
Q4
A — This has only 7 bits. It needs 8 bits, 11110000, to match the place values -128 64 32 16 8 4 2 1 used in the check.
Q5
C — This line added 1 instead of flipping the bits. Flipping each bit of 11010011 gives 00101100. Then you add 1 on the next line.