IGCSE Computer Science binary and hexadecimal questions look easy until the clock is running. Converting 203 to binary, adding two 8-bit numbers or explaining what a shift does are short questions worth a few marks each, and they are also the questions where one slipped digit costs you the lot. This guide gives you a reliable method for each skill in Cambridge IGCSE Computer Science (0478), with worked examples you can check yourself.
What you will be able to do: convert between denary, binary and hexadecimal, add 8-bit binary numbers and spot overflow, apply logical shifts, and explain why computers and programmers use these systems.
Always check the exact wording of your own syllabus on the Cambridge IGCSE Computer Science (0478) page, because the details can change between syllabus years.
Why computers use binary, and why we use hexadecimal
Computers use binary (base 2) because their circuits have two states: on and off, written as 1 and 0. Each binary digit is a bit, and eight bits make a byte.
Long strings of bits are hard for humans to read and easy to mistype. Hexadecimal (base 16) is a shorter way to write the same value. Each hex digit stands for exactly four bits, so one byte is always two hex digits. This is why hex appears in colour codes, error messages and memory addresses.
A good exam answer to "why is hexadecimal used?" makes two points: it is shorter and easier for people to read and less error-prone than binary, and it converts to and from binary easily, four bits at a time.
| Denary | Binary (4-bit) | Hex |
|---|---|---|
| 0 to 9 | 0000 to 1001 | 0 to 9 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
Learn A to F cold. It is the quickest way to stop losing marks on hex.
Binary to denary (with a place-value table)
Draw the place values above the bits for an 8-bit number, then add up the columns that hold a 1.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
128 + 32 + 16 + 4 + 1 = 181
Tip: Write the eight place values across the top of the page before you start any binary question. It takes five seconds and removes the most common source of mistakes.
Denary to binary
Work from the left, asking "does this place value fit into what I have left?"
Convert 203 to binary.
- 1128 fits (203 − 128 = 75). Write 1.
- 264 fits (75 − 64 = 11). Write 1.
- 332 does not fit. Write 0.
- 416 does not fit. Write 0.
- 58 fits (11 − 8 = 3). Write 1.
- 64 does not fit. Write 0.
- 72 fits (3 − 2 = 1). Write 1.
- 81 fits (1 − 1 = 0). Write 1.
Answer: 11001011. Check by adding back: 128 + 64 + 8 + 2 + 1 = 203.
Binary to hexadecimal, and back
Split the byte into two groups of four bits (called nibbles). Convert each nibble on its own.
Convert 11001011 to hex.
- 1100 = 12 = C
- 1011 = 11 = B
Answer: CB.
Going the other way, write each hex digit as four bits.
Convert A7 to binary. A = 1010 and 7 = 0111, so A7 = 10100111.
Hexadecimal to denary
Multiply the left digit by 16 and add the right digit.
Convert A7 to denary. A is 10, so (10 × 16) + 7 = 160 + 7 = 167. This matches 10100111, which is 128 + 32 + 4 + 2 + 1 = 167.
Denary to hex works the other way: divide by 16. For 203, 203 ÷ 16 = 12 remainder 11, which is C then B, so CB. This agrees with the binary route above, which is a useful way to check your own work.
Adding two binary numbers and spotting overflow
Binary addition follows four rules for each column: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11 (write 1, carry 1).
Add 11001000 and 01100100 (that is 200 + 100).
11001000
+ 01100100
----------
100101100The true answer is 300, which is 100101100 in binary. That needs nine bits. An 8-bit register can only hold values up to 255, so the leftmost 1 does not fit. This is called an overflow error, and the stored result would be 00101100 (44), which is wrong.
In the exam, if you are asked what has happened, say that the result is too large to be stored in 8 bits, so an overflow has occurred. If you need to show your working, show the carries.
Logical binary shifts
A logical shift moves every bit a number of places left or right. Gaps are filled with 0, and bits that move out of the register are lost.
- A left shift by one place multiplies by 2 (if no 1s are lost).
- A right shift by one place divides by 2 (ignoring any remainder).
Shift 00101101 (45) left by two places. Every bit moves two places left and two 0s enter on the right: 10110100, which is 180 and equals 45 × 4.
Shift 10110101 (181) left by three places. The three leftmost bits (101) fall off and three 0s enter on the right, giving 10101000. The answer is no longer 181 × 8, because bits were lost.
Shift 10110101 (181) right by two places. The two rightmost bits (01) are lost and two 0s enter on the left, giving 00101101, which is 45. The true value of 181 ÷ 4 is 45.25, so the fraction has been lost.
When a question asks for the effect of a shift, give the mathematical effect (multiplied or divided by 2 for each place) and mention any lost bits. That is usually where the second mark sits.
Tip: Always write the shifted number in a fresh row of eight boxes. Counting positions on the original is how digits go missing.
Common mistakes that cost marks
| Mistake | How to avoid it |
|---|---|
| Writing fewer than eight bits when the question says "8-bit" | Pad the left with 0s, for example 5 is 00000101 |
| Mixing up B (11) and D (13) in hex | Keep the A to F table in your head, or write it in the margin |
| Converting a whole byte to hex in one go | Always split into two nibbles |
| Saying "carries over" instead of "overflow" | Use the term overflow, with "too large for 8 bits" |
| Forgetting that shifted-out bits are lost | State what was lost whenever you shift |
| Reversing the table (1 to 128 instead of 128 to 1) | Write 128 on the far left every time |
How to practise so it sticks
Reading worked examples is the easy part. The skill comes from doing the conversion yourself with the page covered. After you have read this guide, try these from memory:
- 1Convert 150 to binary and then to hex.
- 2Convert 6E to denary and binary.
- 3Add 01101110 and 00110111 and say whether overflow occurs.
- 4Shift 00011011 left by three places and describe the effect.
You can check your answers with a calculator in programmer mode, but write the working first. Retrieval practice, where you try to recall or produce an answer rather than re-reading it, is far more effective than rereading notes (Roediger & Karpicke, 2006). Then return to the same questions a few days later, because revisiting material after a gap beats cramming (Cepeda et al., 2006).
Two other techniques help with this topic. Our guide to IGCSE command words shows how "state", "describe" and "explain" change the length of the answer you need to write for questions like "explain why hexadecimal is used". For the practical, step-by-step side of Computer Science, see our guide to IGCSE Computer Science trace tables, which uses the same habit of writing every step down. When you move on to timed practice, using topical past papers explains how to mark yourself honestly.
If you would like to practise number systems in a different way, TeachVerse is a study app where you explain a topic to your own AI pupil and then see how it handles exam-style questions on what you taught it. The questions are original, written in the style of Cambridge IGCSE papers, not real past papers. A fair test of whether you understand binary is whether you can explain why a left shift multiplies by two, not just that it does. You can try it free at TeachVerse.
Quick summary
- Binary is base 2, hex is base 16, and each hex digit equals four bits.
- Use a place-value table every time, 128 on the left.
- Convert hex by splitting into nibbles.
- Overflow happens when a result needs more bits than the register has.
- A logical shift fills gaps with 0 and loses bits that move out.
- Write all eight bits unless told otherwise.
Practise each skill until you can do it without the table, then do timed questions under exam conditions.
TeachVerse is independent and is not affiliated with or endorsed by Cambridge University Press & Assessment or Pearson.