Binary and data representation

Computer Science · GCSE · The School

Counting with two digits

Computers store everything as bits — 0s and 1s. Binary place values run 128·64·32·16·8·4·2·1. So 01001101 = 64+8+4+1 = 77. To convert 77 back: take the biggest place value that fits (64), subtract, repeat: 77→13→5→1→0 gives 01001101. Eight bits make a BYTE, holding 0–255.

Text and images are numbers

Text: each character maps to a number (ASCII gives "A"=65, "a"=97 — so 77 is "M"), and Unicode extends the idea to every script, Arabic included. Images: a grid of pixels, each pixel a number for its colour. 1 bit per pixel gives black/white; 8 bits give 256 colours; 24 bits give the millions in a photo.

The size arithmetic

File size = pixels × colour depth. A 100×100 image at 8 bits/pixel: 10,000 pixels × 8 bits = 80,000 bits = 10,000 bytes ≈ 9.8 KB. Double the width AND height and size quadruples. This is why cameras compress — and why GCSE loves this calculation.

Overflow, and getting the units right

Add 10110101 and 01010011 in binary, column by column, carrying whenever you reach two: the answer is 100001000 — nine bits from two eight-bit numbers. In an 8-bit register that leading 1 has nowhere to go, so it is lost and the stored answer is wrong. This is OVERFLOW, and it is why systems declare how many bits they use. Now a sound calculation, which is the one candidates lose marks on: file size = sample rate × bit depth × duration × channels. For 10 seconds of stereo at 44,100 Hz and 16 bits: 44,100 × 16 × 10 × 2 = 14,112,000 bits. Divide by 8 for bytes (1,764,000), then by 1,000 for kilobytes — about 1,764 kB, or 1.76 MB. Write the unit on every line; a bits-for-bytes slip is a factor of eight and turns a right method into a wrong answer.

The School — all subjects · Knowledge map