Data representation and security · GCSE Computer Science

Binary and data representation

From bits and overflow to hex, characters, images, sound and why compression has to throw information away — or not.

UNDERSTANDRETRIEVEREMEMBER
THE MEMORY HOOK
One extra bit doubles the range.

The important bits

What you need to know

  1. 1

    Computers are electrical switches. Two states map cleanly onto 0 and 1. A bit is one binary digit; a byte is 8 bits. Everything — numbers, text, pictures, programs — is bits interpreted by a rule.

  2. 2

    Unsigned binary place values: 128, 64, 32, 16, 8, 4, 2, 1 for one byte. 01001101 = 64+8+4+1 = 77. Practise until conversion is automatic.

  3. 3

    Binary addition is 0+0=0, 1+0=1, 1+1=10 (write 0 carry 1), 1+1+1=11. Overflow occurs when the result needs more bits than the register provides — the stored answer wraps and is wrong.

  4. 4

    A left shift multiplies by 2; a right shift divides by 2 (integer, bits fall off). Hexadecimal (base 16) is a human shorthand for nibbles: 1010 1111 = AF. It is not “more advanced binary”; it is grouping.

  5. 5

    Characters use a character set. ASCII is 7-bit (often stored in a byte) for English-centred symbols; Unicode (UTF-8 and friends) covers the world’s scripts. The same byte means different glyphs in different sets.

  6. 6

    Bitmap images: pixels in a grid. Colour depth is bits per pixel (1-bit monochrome, 24-bit roughly 16.7 million colours). File size ≈ width × height × colour depth (plus metadata). Resolution is pixel density or pixel count — say which you mean.

  7. 7

    Sound: sample rate (Hz) × bit depth × duration × channels. Higher sample rate captures higher frequencies (Nyquist: twice the highest frequency). Quantisation error is the price of finite bit depth.

  8. 8

    Compression: lossless (run-length, Huffman/FLAC/PNG) reconstructs every bit; lossy (MP3, JPEG) throws away data humans notice less. Lossy is smaller; it is also a one-way trip.

Go deeper

Overflow is a real exam trap, not a metaphor

In an 8-bit unsigned register the largest value is 255. Add 200 + 90 and the true sum is 290, which needs 9 bits (100100010). The register keeps the lowest 8 bits (00100010 = 34) and an overflow flag should fire. In two’s complement the story is about crossing the sign bit, but at GCSE unsigned addition is enough to make the point: a result that cannot be represented is not “rounded”; it is wrong. Embedded systems that ignore overflow have crashed rockets. When a paper asks why overflow happens, say “insufficient bits to store the result”, not “the computer ran out of memory”.

Go deeper

Why hex exists

Binary is truthful and unreadable. Group bits in fours and each nibble maps to one hex digit 0–F. MAC addresses, colour codes (#1A2B3C) and memory dumps become shorter and less error-prone to copy. Converting 11010111 to D7 is faster than denary if you have practised nibble tables. Hex is not a third kind of electricity. If a question asks for advantages, say “shorter than binary” and “easy conversion because 16 is 2⁴”, not “computers calculate in hex”. They do not; they calculate in binary. Hex is for humans and for compact display.

Go deeper

Images and sound are just lots of samples

A bitmap does not store a “picture”; it stores a number per pixel that a colour palette interprets. Double the colour depth and you double that part of the file, and you can represent more distinct colours. Sound is a number per sample: how far the cone should be from rest. CD-quality 44.1 kHz, 16-bit, stereo is a choice about hearing, not a law of nature. Metadata (height, width, sample rate) is the instruction manual so the player or screen knows the rule. Without metadata, bits are just bits. That sentence answers a surprising number of 2-mark questions.

WORKED EXAMPLE

See the idea in action

Calculate an image file size: 800 × 600 pixels, 24-bit colour, ignore metadata. Bits = 800 × 600 × 24 = 11,520,000. Bytes = 1,440,000. Divide by 1024 to get KiB if the paper uses 1024 (check the question). Then: if we drop to 8-bit colour, size falls by a factor of three, and we lose colour fidelity. That trade-off is the whole topic in one calculation.

Exam technique

Turn knowledge into marks

Show place values in conversions. An answer of “45” with no working can still get the mark, but a slipped add is recoverable if the examiner can see 32+8+4+1.

Common mistakes

Do not give these marks away

  1. 01

    Using 1000 instead of 1024 (or the reverse) when the question specified one convention.

  2. 02

    Saying lossy compression “makes the file smaller without losing any quality”.

  3. 03

    Forgetting overflow: writing 256 in an 8-bit unsigned slot as if it fitted.

QUICK RETRIEVAL

What happens in an 8-bit unsigned register when you add 200 + 90?

AThe register stores 290 correctly

BOverflow occurs because 290 needs more than 8 bits; the stored value is incorrect

CThe CPU automatically switches to hexadecimal

DThe extra bits are stored in the hard drive

Show the answer

Overflow occurs because 290 needs more than 8 bits; the stored value is incorrect. 8 bits hold 0–255 unsigned. 290 cannot be represented, so the extra high bit is lost (unless a larger register or flag handles it). The remaining bits are not the true sum.

Quick questions

If this is the bit you searched

Is ASCII the same as Unicode?

Unicode includes ASCII as the first 128 characters, then adds thousands more. A system using the wrong character set will mojibake letters even if the bits are unchanged.

Why is 44.1 kHz a common sample rate?

Nyquist says you need at least twice the highest frequency you want to capture. Human hearing tops out near 20 kHz, so 44.1 kHz leaves a little room and became the CD standard.