Teachers' Portal  /  IGCSE Computer Science 0478  /  Data representation  /  Binary addition and overflow
Lesson pack · IGCSE Computer Science 0478 · 1.1 · IGCSE

Binary addition and overflow

Carry the one. Binary addition works just like the column addition you learned for denary, only the carries come much sooner.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Data representation
Syllabus reference
Cambridge IGCSE Computer Science 0478, 1.1
Level
IGCSE
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 3 of 10 in Data representation; follows Hexadecimal and where it is used; leads into Logical binary shifts
Central model
Fig. 1: 01011011 + 00110110 = 10010001 (91 + 54 = 145), with the carries shown in red
Cooperative structure
Assessment
Stage 1 check and the exam-style plenary from the student lesson, plus the worksheet as the exit task
Learning objectives

By the end of the lesson, learners can

Section by section
  • The four rules: In the lab, set two 8-bit numbers and step through the addition one column at a time.
  • Adding two bytes: Line the numbers up, work from right to left, and write each carry above the next column.
  • When the answer will not fit: Make the lab's total go past 255 and see the ninth bit fall off the end of the register.
Key points to leave on the board
  • Rules: 1 + 1 = 0 carry 1; 1 + 1 + 1 = 1 carry 1.
  • Show carries: write each carry above the next column on the left.
  • Overflow: the result is bigger than the register can hold (more than 255 for 8 bits).
  • Check: convert the two numbers and the answer to denary.
The core visual model

One picture every idea returns to

Add binary numbers in columns from the right, using four rules: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 0 carry 1, and 1 + 1 + 1 = 1 carry 1. Every register has a predefined limit: an 8-bit register can hold at most 255. If the true result is bigger than the limit, a carry is left over from the leftmost column and an overflow error occurs: the stored answer is wrong.

adding two 8-bit numbers, right to left 111111 carries 01011011 00110110 + 9154145 10010001 1 + 1 = 0 carry 1 1 + 1 + 1 = 1 carry 1 a carry out of the leftmost column means overflow
Fig. 1: 01011011 + 00110110 = 10010001 (91 + 54 = 145), with the carries shown in red
Lesson sequence

Forty-five minutes, phase by phase

TimePhaseWhat happens in the roomGrouping
0 to 5 minHook: predictOpen with the question in the title, Carry the one.. Binary addition works just like the column addition you learned for denary, only the carries come much sooner. Put the figure on the board: it is the one picture every idea in the lesson returns to.Whole class, then pairs
5 to 13 minTeach and check: The four rulesIn the lab, set two 8-bit numbers and step through the addition one column at a time. Project tab 3 of the lab (Binary addition with carries) and let a student drive it while the class predicts.Whole class, then pairs
13 to 21 minTeach and check: Adding two bytesLine the numbers up, work from right to left, and write each carry above the next column. Model the worked example No overflow on the board, one line at a time. Your turn: Add 01110000 and 00011111.Pairs
21 to 30 minTeach and check: When the answer will not fitMake the lab's total go past 255 and see the ninth bit fall off the end of the register. Project tab 3 of the lab (Overflow in an 8-bit register) and let a student drive it while the class predicts.Cooperative Concept Mapping
30 to 36 minCheckThe four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong.Individual, then whole class
36 to 43 minPlenaryThe exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording.Individual, random call
43 to 45 minExit and homeworkSet the worksheet below (6 questions, 14 marks). Learners self-assess against the objectives before they leave.Individual
Timing and contingency

Protect the parts that carry the learning

The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.

Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.

Cut first if the build overruns: the last check in When the answer will not fit, never the check or the plenary.

In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.

Running the cooperative task

Cooperative Concept Mapping

Teams receive the key terms on cards and arrange them on a large sheet, drawing and labelling the links. Compare maps between teams before showing the model map.

The full structure, with its variations and the other twelve, is on the cooperative-learning page.

Examiner traps to pre-empt

What to head off, and how

Trap learners fall intoTeaching move that pre-empts it
Show your carries.If you only write the answer and it is wrong, you lose every mark; with the carries shown, you can still earn method marks.
Overflow is not "running out of memory".It is a single result that needs more bits than the register has.
Worksheet

Binary addition and overflow: worksheet

6 questions, 14 marks. Written in the style of the papers; no past paper question is reproduced.

NameClassDate
Q1 · calculate[2 marks]

Add the 8-bit binary integers 00110101 and 01001110. Show your working.

Q2 · explain[2 marks]

Explain what is meant by an overflow error in binary addition.

Q3 · calculate[3 marks]

Add 11010110 and 01011100 in an 8-bit register. Give the 8-bit result and state what has happened.

Q4 · recall[2 marks]

State the largest denary value that can be stored in (a) an 8-bit register and (b) a 16-bit register.

Q5 · apply[3 marks]

A game stores a player's score in an 8-bit register. The score is 250 and the player earns 10 more points. Explain what happens to the stored score.

Q6 · analysis[2 marks]

A student adds 01101001 and 00010111 and writes 01111110. Identify the mistake and give the correct answer.

Answer key and marking notes
Q1 · 2 marks
  • Carries shown correctly (columns 3 to 7 from the right each receive a carry).
  • Answer 10000011 (53 + 78 = 131).
Q2 · 2 marks
  • A register or device has a predefined limit on the values it can store, e.g. 255 for 8 bits.
  • Overflow occurs when the result of a calculation is outside this limit, so it needs more bits than are available.
Q3 · 3 marks
  • Working with carries gives 1 0011 0010.
  • The 8-bit register stores 00110010.
  • Overflow: 214 + 92 = 306, which is more than 255, so the ninth bit is lost (the stored value 50 is wrong).
Q4 · 2 marks
  • (a) 255.
  • (b) 65 535.
Q5 · 3 marks
  • 250 + 10 = 260, which is more than 255.
  • 260 = 1 0000 0100 needs 9 bits, so an overflow error occurs.
  • The register keeps only 00000100, so the score shows as 4.
Q6 · 2 marks
  • The student wrote 0 for 1 + 1 but did not carry the 1 into the next column.
  • Correct answer 10000000 (105 + 23 = 128).
Quiz

6 multiple-choice questions on this lesson

From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.

Q11 mark

In binary addition, a column contains 1 + 1 plus a 1 carried in from the column to its right. What is written in that column?

  • A1, and 1 is carried to the next column
  • B0, and 1 is carried to the next column
  • C1, and nothing is carried
  • D11, and nothing is carried
Q21 mark

Add the 8-bit binary integers 00111001 and 00101110. Give the answer in 8-bit binary.

  • A01100111
  • B00010111
  • C01101111
  • D01100011
Q31 mark

Which of these additions causes an overflow error in an 8-bit register?

  • A11000000 + 01000001
  • B10000000 + 01111111
  • C01111111 + 01111111
  • D11111110 + 00000001
Q41 mark

What is meant by an overflow error?

  • AThe result of a calculation is too large to fit in the number of bits available
  • BA carry of 1 is produced in any column of a binary addition
  • CToo many numbers are entered into a program at the same time
  • DA negative number is stored in an 8-bit register
Q51 mark

The 8-bit integers 10110110 and 01101011 are added in an 8-bit register. What does the register hold, and what has happened?

  • A00100001, and an overflow error has occurred
  • B100100001, and no error has occurred
  • C00100001, and the answer is correct
  • D11111111, because the register is full
Q61 mark

Which statement about adding two unsigned 8-bit integers is always true?

  • AIf both numbers start with 0, the sum can never overflow
  • BIf both numbers start with 1, the sum may or may not overflow
  • CAn overflow happens whenever a carry is produced in any column
  • DAdding a number to itself can never cause overflow
Quiz key
Q1: A

1 + 1 + 1 = 3, which is 11 in binary: write 1 and carry 1. Writing 0 carry 1 is the rule for 1 + 1 only, so it ignores the carry in. Writing 1 with no carry loses a 2 from the total. A column can only hold a single bit, so 11 cannot be written in it.

Q2: A

57 + 46 = 103 = 64 + 32 + 4 + 2 + 1 = 01100111. 00010111 comes from writing 0 for every 1 + 1 without carrying. 01101111 (111) and 01100011 (99) each have a carry put in the wrong column.

Q3: A

192 + 65 = 257, which is more than 255, so a 9th bit would be needed: overflow. 128 + 127 = 255, 127 + 127 = 254 and 254 + 1 = 255 all fit in 8 bits, even though the first two look large.

Q4: A

Overflow happens when a result is bigger than the largest value the register can hold, so the leftover carry is lost and the stored answer is wrong. Carries within the register are normal and do not cause overflow. Entering many inputs is not overflow, and negative numbers can be stored using two's complement.

Q5: A

182 + 107 = 289 = 100100001, which needs 9 bits. The register keeps only the lower 8 bits, 00100001 (33), so the stored value is wrong: an overflow error. 100100001 cannot fit in an 8-bit register. 00100001 is held but it is not the correct answer. A register does not jump to 11111111 when a result is too large.

Q6: A

A number starting with 0 is at most 127, and 127 + 127 = 254, which fits. A number starting with 1 is at least 128, and 128 + 128 = 256, so two such numbers always overflow. Carries inside the register are normal; only a carry out of the leftmost column means overflow. Adding a number to itself overflows if it is 128 or more.

Lab and demo

What to project

The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.

Slides

Slides for this lesson

A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.

Also for this topic

Everything else you can use

Original work by the TheLucidSTEM team. The worksheet items are written in the style of the papers; no past paper question is reproduced.
Previous lessonHexadecimal and where it is used