levo

Data Types and Number Representation

Binary addition, subtraction and overflow

  • 3 things to know
  • Component 01
Start revising · £5/month

Overview

Recall questions on binary addition and carries, binary subtraction with borrows and by adding a two's complement, overflow and how to detect it for unsigned and two's complement numbers, and guarding against overflow.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What are the four rules for adding two binary digits in one column?

Key term

Add 11010110 and 01101001 in eight bits and say what happens at the left-hand end.

Key term

Add the eight-bit two's complement numbers 01000001 and 00011110 and decide whether overflow has occurred.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What are the four rules for adding two binary digits in one column?

    Model answer

    0 + 0 = 0. 0 + 1 = 1. 1 + 1 = 0 carry 1. And where a carry is already coming in, 1 + 1 + 1 = 1 carry 1. Work from the rightmost column leftwards, writing the carry into the next column to the left, exactly as in denary addition.

  2. 2

    Add the binary numbers 01011011 and 00101110, working column by column.

    Model answer

    The result is 10001001. Starting from the right: 1 + 0 = 1. 1 + 1 = 0 carry 1. 0 + 1 + 1 = 0 carry 1. 1 + 1 + 1 = 1 carry 1. 1 + 0 + 1 = 0 carry 1. 0 + 1 + 1 = 0 carry 1. 1 + 0 + 1 = 0 carry 1. 0 + 0 + 1 = 1. Checking in denary, the inputs are 91 and 46, and 91 + 46 = 137, which is 10001001.

  3. 3

    Add 11010110 and 01101001 in eight bits and say what happens at the left-hand end.

    Model answer

    The eight-bit result is 00111111 and there is a carry of 1 out of the leftmost column with nowhere to go. In denary the inputs are 214 and 105, whose true total is 319, but the largest an unsigned byte can hold is 255. The carry that is lost represents 256, and indeed 319 minus 256 is 63, which is 00111111. So the stored answer is wrong, and the lost carry out is the signal that it is wrong.

  4. 4

    What are the rules for borrowing in binary subtraction?

    Model answer

    0 minus 0 is 0, 1 minus 0 is 1, 1 minus 1 is 0, and 0 minus 1 needs a borrow. To borrow, take 1 from the next column to the left, which arrives in the current column as binary 10, that is 2, so the column becomes 10 minus 1 = 1. If the column you borrow from is a 0, it must borrow in turn from further left, and the chain continues until it reaches a 1.

  5. 5

    Subtract 01101110 from 10110100 using column subtraction with borrows.

    Model answer

    The answer is 01000110. Working from the right: 0 minus 0 = 0. 0 minus 1 needs a borrow, giving 1 with a borrow out. 1 minus 1 minus the borrow needs another borrow, giving 1. 0 minus 1 minus the borrow needs a borrow, giving 0. 1 minus 0 minus the borrow gives 0. 1 minus 1 gives 0. 0 minus 1 needs a borrow, giving 1. 1 minus 0 minus the borrow gives 0. In denary the sum is 180 minus 110 = 70, and 01000110 is 64 + 4 + 2 = 70.

  6. 6

    Do the same subtraction, 10110100 minus 01101110, by adding a two's complement instead, and comment on the final carry.

    Model answer

    The answer is again 01000110. Form the two's complement of 01101110 by flipping to get 10010001 and adding 1 to get 10010010. Now add 10110100 and 10010010, which gives 01000110 with a carry of 1 out of the leftmost column. That final carry is simply discarded; in two's complement subtraction it is expected and carries no information. The result 01000110 is 70, matching the column subtraction exactly.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

If it matches, the search .
succeedsfailsrestarts

Blank Blitz consolidates the facts

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

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

A global variable means a variable reachable from anywhere in the program.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

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

Every question in Data Types and Number Representation, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.