Computer Science (9618)
Topic 1 of 5Cambridge A Levels

Data Representation

Binary, hexadecimal, ASCII, Unicode, two's complement, floating point, and how images and sound are represented digitally.

Stage 1: Topic Introduction Video

Start the topic with a quick definition, relevance, and learning outcomes before entering the full lesson body.

Introduction

30-60 sec

Hook the learner with a simple definition, relevance, and learning outcomes.

Placed at the beginning of the topic journey.

Dry-run assets generated

Written lesson and quiz remain available while this stage video is being prepared.

Branding: seekhoasaan-default-2026Narration: neutral-friendly-urdu-englishSubtitles: burned-in-dual-language

Data Representation — CIE A Level Computer Science 9618


1. Number Systems


Binary (base 2): Uses digits 0 and 1. Each position represents a power of 2.


Converting binary to denary:

1011₂ = 1×8 + 0×4 + 1×2 + 1×1 = 11₁₀


Converting denary to binary (repeated division by 2):

45 ÷ 2 = 22 R 1

22 ÷ 2 = 11 R 0

11 ÷ 2 = 5 R 1

5 ÷ 2 = 2 R 1

2 ÷ 2 = 1 R 0

1 ÷ 2 = 0 R 1

Read remainders upward: 45₁₀ = 101101₂


Hexadecimal (base 16): Digits 0–9, A–F (A=10, B=11, C=12, D=13, E=14, F=15).

Used because 1 hex digit = 4 binary bits (a nibble).


Binary to hex: Group bits in 4s from right, convert each group.

10110111₂ = 1011 0111 = B 7 = B7₁₆


Hex to denary:

3F₁₆ = 3×16 + 15 = 48 + 15 = 63₁₀


Binary arithmetic:

  • Addition: 0+0=0; 0+1=1; 1+1=10 (carry 1); 1+1+1=11 (carry 1)
  • Example: 1101 + 0110 = 10011 (13 + 6 = 19 ✓)
  • Overflow: Result requires more bits than available.

2. Signed Integers: Two's Complement


Two's complement represents negative numbers in binary.


For an n-bit system: Range is −2ⁿ⁻¹ to 2ⁿ⁻¹−1. For 8-bit: −128 to +127.


Finding negative of a number:

  1. Write positive binary representation
  2. Invert all bits (flip 0s and 1s)
  3. Add 1

Example: Find −45 in 8-bit two's complement.

+45 = 00101101

Invert: 11010010

Add 1: 11010011 = −45 in two's complement


Recognising negative numbers: MSB (most significant bit) = 1 means negative.


Converting two's complement to denary:

11010011: MSB=1, so negative. Invert: 00101100; add 1: 00101101 = 45. Answer: −45.


3. Real Numbers: Floating Point


Floating point represents very large or very small numbers.


Format: Value = mantissa × 2^exponent (similar to scientific notation)


In binary: A normalised floating point number has mantissa beginning 0.1... (positive) or 1.0... (negative).


Trade-offs:

  • More bits in mantissa → greater precision (more significant figures)
  • More bits in exponent → greater range (larger/smaller numbers)
  • Fixed total bits: increasing one reduces the other

Example issue: 0.1 cannot be represented exactly in binary floating point — causes rounding errors in financial software.

Stage 2: Mid-Lesson Concept Video

Inserted into lesson flow using deterministic content sectioning (split by nearest heading).

Concept Breakdown

60-120 sec

Teach the core concept step-by-step with at least one worked explanation.

Placed in the middle of the lesson flow.

Dry-run assets generated

Written lesson and quiz remain available while this stage video is being prepared.

Branding: seekhoasaan-default-2026Narration: neutral-friendly-urdu-englishSubtitles: burned-in-dual-language

4. Text Representation


ASCII (American Standard Code for Information Interchange):

  • 7-bit code: 128 characters (0–127)
  • Extended ASCII: 8-bit, 256 characters
  • 'A' = 65 (01000001₂); 'a' = 97; '0' = 48
  • Covers: uppercase, lowercase, digits, punctuation, control characters

Unicode:

  • Designed to represent every character in every language
  • UTF-8: Variable length (1–4 bytes); backward compatible with ASCII
  • UTF-16: 2 or 4 bytes; efficient for languages like Urdu, Arabic, Chinese
  • UTF-32: Fixed 4 bytes per character; simple but wasteful

Why Unicode? ASCII cannot represent Urdu, Arabic, Chinese, Devanagari, etc. Unicode enables global software and multilingual text.


5. Image Representation


A bitmap image stores colour value of each pixel.


Key terms:

  • Pixel: Smallest addressable element of an image
  • Resolution: Width × Height in pixels (e.g., 1920×1080)
  • Colour depth (bit depth): Number of bits per pixel
  • 1 bit: monochrome (black/white only)
  • 8 bits: 256 colours
  • 24 bits: 16,777,216 colours ("true colour") — 8 bits each for R, G, B

File size (uncompressed):

File size = width × height × colour depth (in bits) / 8 bytes


Example: A 1920×1080, 24-bit image:

Size = 1920 × 1080 × 24 / 8 = 6,220,800 bytes ≈ 5.93 MB


Metadata: Stored with image file — includes width, height, colour depth, file format.


Vector graphics: Store geometric objects (lines, curves, shapes) as mathematical descriptions. Advantages: scale without quality loss; smaller file size for simple images. Disadvantage: complex for photographic images.


6. Sound Representation


Analogue to Digital Conversion (ADC):

  1. Sampling: Measure amplitude of analogue signal at regular intervals
  2. Quantisation: Round each sample to nearest available level

Key parameters:

  • Sampling rate: Number of samples per second (Hz). CD quality: 44,100 Hz.
  • Bit depth (resolution): Number of bits per sample. CD: 16 bits (65,536 levels).
  • Higher sampling rate + higher bit depth = better quality BUT larger file size

File size:

Sound file size (bits) = sampling rate × bit depth × duration (s) × number of channels


Example: 44,100 Hz, 16-bit, 2 channels (stereo), 3 minutes:

= 44100 × 16 × 180 × 2 = 254,016,000 bits = 31.75 MB uncompressed


7. Lossless vs Lossy Compression


Lossless compression: Original data fully recoverable after decompression.

  • Run-length encoding (RLE): replace repeating values with count + value
  • Huffman coding: frequent characters get shorter codes
  • Used for: text, program files, PNG images

Lossy compression: Some data permanently discarded; smaller files but quality reduced.

  • JPEG (images): removes high-frequency detail human eye is less sensitive to
  • MP3 (audio): removes frequencies outside human hearing range
  • Cannot recover original; not suitable for text or program files

When to use lossy: Images/audio/video for web distribution where some quality loss acceptable.

When to use lossless: Text, code, archival quality images.

Key Points to Remember

  • 1Binary↔hex: group 4 bits = 1 hex digit; B7₁₆ = 10110111₂; use nibble grouping
  • 2Two's complement: negative = flip bits + 1; MSB=1 means negative; range −2ⁿ⁻¹ to 2ⁿ⁻¹−1
  • 3Floating point: more mantissa bits = precision; more exponent bits = range; trade-off with fixed total
  • 4Unicode vs ASCII: ASCII 7-bit/128 chars; UTF-8 variable length, backward compatible, supports all scripts including Urdu/Arabic
  • 5Bitmap: file size = W×H×bit-depth/8; 24-bit = true colour (16.7M colours)
  • 6Sound: file size = sampling rate × bit depth × seconds × channels; lossless vs lossy compression

Pakistan Example

Unicode and Urdu Computing in Pakistan

Pakistan's national language Urdu requires Unicode to be represented digitally. ASCII's 128 characters are entirely insufficient for Urdu's Nastaliq script, which has over 100 distinct letter forms and ligatures. Pakistan's mobile phone manufacturers, government e-services (NADRA, SECP online portals), and news websites (Dawn, Geo) all rely on UTF-8 encoding. A NADRA ID card database storing Pakistani names in Urdu script uses UTF-8, where common Urdu characters require 2–3 bytes each. Without Unicode, Pakistan's national language would be excluded from the digital world — a critical issue for 220 million people. PTCL's IPTV platform encodes Urdu programme guide data in UTF-16, as this is more efficient for predominantly Urdu content than UTF-8.

Quick Revision Infographic

Computer Science — Quick Revision

Data Representation

Key Concepts

1Binary↔hex: group 4 bits = 1 hex digit; B7₁₆ = 10110111₂; use nibble grouping
2Two's complement: negative = flip bits + 1; MSB=1 means negative; range −2ⁿ⁻¹ to 2ⁿ⁻¹−1
3Floating point: more mantissa bits = precision; more exponent bits = range; trade-off with fixed total
4Unicode vs ASCII: ASCII 7-bit/128 chars; UTF-8 variable length, backward compatible, supports all scripts including Urdu/Arabic
5Bitmap: file size = W×H×bit-depth/8; 24-bit = true colour (16.7M colours)
6Sound: file size = sampling rate × bit depth × seconds × channels; lossless vs lossy compression

Formulas to Know

B7₁₆ = 10110111₂; use nibble grouping
MSB=1 means negative; range −2ⁿ⁻¹ to 2ⁿ⁻¹−1
Floating point: more mantissa bits = precision; more exponent bits = range; trade-off with fixed total
supports all scripts including Urdu/Arabic
Pakistan Example

Unicode and Urdu Computing in Pakistan

Pakistan's national language Urdu requires Unicode to be represented digitally. ASCII's 128 characters are entirely insufficient for Urdu's Nastaliq script, which has over 100 distinct letter forms and ligatures. Pakistan's mobile phone manufacturers, government e-services (NADRA, SECP online portals), and news websites (Dawn, Geo) all rely on UTF-8 encoding. A NADRA ID card database storing Pakistani names in Urdu script uses UTF-8, where common Urdu characters require 2–3 bytes each. Without Unicode, Pakistan's national language would be excluded from the digital world — a critical issue for 220 million people. PTCL's IPTV platform encodes Urdu programme guide data in UTF-16, as this is more efficient for predominantly Urdu content than UTF-8.

SeekhoAsaan.com — Free RevisionData Representation Infographic

Stage 3: End-of-Topic Summary Video

End the topic with a concise recap of key takeaways, formulas, and revision reminders.

Summary

30-60 sec

Provide a concise revision recap with key formulas/definitions and next steps.

Placed near the end of the topic journey.

Dry-run assets generated

Written lesson and quiz remain available while this stage video is being prepared.

Branding: seekhoasaan-default-2026Narration: neutral-friendly-urdu-englishSubtitles: burned-in-dual-language

Test Your Knowledge!

5 questions to test your understanding.

Start Quiz