levo

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.

Your recallNot started
Key term

In a two's complement number, what does the most significant bit tell you?

Key term

In eight-bit two's complement, what are −1 and −128, and why is the range lopsided?

Key term

Convert +45 and −45 to 8-bit two's complement.

Questions from this subtopic

Each one with the model answer underneath.

  1. 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. 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. 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. 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. 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. 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.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A driver is .
softwarehardwarestorage

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AThe integer 5 is 0101.
B0.75 is 1/2 + 1/4.
CThe fraction bits are 1100.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

Head means the first single element of a non-empty list.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

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.