← ACARA Digital Technologies Years 7–8

Leading zeros and fixed-width binary

00000101 is the binary number 101 padded with leading zeros to fill 8 bits. Zeros added on the left do not change the value, so it is still 5.

Understanding Leading zeros and fixed-width binary in ACARA Digital Technologies Years 7–8

What it does: 11 in binary is 3. Two zeros on the left fill the 4 bits and the value stays 3. Pad 11 with two zeros on the left to get 0011, which is still 3. Writing 1100 would make it 12. Count every digit, including the leading zeros. 00001111 has 8 bits, made of two 4-bit groups (nibbles). The leading zeros add nothing, so 00000101 is the binary number 101. That equals 4 + 1 = 5, not one hundred and one. Put the extra zeros on the left: 00000110. Moving zeros to the right changes 110 into 192. The single leading zero fills the 4-bit group without changing the value of 110, which is 6.

Common mistakes: zfill(8) pads the binary number to 8 bits, so the length check should compare with 8, not 4. The format code needs the letter b to give binary. '08b' gives 00000101 (8 bits, padded with zeros). '08' would just give a decimal number.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 189–203) and word search (Modules 189–236).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which shows 101 padded to 8 bits?
0000010110100000
Matches
101 padded to 8 bits: 10100000
↓
The zeros were added on the right, which changes the value to 160. Padding zeros must go on the left: 00000101.
Applying
Meanings
Term
00000101
Meaning
00000101 is the binary number 101 padded with leading zeros to fill 8 bits. Zeros added on the left do not change the value, so it is still 5.
Practice
5 = 101
Testing
Gaps
101 as 8 bits: 101
Check Answer
Spots
3padded = bits.zfill(8)
4print(len(padded) == 4)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Hedgehog' badge — First Steps, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which shows 101 padded to 8 bits?
A. 10100000
B. 00000101 ✓
Leading zeros go on the LEFT. 00000101 has 8 bits and is still 5. Zeros on the right would change the value.
2. Does adding leading zeros change the value of a binary number?
A. No, 0101 and 101 are both 5 ✓
B. Yes, 0101 is bigger than 101
Leading zeros add nothing, just like 007 is still 7 in denary. The value stays the same.
3. What is 11 written as a 4-bit binary number?
A. 0011 ✓
B. 1100
Pad 11 with two zeros on the left to get 0011, which is still 3. Writing 1100 would make it 12.
4. How many bits are in 00001111?
A. 4 bits
B. 8 bits ✓
Count every digit, including the leading zeros. 00001111 has 8 bits, made of two 4-bit groups (nibbles).
5. What is the value of 00000101?
A. 5 ✓
B. 101
The leading zeros add nothing, so 00000101 is the binary number 101. That equals 4 + 1 = 5, not one hundred and one.

Match the Pairs

00000101 → The binary number 101 padded with leading zeros to fill 8 bits. Its value is still 5.
0110 → A 4-bit group holding the binary number 110, which is 6 in denary.
Writing 11 as a 4-bit binary group by adding leading zeros → 0011
Writing 1001 as an 8-bit binary number by padding with zeros on the left → 00001001
101 padded to 8 bits: 10100000 → The zeros were added on the right, which changes the value to 160. Padding zeros must go on the left: 00000101.
0011 is bigger than 11 because it has more digits → Leading zeros add nothing. 0011 and 11 are both 3, so the value is the same.

Key Term

00000101
00000101 is the binary number 101 padded with leading zeros to fill 8 bits. Zeros added on the left do not change the value, so it is still 5.

Fill in the Blanks

1. 101 as 8 bits: 00000101
Hint: Type the leading zeros needed on the left to fill 8 bits.
2. =DEC2BIN(5,8)
Hint: Type the number of bits the result should be padded to.
3. 3 in 4 bits is 0011
Hint: Type the leading zeros that fill the nibble without changing the value.
4. 00000101 has the same value as 101
Hint: Type the binary number with its leading zeros removed.
5. =DEC2BIN(5,8)
Hint: Type the spreadsheet function name that converts a denary number to binary.

Spot the Error

Question 1
A n = 5
B bits = bin(n)[2:]
C padded = bits.zfill(8)
D print(len(padded) == 4)
Line D — zfill(8) pads the binary number to 8 bits, so the length check should compare with 8, not 4.
Question 2
A n = 5
B bits = format(n, '08')
C print(bits)
D print(int(bits, 2))
Line B — The format code needs the letter b to give binary. '08b' gives 00000101 (8 bits, padded with zeros). '08' would just give a decimal number.
Question 3
A n = 6
B nibble = format(n, '04b')
C print(int(nibble, 10))
Line C — The nibble 0110 is binary, so int() must use base 2. Base 10 reads it as the decimal number 110 instead of 6.
Question 4
A a = int('101', 2)
B b = int('00010101', 2)
C print(a == b)
Line B — The 8-bit version of 101 is 00000101. Writing 00010101 changes a bit to a 1 (it is 10101, which is 21), so it is no longer equal to 5.
Question 5
A bits = 101
B padded = bits.zfill(8)
C print(padded)
Line A — The binary number must be a string such as '101' so zfill can add zeros on the left. 101 without quotes is a plain integer and has no zfill.

Student with a class code? Join your class →