Topic 2: Data

Number systems, data representation, and compression

Number Systems

Computers use binary (base-2) to store and process all data. You need to understand three number systems and how to convert between them.

Denary (Base-10)

The number system we use every day.

Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Example: 156 = (1×100) + (5×10) + (6×1)

Binary (Base-2)

The language of computers - only 0s and 1s.

Digits: 0, 1

Example: 1010 = 8 + 0 + 2 + 0 = 10

Hexadecimal (Base-16)

Shorthand for binary - used for colours, memory addresses.

Digits: 0-9, A, B, C, D, E, F

Example: 2F = (2×16) + (15×1) = 47

Binary Place Values

Each position in a binary number represents a power of 2:

128 64 32 16 8 4 2 1 Denary
0 0 0 0 1 0 1 0 10
0 1 1 0 0 1 0 1 101
1 1 1 1 1 1 1 1 255

Data Units

Key Definitions

  • Bit - A single binary digit (0 or 1)
  • Nibble - 4 bits
  • Byte - 8 bits (can store values 0-255)
  • Kilobyte (KB) - 1,000 bytes (or 1,024 bytes)
  • Megabyte (MB) - 1,000 KB
  • Gigabyte (GB) - 1,000 MB
  • Terabyte (TB) - 1,000 GB

Hexadecimal Conversion

Hexadecimal uses 16 digits. Letters A-F represent values 10-15:

Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
Denary 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Why Use Hexadecimal?

  • Shorter: One hex digit = 4 binary digits (1 nibble)
  • Easier to read: FF is easier than 11111111
  • Common uses: Colour codes (#FF0000), MAC addresses, memory addresses
Sample Question - 3 marks 3 marks

Convert the binary number 11001010 to:

a) Denary [2 marks]

b) Hexadecimal [1 mark]

Show Mark Scheme Answer

a) Denary:

128 + 64 + 0 + 0 + 8 + 0 + 2 + 0 = 202

b) Hexadecimal:

Split into nibbles: 1100 1010 = C A = CA

Binary Arithmetic

Binary Addition

Binary addition follows these rules:

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 10

(0, carry 1)

Worked Example: 00110101 + 00011011

    00110101  (53)
  + 00011011  (27)
  ----------
    01010000  (80)
    1111      (carries)

Overflow

Overflow Error

Overflow occurs when the result of a calculation is too large to fit in the available number of bits.

Example: In 8-bit binary, the maximum value is 255. If 200 + 100 = 300, this causes overflow because 300 > 255.

Binary Shifts

Shifting bits left or right is a quick way to multiply or divide by powers of 2.

Left Shift

Multiplies by 2 for each shift

00001010 (10)
00010100 (20) ← shift left 1
00101000 (40) ← shift left 2

Right Shift

Divides by 2 for each shift (integer division)

00101000 (40)
00010100 (20) → shift right 1
00001010 (10) → shift right 2

Exam Tip

When shifting, bits that "fall off" the end are lost. New bits added are always 0. A left shift can cause overflow if a 1 is shifted out of the most significant bit position.

Representing Text

Computers store text as numbers using character sets - tables that map each character to a unique number.

ASCII

Definition

ASCII (American Standard Code for Information Interchange) uses 7 bits to represent 128 characters (0-127), including letters, numbers, punctuation, and control characters.

Common ASCII values to remember:

Character Denary Binary
A6501000001
Z9001011010
a9701100001
z12201111010
04800110000
Space3200100000

Unicode

Definition

Unicode is a universal character set that can represent characters from all languages in the world, plus emojis and symbols. It uses up to 32 bits per character, allowing for over 1 million characters.

ASCII

  • 7 bits = 128 characters
  • English only
  • Smaller file sizes
  • Faster to process

Unicode

  • Up to 32 bits = 1+ million characters
  • All world languages
  • Includes emojis
  • Larger file sizes

Representing Images

Key Definitions

Digital images are made up of pixels (picture elements). Each pixel's colour is stored as a binary number.

Key Terms

Resolution

The number of pixels in an image, usually expressed as width × height (e.g., 1920 × 1080).

Higher resolution = more detail but larger file size.

Colour Depth

The number of bits used to store each pixel's colour.

  • 1-bit = 2 colours (black/white)
  • 8-bit = 256 colours
  • 24-bit = 16.7 million colours

Calculating Image File Size

Formula

File Size (bits) = Width × Height × Colour Depth

Example: A 800 × 600 image with 24-bit colour:

800 × 600 × 24 = 11,520,000 bits = 1,440,000 bytes = 1.44 MB

Metadata

Metadata is additional data stored with an image file, including:

June 2022 - Paper 1 3 marks

Calculate the file size in bytes of an image that is 640 × 480 pixels with a colour depth of 8 bits. Show your working.

Show Mark Scheme Answer

File size = width × height × colour depth

= 640 × 480 × 8 [1 mark]

= 2,457,600 bits [1 mark]

= 2,457,600 ÷ 8 = 307,200 bytes [1 mark]

Representing Sound

Sound is an analogue signal (continuous wave). To store it digitally, we must sample it at regular intervals.

Key Terms

Sample Rate

The number of samples taken per second, measured in Hertz (Hz).

CD quality: 44,100 Hz (44.1 kHz)

Higher sample rate = better quality, larger file

Bit Depth

The number of bits per sample, determining the range of values each sample can have.

CD quality: 16-bit

Higher bit depth = more accurate, larger file

Calculating Audio File Size

Formula

File Size (bits) = Sample Rate × Bit Depth × Duration (seconds)

Example: 30 seconds of audio at 44,100 Hz with 16-bit depth:

44,100 × 16 × 30 = 21,168,000 bits = 2,646,000 bytes ≈ 2.65 MB

Exam Tip

For stereo audio, multiply by 2 (left and right channels). The formula becomes:

File Size = Sample Rate × Bit Depth × Duration × Channels

Compression

Definition

Compression reduces the size of a file so it takes up less storage space and can be transmitted faster. There are two types: lossy and lossless.

Lossy Compression

Permanently removes some data to reduce file size. Cannot be reversed.

Characteristics:

  • Smaller file sizes
  • Some quality is lost
  • Original cannot be recovered

Examples:

  • JPEG (images)
  • MP3 (audio)
  • MP4 (video)

Best for:

Streaming, web images, when quality loss is acceptable

Lossless Compression

Reduces file size without losing any data. Fully reversible.

Characteristics:

  • Larger than lossy (but smaller than original)
  • No quality loss
  • Original can be perfectly reconstructed

Examples:

  • PNG (images)
  • FLAC (audio)
  • ZIP (files)

Best for:

Text, code, medical images, when quality matters

Run Length Encoding (RLE)

A simple lossless compression technique that replaces repeated data with a count and value.

Example

Original: AAAAAABBBBCCCCCCCC

Compressed: 6A4B8C

18 characters reduced to 6 characters!

June 2023 - Paper 1 4 marks

Explain the difference between lossy and lossless compression. Give an example of when each type would be appropriate.

Show Mark Scheme Answer

Lossy [2 marks]:

  • Permanently removes data/reduces quality
  • Appropriate for: streaming media, web images, where smaller size matters more than perfect quality

Lossless [2 marks]:

  • No data is lost/original can be reconstructed
  • Appropriate for: text files, program code, medical images, where accuracy is essential

Topic 2 Quiz

Test your knowledge of data representation with this quiz. Download your PDF certificate when complete!

Enter Your Details

Key Terms Summary

Binary - Base-2 number system using 0 and 1
Denary - Base-10 number system (0-9)
Hexadecimal - Base-16 number system (0-F)
Bit - Single binary digit
Byte - 8 bits
Overflow - Result too large for available bits
ASCII - 7-bit character encoding (128 chars)
Unicode - Universal character encoding
Resolution - Number of pixels in an image
Colour Depth - Bits per pixel
Sample Rate - Samples per second (Hz)
Lossy - Compression that loses data permanently