Computer Systems · Data Representation

CS1 — Binary and Positive Integers

📅 Mon 1 Jun 2026 · P1+P2 (double)
~120 minutes
Learning intentions
Success criteria
Warm up — before we start
Quick recap of National 5 binary basics · check when done
W1
How many different values can a single binary digit (bit) store?
W2
What do we call a group of 8 bits?
W3
Convert the binary number 00000101 to denary.

Key vocabulary

Bit
A single binary digit — either 0 or 1. Short for "binary digit"
Byte
A group of 8 bits, the standard unit computers use to store and address data
Binary
A base-2 number system using only the digits 0 and 1
Denary
The base-10 number system humans normally use, with digits 0–9
Place value
The value a digit represents based on its position — powers of 2 in binary, powers of 10 in denary
Transistor
A tiny electronic switch with two states (on/off) — the physical basis for binary storage

Why binary?

Digital computers are built from millions — often billions — of tiny electronic switches called transistors. A switch can only ever be in one of two states: on or off. That gives us exactly two symbols to work with, which we represent as 1 (on) and 0 (off).

This is why all data handled by a computer — whether it is a number, a letter, a photograph, or a line of program code — is ultimately stored as a sequence of 1s and 0s. We call this sequence binary. Each individual 1 or 0 is called a bit (short for "binary digit"), and bits are grouped into bytes of 8 bits at a time.

Binary is not just a convenient choice — it is a reliable one. Two voltage levels (high and low) are easy for hardware to tell apart even with electrical noise on the line. A system with ten voltage levels, one for each denary digit, would be far more likely to misread a value. Binary arithmetic circuits are also simpler to design than decimal ones, which is one reason every modern processor is built around base 2 rather than base 10.

Place value in binary

Denary (base 10) uses place values of 1, 10, 100, 1000 and so on — each column is 10 times the value of the one to its right. Binary (base 2) works the same way, except each column is only 2 times the value of the one to its right, because there are only two digits available (0 and 1) instead of ten.

A 1 in a column means "include that column's value"; a 0 means "don't include it." To convert binary to denary, you add up the value of every column containing a 1.

Bit 7Bit 6Bit 5Bit 4 Bit 3Bit 2Bit 1Bit 0
2⁷2⁶2⁵2⁴ 2⁰
128643216 8421

To convert denary to binary, work from the largest column down: if the column's value fits into what is left of your number, write a 1 and subtract it; otherwise write a 0 and move to the next column.

Range of positive integers

With n bits, you can represent 2ⁿ different values. Because counting starts at zero, the range of positive integers representable is 0 to 2ⁿ − 1 — not 0 to 2ⁿ.

Bits (n)Total values (2ⁿ)Range
4 bits160 to 15
8 bits2560 to 255
16 bits65,5360 to 65,535
32 bits4,294,967,2960 to 4,294,967,295
8-bit unsigned binary spectrum
0 00000000
255 11111111

💡 All 256 possible 8-bit patterns are used for positive values, from 00000000 (zero) up to 11111111 (255). Unlike two's complement — which you'll meet next lesson — there is no negative zone here: every pattern is a positive integer or zero.

This formula matters beyond the classroom: it is exactly why a database field, a variable, or a network address has a hard upper limit. Once every bit pattern is used up, the next number simply cannot be represented — the value overflows.

Worked examples

Example 1 — Convert 10110101 to denary
1
Write the number under the place-value headings:
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
  1  |  0  |  1  |  1  | 0 | 1 | 0 | 1
2
Pick out the columns with a 1: 128, 32, 16, 4, 1
3
Add them up: 128 + 32 + 16 + 4 + 1 = 181
Answer: 10110101 = 181
Example 2 — Convert 93 to 8-bit binary
1
128 > 93, so write 0 in the 128s column.
2
64 ≤ 93, so write 1 and subtract: 93 − 64 = 29
3
32 > 29 → 0. 16 ≤ 29 → write 1, remainder = 29 − 16 = 13
4
8 ≤ 13 → write 1, remainder = 5. 4 ≤ 5 → write 1, remainder = 1
5
2 > 1 → 0. 1 ≤ 1 → write 1, remainder = 0
Answer: 01011101
Check: 64 + 16 + 8 + 4 + 1 = 93 ✓
Example 3 — Convert 11101011 to denary
1
Write the number under the place-value headings:
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
  1  |  1  |  1  |  0  | 0 | 1 | 1 | 1
2
Pick out the columns with a 1: 128, 64, 32, 8, 2, 1
3
Add them up: 128 + 64 + 32 + 8 + 2 + 1 = 235
Answer: 11101011 = 235 — nearly the maximum 8-bit value of 255, using six of the eight available bits.
Now you try
Convert 172 to 8-bit binary. Show your working, then check your answer using the place value table.
⚠️ Common mistakes — examiner feedback
📝 Exam tip

Binary/denary conversions are usually worth 1 mark each and are entirely mechanical — there is no trick, only method. Always draw the place-value table as working, even if you can do the sum in your head; it is the fastest way to check your own answer and to pick up method marks if the final answer is wrong.

Expect these question forms:

Task Set A

Task Set A — Higher core
Work through all questions, then check your answers.
A1
Convert 11001010 to denary.
A2
Convert 214 to 8-bit binary.
A3
How many different values can be represented using 5 bits?
A4
What is the largest positive integer that can be stored using 5 bits?
A5
A system uses 12-bit unsigned binary. What is the range of values it can represent?
A6
Convert 10000001 to denary.
A7
Convert 59 to 8-bit binary.
A8 — past paper style (2 marks)
A programmer wants to store a pupil's age (0 to 120) using the smallest possible fixed number of bits. State the minimum number of bits required and justify your answer.
A9
What is the minimum number of bits needed to represent the denary value 300?
✅ Higher checkpoint — A8 and A9 (working out the minimum bits needed for a range) are the most exam-relevant application of this lesson. Confident on both = ready for CS2 and beyond.

Task Set B

Task Set B — Extension · Beyond the specification
Not auto-marked — reveal the model answer to self-assess.
B1
Hexadecimal is base 16 (digits 0–9 then A–F). Explain why programmers use hexadecimal as shorthand for binary, then convert 10110101 to hexadecimal. (Hint: split into groups of 4 bits.)
B2
A file stores pixel colour using 3 bits per channel (red, green, blue). How many different colours can it represent in total? Compare this to a system using 8 bits per channel.
B3
Explain why computer hardware is built to use binary (base 2) rather than denary (base 10) or some other number base.
📁 File this in OneNote under:
Higher Computing Science → Computer Systems → CS1
📌 Teacher notes — not for pupils

This is a settling-in lesson as well as content. Pupils are new to you and to Higher. Keep it warm. Binary conversion is revision for almost everyone — the goal is building confidence and establishing your classroom rhythm, not hard new material.

Suggested timing (120 min double):
10 min — intro/why binary, settle the class
10 min — warm up independently, then check together
5 min — key vocabulary
15 min — place values + Examples 1 and 2 together on the board
10 min — range of values and the range-map visual
10 min — Example 3 and Now you try (independent, then reveal)
5 min — common mistakes ("has anyone made this one just now?")
25 min — Task Set A
10 min — whole-class check (cold call conversions)
10 min — preview of next lesson: ask "how would you store −5 in binary?" to set up CS2

Watch for: dropped leading zeros; confusing 2ⁿ with 2ⁿ − 1 for the maximum value; place-value table written back to front.

Pupils who find this straightforward should move to Task Set B (extension) immediately rather than waiting.