Ch 1 · 1.1 Number Systems · IGCSE Computer Science 0478
Topic 1 of 3 in Data Representation — IGCSE Computer Science 0478 — 75 lessons.
Introduction
Everything a computer stores, from your photos to this sentence, is held as patterns of 0s and 1s. This lesson shows why, how to convert between the number systems computer scientists use, and how computers add, shift and store negative numbers in binary. (Syllabus section 1.1.)
Key ideas — Why binary?
A computer is built from billions of tiny electronic switches (transistors) that are either off or on. Two states are easy to make and to tell apart reliably, so every form of data (numbers, text, sound, images, instructions) must be converted to binary before a computer can process it. Data is processed using logic gates and stored in registers, all of which work with binary.
🧑🏫 Teacher's explanation
Imagine a massive wall of light switches. Each switch can only be in one of two states: UP (on) or DOWN (off). It is very easy for a machine to detect if electricity is flowing or not, but it would be incredibly difficult and error-prone to try and measure if a switch is exactly 34\% open or 72\% open.
📖 Definitions
🔍 Worked example — Easy
Convert the denary number 45_10 into an 8-bit binary number.
🔍 Worked example — Standard
Convert the hexadecimal number A3_16 to binary.
🔍 Worked example — Exam-style
Perform a logical left shift of 2 places on the 8-bit binary number 00001101_2 and state the new value in denary.
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) Convert the denary number 150_10 into 8-bit binary. [2] (b) Add the binary numbers 10110110_2 and 00011111_2. Show your working. [3] (c) Explain what happens to the result in part (b) in an 8-bit system. [2] [7 marks]
Key ideas — Three number systems
Each place value is the base raised to a power. For 8-bit binary:
🧑🏫 Teacher's explanation
Imagine you are counting items. In our everyday life, we use 'denary' (base 10), likely because we have ten fingers. If you have 12 items, you think 'one ten and two ones'. Computers, however, are made of tiny switches that can only be ON (1) or OFF (0). This is 'binary' (base 2). Because binary strings like 10101101 are very long and hard for humans to read, we use 'hexadecimal' (base 16) as a shorthand. It is like using 'dozen' instead of 'twelve'—it makes things much quicker to write down.
📖 Definitions
🔍 Worked example — Easy
Convert the denary number 45_10 into 8-bit binary.
🔍 Worked example — Standard
Convert the hexadecimal number 2F_16 to binary.
🔍 Worked example — Exam-style
Add two 8-bit binary numbers: 10110100_2 + 00111011_2. Identify if an overflow occurs.
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) Convert the denary number 150_10 into binary. [2] (b) Convert the hexadecimal number A3_16 into binary. [2] (c) Explain why an overflow error might occur when adding two 8-bit binary numbers. [2] [6 marks]
Key ideas — Converting
Binary → denary: add the place values where there is a 1. 10101101 = 128 + 32 + 8 + 4 + 1 = 173.
🧑🏫 Teacher's explanation
Think of number systems like different languages used to describe the same amount. If you have 12 apples, you can say 'twelve' (denary), '1100' (binary), or 'C' (hexadecimal). The amount of apples doesn't change; only the way we write it does.
📖 Definitions
🔍 Worked example — Easy
Convert the denary number 45 into an 8-bit binary number.
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) Convert the denary number 150 into binary. [2] (b) Add the binary numbers 01101010_2 and 00011111_2. Show your working. [2] (c) State whether an overflow error occurs in part (b) and explain why. [2] [6 marks]
Key ideas — Why hexadecimal is useful
Hexadecimal is easier for humans to read and write than binary, because it is a shorter representation of the same value (one hex digit for every 4 bits), so there are fewer mistakes when copying. It converts to and from binary very easily. Uses include:
🧑🏫 Teacher's explanation
Imagine you are trying to write down a very long phone number, but instead of using digits 0-9, you are forced to use only 0s and 1s. You would end up with a massive string of numbers that is incredibly easy to misread or mistype. This is exactly what happens when programmers try to read long strings of binary code.
📖 Definitions
🔍 Worked example — Easy
Convert the binary number 10110110_2 to hexadecimal.
🔍 Worked example — Standard
Convert the hexadecimal number A3_16 to binary.
🔍 Worked example — Exam-style
A programmer is debugging a memory dump. They see the hex value FF_16. Convert this to denary and explain why this value is significant in an 8-bit system.
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) Convert the hexadecimal value 3E_16 to binary. [2] (b) State one area of computer science where hexadecimal is commonly used. [1] [3 marks]
Key ideas — Binary addition and overflow
Add column by column from the right: 0 + 0 = 0; 0 + 1 = 1; 1 + 1 = 0 carry 1; 1 + 1 + 1 = 1 carry 1.
🧑🏫 Teacher's explanation
Think of binary addition like adding numbers in a school notebook where you only have a fixed number of columns. If you add two numbers and the result is too long for your columns, you might try to write the extra digit in the margin, but the computer's register simply doesn't have that space.
📖 Definitions
🔍 Worked example — Standard
Calculate the sum of 11110000_2 and 00010000_2 in an 8-bit register and state if an overflow occurs.
🔍 Worked example — Exam-style
A computer uses 8-bit registers. A program adds 10110110_2 and 01101100_2. Determine the result and explain the outcome.
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) Calculate the sum of 01101100_2 and 00110111_2. [2] (b) State whether an overflow error occurs in the calculation in part (a). Justify your answer. [2] [4 marks]
Key ideas — Logical binary shifts
A logical shift moves all the bits left or right. Bits shifted off the end are lost, and zeros are shifted in at the other end.
🧑🏫 Teacher's explanation
Imagine a row of numbered boxes, where each box is worth double the one to its right. If you slide every number one position to the left, you are essentially doubling the value of every number because they have all moved into a 'slot' that is worth twice as much.
📖 Definitions
🔍 Worked example — Easy
Perform a logical left shift of 1 place on the 8-bit binary number 00001101_2.
🔍 Worked example — Standard
A register contains the 8-bit binary number 00110100_2. Perform a logical right shift of 2 places and state the new denary value.
🔍 Worked example — Exam-style
An 8-bit register contains 10110001_2. Perform a logical left shift of 2 places. Explain what happens to the value.
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) Perform a logical left shift of 2 places on this value. (b) State the new denary value of the register after the shift. (c) Explain why the new denary value is not exactly 4 times the original denary value if the original value had been 11000000_2. [4 marks]
Key ideas — Two's complement (negative numbers)
In 8-bit two's complement, the MSB has a negative place value:
🧑🏫 Teacher's explanation
In a standard binary system, every bit represents a positive power of 2. However, computers need a way to represent negative numbers without using a separate "minus sign" symbol, which would take up extra space and complicate the hardware. We solve this by using the Most Significant Bit (MSB) as a sign bit with a negative weight.
📖 Definitions
🔍 Worked example — Standard
Convert the 8-bit two's complement binary number 11111011_2 to denary.
🔍 Worked example — Exam-style
A computer uses 8-bit two's complement. What is the smallest (most negative) value that can be represented?
⚠️ Common errors
🧠 Quick check 1
🧠 Quick check 2
🎯 Exam question
(a) Convert the denary number -25 into 8-bit two's complement binary. [2] (b) Convert the 8-bit two's complement binary number 11110000_2 into denary. [2] [4 marks]
Worked example
Example 1. Convert the 16-bit binary number 0000 0011 1110 1000 to denary and hexadecimal. Hex: 0 3 E 8 → 03E8. Denary: 512 + 256 + 128 + 64 + 32 + 8 = 1000.
🔍 Worked example — Easy
Convert the 16-bit binary number 0000\ 0011\ 1110\ 1000 to denary and hexadecimal.
🔍 Worked example — Standard
Perform the addition: 1100\ 1000_2 + 0110\ 0100_2 in an 8-bit register.
🔍 Worked example — Exam-style
Represent the denary integer -5 as an 8-bit two's complement binary number.
⚠️ Common errors
Common mistakes
Practice
Answers: (1) 10011010; 9A. (2) 0111 1011; 123. (3) Any two: it is shorter, so easier to read and write; fewer errors when copying; it converts easily to and from binary. (4) 91 + 54 = 145 = 1001 0001; no overflow (fits in 8 bits). (5) 01101000; 13 → 104, multiplied by 8 (2³). (6) 20 = 00010100 → invert 11101011 → add 1 → 11101100.