Number Systems & Data Representation
Binary, and how text, images and sound all become numbers.
Why computers use binary
We count in decimal: ten digits, 0 to 9. Computers use binary, two digits, 0 and 1.
The reason is engineering, not mathematics. A circuit can reliably distinguish two states: current flowing or not, voltage high or low. Distinguishing ten different voltage levels accurately, millions of times a second, with components that heat up and age, is far harder.
Two states is the most robust choice, so that is what was built.
Reading binary
Binary works exactly like decimal, but each place is a power of two instead of ten.
128 64 32 16 8 4 2 1To convert to decimal: add the place values wherever there is a 1.
01001101= 64 + 8 + 4 + 1
= 77
8 bits = 1 byte, giving 256 possible values (0 to 255).
Converting decimal to binary
The subtraction method: work from the largest place value down.
Convert 45:
- 128? Too big โ 0
- 64? Too big โ 0
- 32? Fits. 45 โ 32 = 13 โ 1
- 16? Too big โ 0
- 8? Fits. 13 โ 8 = 5 โ 1
- 4? Fits. 5 โ 4 = 1 โ 1
- 2? Too big โ 0
- 1? Fits. 1 โ 1 = 0 โ 1
Always check by adding back: 32 + 8 + 4 + 1 = 45 โ
How text becomes numbers
Every character has a numeric code. The oldest standard is ASCII.
A = 65 B = 66 C = 67a = 97 b = 98
space = 32 0 = 48
Notice A is 65 and a is 97: exactly 32 apart. That gap is deliberate: it means changing case is a single bit flip, which made early text processing fast.
The limitation: ASCII uses 7 bits, giving only 128 characters. Enough for English, nowhere near enough for Urdu, Arabic, Chinese or emoji.
Unicode solved this by using more bytes per character, covering over 140,000 characters across nearly every writing system.
This is why a document from an old system sometimes shows unreadable symbols. It is being interpreted with the wrong code table.
Images and sound
Images. A picture is a grid of pixels, each storing a colour as three numbers, red, green and blue, 0 to 255 each.
(255, 0, 0) = pure red(255, 255, 255) = white
(0, 0, 0) = black
Three bytes per pixel gives about 16.7 million possible colours.
Sound. A microphone measures air pressure thousands of times per second, and each measurement is stored as a number. CD quality takes 44,100 samples per second.
The trade-off in both cases: more pixels or more samples means better quality and a bigger file. That single trade-off explains image resolutions, audio bitrates and why video files are so large.
Working out a file size
Question. How large is an uncompressed 1000 ร 800 pixel photograph in full colour?
Step 1: count the pixels.
1000 ร 800 = 800,000 pixelsStep 2: bytes per pixel. Three, one each for red, green and blue.
800,000 ร 3 = 2,400,000 bytesStep 3: convert.
2,400,000 รท 1024 รท 1024 โ 2.29 MBWhy real photos are smaller: compression. JPEG discards detail the eye barely notices, often reducing the file by 90%.
The cost: JPEG is lossy, the discarded detail is gone for good, and repeatedly saving degrades the image. PNG is lossless but larger.
Where this shows up
Storage and data plans. Knowing what a megabyte contains makes those numbers meaningful.
Choosing a file format. JPEG for photographs, PNG for diagrams and screenshots with sharp edges, because lossy compression blurs text badly.
Streaming quality. Higher resolution means more data per second, which is why video quality drops on a weak connection.
Why 1 GB is 1024 MB, not 1000. Because everything is powers of two. This is also why a "500 GB" drive shows less in the operating system, the manufacturer counted in thousands.
Where it usually goes wrong
- "Binary is a code computers translate." It is how the data actually is.
- Reading binary place values left to right as 1, 2, 4. The rightmost is 1.
- "1 KB = 1000 bytes." It is 1024.
- "Compression never loses anything." JPEG and MP3 do.
- "More pixels is always better." Not beyond what the screen can show.
What to remember
- Binary uses two states because circuits can hold them reliably.
- Add the place values (128, 64, 32โฆ) where there is a 1.
- Text = character codes ยท images = RGB pixels ยท sound = samples.
- Quality vs file size is always a trade-off; lossy compression is permanent.
Watch one worked through
Here is one done slowly, with the reason for every move. Then one for you.
Convert the binary number 1011 to denary, then convert 20 to binary.
- Write the place values above the binary digits.8 4 2 1 1 0 1 1Binary place values double from the right, just as denary ones multiply by ten. Writing them down removes all the guesswork.
- Add the values wherever there is a 1.8 + 0 + 2 + 1 = 11A 0 contributes nothing. You are only ever adding the columns that are switched on.
- Going the other way, take the biggest place value that fits into 20.16 fits into 20, 20 โ 16 = 4 16 โ 1Working from the largest down means each column is decided once and never revisited.
- Carry on down the columns.16 8 4 2 1 1 0 1 0 0 = 10100Check by adding back: 16 + 4 = 20. That check takes seconds and catches a missed column.
Answer: 1011 = 11, and 20 = 10100
Convert binary 1101 to denary.
Show the answer
13
Practise Number Systems & Data Representation
Everything on QuizByt for Class 7 Computer Science that goes with this lesson: read it first, then test yourself while it is fresh.
๐ง 9 quizzes on Number Systems & Data Representation (6 easy, 2 medium, 1 hard)
Work up from easy to hard: the hard quiz asks the Class 7 exam-style questions on Number Systems & Data Representation.
๐จ๏ธ Printable worksheet
Number Systems & Data Representation on paper for Class 7, with room to write the working out. Preview the first page free.
๐ฎ Games for Class 7 Computer Science
Memory and reasoning games at the right level for Class 7. Passing a quiz on Number Systems & Data Representation earns the credits that open them.
Now test yourself
You have read the whole lesson. Take the quiz on this topic to see how much stuck,a free account is all it takes.
- ๐ Your score is saved, so you can see progress over time
- ๐ See exactly which questions you got wrong, and why
- ๐ Earn credits for every quiz you pass, and spend them on games
In a hurry? Try a free Computer Science quiz with no account.