Skip to main content
Learn ยท Computer Science ยท Class 7

Number Systems & Data Representation

Binary, and how text, images and sound all become numbers.

10 parts
Scroll to begin โ†“
๐Ÿ“˜ DefinitionWhy computers use binaryPart 1 of 10
Binary: every place is a power of two1280641643201608184142011164 + 8 + 4 + 1 = 7701001101 in binary is 77 in decimalAdd up the values wherever there is a 18 bits = 1 byte, so the largest is 255
Add the place values wherever a 1 appears.
๐Ÿ” In detailConverting decimal to binaryPart 3 of 10
โœ๏ธ Worked exampleHow text becomes numbersPart 4 of 10
๐Ÿ” In detailImages and soundPart 5 of 10
โœ๏ธ Worked exampleWorking out a file sizePart 6 of 10
๐ŸŒ In the real worldWhere this shows upPart 7 of 10
โš ๏ธ Common mistakesWhere it usually goes wrongPart 8 of 10
โœ… SummaryWhat to rememberPart 9 of 10
โœ๏ธ Worked exampleWatch one worked throughPart 10 of 10
1๐Ÿ“˜ DefinitionPart 1 / 10

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.

2๐Ÿงฉ The partsPart 2 / 10

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   1

To 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).

3๐Ÿ” In detailPart 3 / 10

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
45 = 00101101

Always check by adding back: 32 + 8 + 4 + 1 = 45 โœ…

4โœ๏ธ Worked examplePart 4 / 10

How text becomes numbers

Every character has a numeric code. The oldest standard is ASCII.

A = 65   B = 66   C = 67
a = 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.

5๐Ÿ” In detailPart 5 / 10

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.

6โœ๏ธ Worked examplePart 6 / 10

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 pixels

Step 2: bytes per pixel. Three, one each for red, green and blue.

800,000 ร— 3 = 2,400,000 bytes

Step 3: convert.

2,400,000 รท 1024 รท 1024 โ‰ˆ 2.29 MB

Why 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.

7๐ŸŒ In the real worldPart 7 / 10

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.

8โš ๏ธ Common mistakesPart 8 / 10

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.
9โœ… SummaryPart 9 / 10

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.
10โœ๏ธ Worked examplePart 10 / 10

Watch one worked through

Here is one done slowly, with the reason for every move. Then one for you.

Watch one first

Convert the binary number 1011 to denary, then convert 20 to binary.

  1. Write the place values above the binary digits.
    8 4 2 1 1 0 1 1
    Binary place values double from the right, just as denary ones multiply by ten. Writing them down removes all the guesswork.
  2. Add the values wherever there is a 1.
    8 + 0 + 2 + 1 = 11
    A 0 contributes nothing. You are only ever adding the columns that are switched on.
  3. Going the other way, take the biggest place value that fits into 20.
    16 fits into 20, 20 โˆ’ 16 = 4 16 โ†’ 1
    Working from the largest down means each column is decided once and never revisited.
  4. Carry on down the columns.
    16 8 4 2 1 1 0 1 0 0 = 10100
    Check by adding back: 16 + 4 = 20. That check takes seconds and catches a missed column.

Answer: 1011 = 11, and 20 = 10100

Now you try

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.