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.
Hexadecimal exists to be read by people
Machines never use hex — it is a shorthand for humans, because one hex digit is exactly four bits. 11111111 is FF, which is quicker to say, write and check than eight ones. That is the whole reason colours are written #FF0000 and memory addresses in hex: fewer characters, and errors are easier to spot.
Negative numbers need a sign, not a minus
Binary has no minus sign, so negative numbers use TWO'S COMPLEMENT: flip every bit, then add 1. To store −5 in 8 bits, start from 5 (00000101), flip every bit (11111010), then add 1: 11111011. The leftmost bit doubles as a sign — 1 means negative — which is why an 8-bit SIGNED range runs from −128 to 127 rather than 0 to 255. The same eight bits, 11111011, mean 251 unsigned or −5 signed; the pattern alone never says which, only the format does.