Computer Science (2210)
Topic 1 of 5Cambridge O Levels

Binary & Data Representation

How computers store and process data using 1s and 0s

Computers only understand two things: 0 and 1. Everything — text, images, videos, games — is stored as patterns of 0s and 1s (binary).


Binary Number System:

  • Uses base 2 (only digits 0 and 1)
  • Each digit is called a "bit" (binary digit)
  • 8 bits = 1 byte
  • Place values: 128, 64, 32, 16, 8, 4, 2, 1

  • Binary to Decimal Conversion:

    1011 in binary = (1×8) + (0×4) + (1×2) + (1×1) = 8 + 0 + 2 + 1 = 11 in decimal


    Decimal to Binary:

    25 in decimal: 25 = 16+8+1 → 11001


    Hexadecimal (Base 16):

    Uses digits 0-9 and A-F (A=10, B=11... F=15)

    Used because it's shorter than binary: FF in hex = 11111111 in binary = 255 in decimal


    Data Storage Units:

    1 bit → 1 nibble (4 bits) → 1 byte (8 bits) → 1 KB (1024 bytes) → 1 MB → 1 GB → 1 TB


    How Data is Stored:

  • Text: Each character has an ASCII code (A=65, a=97, 0=48)
  • Images: Made of pixels. Each pixel has a colour value. More pixels = higher resolution
  • Sound: Sampled at regular intervals. Higher sample rate = better quality
  • Key Points to Remember

    • 1Binary uses base 2 (0 and 1), Hex uses base 16 (0-F)
    • 28 bits = 1 byte, 1024 bytes = 1 KB
    • 3ASCII assigns numbers to characters (A=65)
    • 4Images = pixels with colour values, Sound = samples at intervals

    Pakistan Example

    Easypaisa & JazzCash Transactions

    When you send Rs 1,000 via Easypaisa, your phone converts everything to binary. Your phone number (11 digits) is stored as binary. The amount 1000 in binary is 1111101000 (10 bits). The MPIN you enter gets converted to binary, encrypted (scrambled using complex binary operations), and sent over the network as electromagnetic signals representing 0s and 1s. Even the beep sound you hear is stored as binary samples. Millions of binary digits fly through Pakistan's mobile networks every second for just one transaction!

    Test Your Knowledge!

    3 questions to check if you understood this topic.

    Start Quiz