🐍 Python
💾 Storage
🌐 HTML
YEAR 9

Computing

Master algorithms, understand hardware architecture, and build your own web pages.

🔍 Algorithms
⚙️ Hardware
🗄️ Databases
Start Learning >
About this book

Year 9 prepares you for advanced computing. You will master sorting algorithms like Bubble Sort, understand how the CPU and memory work together, and finish by building your own website with HTML.

📖 Table of Contents

01
🔍

Sort & Search

Understanding how computers find and organise data using algorithms

🎯 Learning Objectives

  • Understand how linear search works and evaluate its efficiency
  • Understand how bubble sort works (passes and swaps)
  • Use abstraction to model real-world problems
  • Use subprograms with global/local variables, parameters and return values
  • Locate and fix syntax and logic errors

1.1 Linear Search

📘 Key Term: Linear Search

A linear search checks each item in a list one by one, from the beginning, until it finds the target item or reaches the end. It is the simplest search algorithm.

How Linear Search Works

Searching for the number 7 in the list: [3, 8, 1, 7, 5, 2]

3 ❌
8 ❌
1 ❌
7 ✅
Found at index 3!

It took 4 comparisons to find the item.

def linear_search(data, target): for i in range(len(data)): if data[i] == target: return i # Return the index where found return -1 # Not found # Using the function numbers = [3, 8, 1, 7, 5, 2] result = linear_search(numbers, 7) print("Found at index:", result) # Output: Found at index: 3

Efficiency of Linear Search

Scenario Comparisons Needed Example
Best case 1 Target is the first item
Worst case n (all items) Target is the last item or not in the list
Average case n ÷ 2 Target is somewhere in the middle

💡 Why Does Efficiency Matter?

With a list of 10 items, linear search is fine. But imagine searching through 1 billion items — in the worst case, you'd check all 1 billion! More efficient algorithms (like binary search) can find items in just ~30 comparisons from a billion items.

1.2 Bubble Sort

📘 Key Term: Bubble Sort

Bubble sort repeatedly steps through a list, compares each pair of adjacent items, and swaps them if they're in the wrong order. This is repeated in multiple passes until no swaps are needed, meaning the list is sorted. The largest values "bubble" up to the end.

How Bubble Sort Works

Sort: [5, 3, 8, 1, 2] — Pass 1

Compare 5 and 3 → 5 > 3, so SWAP → [3, 5, 8, 1, 2]

Compare 5 and 8 → 5 < 8, so no swap → [3, 5, 8, 1, 2]

Compare 8 and 1 → 8 > 1, so SWAP → [3, 5, 1, 8, 2]

Compare 8 and 2 → 8 > 2, so SWAP → [3, 5, 1, 2, 8]

After Pass 1: [3, 5, 1, 2, 8] — the largest value (8) has bubbled to the end ✓

def bubble_sort(data): n = len(data) for i in range(n - 1): swapped = False for j in range(n - 1 - i): if data[j] > data[j + 1]: data[j], data[j + 1] = data[j + 1], data[j] # Swap swapped = True if not swapped: break # List is sorted, stop early! return data print(bubble_sort([5, 3, 8, 1, 2])) # Output: [1, 2, 3, 5, 8]

⚠️ When Does Bubble Sort Stop?

The algorithm ends when a complete pass is made with no swaps. This means the list is fully sorted. Without this check, the algorithm still works but wastes time doing unnecessary passes.

1.3 Abstraction

📘 Key Term: Abstraction

Abstraction is the process of removing unnecessary details to focus on what's important when solving a problem. A model that represents only the key features of a real-world system is called a computational abstraction.

Examples of abstraction in the real world:

🗺️ Transport Maps

The London Underground map removes real geographical distances and focuses on station order and connections.

🍳 Recipes

A recipe is an abstraction of cooking. It lists ingredients, quantities and steps — hiding the complex chemistry.

🎮 Simulations

A speed camera simulator models only the relevant variables (speed, distance, time) without modelling the entire road.

🌡️ Greenhouse Controller

Models temperature, humidity and watering — ignoring irrelevant details like the colour of the greenhouse.

1.4 Global and Local Variables

📘 Key Terms

Local variable — declared INSIDE a subprogram. It only exists while that subprogram is running and cannot be accessed from outside it.

Global variable — declared OUTSIDE all subprograms. It can be accessed from anywhere in the program.

total_score = 0 # Global variable def add_points(points): # 'points' is a PARAMETER global total_score bonus = 10 # Local variable - only exists inside this function total_score = total_score + points + bonus add_points(5) # 5 is the ARGUMENT passed to the parameter print(total_score) # Output: 15 # print(bonus) # ERROR! bonus doesn't exist here

1.5 Parameters and Return Values

📘 Key Terms

Parameter — a variable listed in a subprogram's definition that receives a value when the subprogram is called.

Argument — the actual value passed to the parameter when calling the subprogram.

Return value — the result sent back to the calling code using the return keyword.

def calculate_bmi(weight, height): # weight & height are PARAMETERS bmi = weight / (height ** 2) # bmi is a LOCAL variable return round(bmi, 1) # RETURN VALUE sent back my_bmi = calculate_bmi(70, 1.75) # 70 and 1.75 are ARGUMENTS print("Your BMI is", my_bmi) # Output: Your BMI is 22.9

📝 Activity 1.1 — Card Sort Simulation

  1. Take 10 numbered cards (or write numbers on paper strips)
  2. Shuffle them randomly
  3. Perform a bubble sort by hand — record how many passes and swaps you need
  4. Now use a linear search to find a specific number — count the comparisons
  5. Write Python programs implementing both algorithms
  6. Test with lists of 10, 100 and 1000 items — what do you notice about speed?

📋 Chapter 1 Summary

  • Linear search checks each item one by one — simple but slow for large datasets
  • Bubble sort compares adjacent pairs and swaps them — repeats until no swaps needed
  • Abstraction removes unnecessary detail to model real-world problems
  • Local variables exist only inside their subprogram; global variables are accessible everywhere
  • Parameters receive values; return values send results back to the calling code

✅ Check Your Understanding

1. How many comparisons does a linear search need in the worst case for a list of 50 items?

2. What is a "pass" in bubble sort? When does the algorithm stop?

3. Give a real-world example of abstraction and explain what details are removed.

4. What is the difference between a local and a global variable?

5. What is the difference between a parameter and an argument?

02
🔊

Sound & Storage

How computers capture sound and the different ways data is stored

🎯 Learning Objectives

  • Understand how analogue sound is represented in binary
  • Know the terms: sample rate, amplitude and bit depth
  • Draw a graphical representation of digitised sound
  • Differentiate between storage devices and storage media
  • Select appropriate storage for different tasks

2.1 Analogue vs Digital

📘 Key Terms

Analogue signal — a continuous, smooth wave that varies over time. Sound in the real world is analogue.

Digital signal — data represented as discrete (separate) values, using binary (0s and 1s). Computers can only process digital data.

To store sound on a computer, we must convert the analogue sound wave into a digital representation. This process is called sampling.

2.2 How Sound is Digitised

When you record sound, a microphone captures the sound wave. The computer then takes samples — measurements of the wave's amplitude (height) at regular intervals.

Sampling a Sound Wave

Amplitude Time ● = Sample points — Original analogue wave ↔ Sample interval

The red dots show where the computer measures (samples) the wave. Each measurement is stored as a binary number.

Key Terms for Digital Sound

Term Definition Effect of Increasing
Sample Rate How many samples are taken per second (measured in Hz). CD quality = 44,100 Hz (44.1 kHz) More accurate sound, but larger file size
Amplitude The height of the sound wave — this determines the volume (loudness) Louder sound
Bit Depth How many bits are used to represent each sample. More bits = more possible amplitude values More accurate representation but larger file

📘 Sound File Size Formula

File size (bits) = Sample rate × Bit depth × Duration (seconds)

Divide by 8 for bytes. For stereo sound, multiply by 2 (two channels).

Worked Example: Calculate sound file size

A mono recording, 30 seconds, 44,100 Hz sample rate, 16-bit depth:

Bits: 44,100 × 16 × 30 = 21,168,000 bits

Bytes: 21,168,000 ÷ 8 = 2,646,000 bytes

KiB: 2,646,000 ÷ 1,024 ≈ 2,584 KiB

MiB: 2,584 ÷ 1,024 ≈ 2.52 MiB

2.3 Storage Devices vs Storage Media

📘 Key Terms

Storage device — the hardware that reads and writes data (e.g., a hard drive, DVD drive).

Storage media — the physical material that data is stored on (e.g., a hard disk, a DVD disc).

⚠️ Common Confusion

A hard drive is the device; the hard disk (the spinning platter inside) is the media. A DVD drive is the device; the DVD disc is the media.

Comparing Storage Technologies

Technology Type Capacity Speed Cost/GiB Durability
HDD (Hard Disk Drive) Magnetic Very high (up to 20 TB) Moderate Low Moving parts — fragile
SSD (Solid State Drive) Flash High (up to 8 TB) Very fast Higher No moving parts — robust
USB Flash Drive Flash Low–Medium (up to 1 TB) Fast Medium Portable, easy to lose
Optical (CD/DVD/Blu-ray) Optical (laser) Low (700 MB–50 GB) Slow Very low Easily scratched
Magnetic Tape Magnetic Very high Very slow (sequential) Lowest Good for long-term backup

📝 Activity 2.1 — Storage Selection Challenge

Choose the best storage technology for each scenario and justify your choice:

  1. Internal storage for a gaming laptop
  2. Backing up a company's data centre every night
  3. Storing photos on a fitness tracker/smartwatch
  4. Distributing a movie to customers in a shop
  5. A student carrying homework between school and home

📋 Chapter 2 Summary

  • Sound is an analogue signal; computers convert it to digital by sampling
  • Sample rate = samples per second; bit depth = bits per sample; amplitude = volume
  • Higher sample rate and bit depth = better quality but larger file size
  • Storage device = hardware that reads/writes; storage media = what data is stored on
  • HDD (magnetic, cheap, slow), SSD (flash, fast, robust), Optical (CD/DVD), Magnetic Tape (backup)
03
⚙️

Input, Process, Output

How computer hardware works together, and the languages that control it

🎯 Learning Objectives

  • Understand the function of CPU, main memory, secondary storage, input and output devices
  • Understand the difference between high-level and low-level programming languages
  • Understand that instructions and data are stored in main memory and executed by the CPU
  • Understand the function of RAM and ROM

3.1 Hardware Components

A computer system is made up of hardware (physical components) that work together following the Input → Process → Output model.

The Input-Process-Output Model

⌨️
INPUT
Keyboard, mouse,
microphone, sensor
🧠
PROCESS
CPU processes data
using instructions
from memory
🖥️
OUTPUT
Screen, speaker,
printer, actuator

The Central Processing Unit (CPU)

📘 Key Term: CPU

The Central Processing Unit (CPU) is the "brain" of the computer. It fetches instructions from memory, decodes them (works out what to do) and executes them (carries out the action). This is called the Fetch-Decode-Execute cycle.

3.2 Memory: RAM and ROM

Feature RAM (Random Access Memory) ROM (Read Only Memory)
Also known as Main memory
Volatile? Yes — loses contents when power is off No — retains contents without power
Contents Data and instructions currently being used by the CPU Start-up instructions (BIOS/boot-up)
Can be changed? Yes — read and write No — read only (cannot be altered by programs)

💡 Think of It Like This

RAM is like your desk — it's where you put the work you're doing right now. When you turn off the lights and leave, the desk is cleared. ROM is like a set of laminated instructions stuck to the wall — they never change and are always there when you arrive.

3.3 How It All Works Together

Programs and data are stored permanently on secondary storage (HDD/SSD)
When you open a program, it is loaded into RAM (main memory)
The CPU fetches instructions from RAM, decodes and executes them
Data may be input by the user (keyboard, mouse, sensor)
The CPU processes the data and stores results back in RAM
Results are output to devices (screen, speaker, printer)
When you save, data is written back to secondary storage

3.4 High-Level and Low-Level Languages

Feature High-Level Language Low-Level Language
Resembles Human language (English-like) Machine hardware / binary
Examples Python, JavaScript, Java, C# Machine code, Assembly language
Easy to learn? Yes — more readable No — very complex
Portable? Yes — works on different CPUs No — specific to one CPU type
Needs translation? Yes — must be compiled or interpreted into machine code Machine code: no. Assembly: yes (assembled)

📘 Key Insight

The CPU can only execute machine code (binary instructions). High-level languages must be translated into machine code before the CPU can run them. This is done by a compiler or interpreter.

📋 Chapter 3 Summary

  • Computer systems follow: Input → Process → Output (with storage)
  • The CPU fetches, decodes and executes instructions from RAM
  • RAM is volatile, holds current data; ROM is non-volatile, holds start-up instructions
  • Secondary storage (HDD/SSD) stores programs and data permanently
  • High-level languages are human-readable; low-level languages are close to hardware
  • All code must be translated to machine code for the CPU to execute it
04
🌍

Computing for All?

Networks, software licensing, ethics and the digital divide

🎯 Learning Objectives

  • Understand why computers are connected in networks
  • Know the different types of networks: LAN, WAN and PAN
  • Understand software licensing: open source vs proprietary
  • Understand the ethical impact of technology, including the digital divide

4.1 Why Use Networks?

A network is two or more devices connected together to share data and resources. The biggest network is the Internet.

Benefits of Networking

4.2 Types of Networks

Network Type Stands For Scope Example
PAN Personal Area Network Within a few metres of a person Phone connected to Bluetooth headphones
LAN Local Area Network Within one building or site A school or office network
WAN Wide Area Network Across cities, countries or the world The Internet; a bank connecting branches globally

📘 LAN vs WAN: The Key Distinction

A LAN uses your own infrastructure (cables, routers you own). A WAN uses third-party infrastructure (telecommunications companies' cables and equipment) to connect locations that are far apart.

4.3 Software Licensing

🔓 Open Source Software

  • Source code is freely available to view, modify and distribute
  • "Free" means free from restrictions, not necessarily free of cost
  • Can be modified and improved by anyone
  • Community support
  • Examples: Linux, Firefox, LibreOffice, Python, GIMP

🔒 Proprietary Software

  • Source code is owned and hidden by the company
  • Must purchase a licence to use it
  • Cannot be modified by users
  • Official support from the company
  • Examples: Windows, Microsoft Office, Adobe Photoshop, macOS

4.4 Ethical Impact of Technology

The Digital Divide

📘 Key Term: Digital Divide

The digital divide is the gap between those who have access to technology and the Internet (information rich) and those who do not (information poor). This divide exists between countries, regions, and even within communities.

Causes of the Digital Divide

💰 Economic Factors

Devices, internet access and electricity cost money. People in poverty cannot afford them.

🌐 Geographic Factors

Rural and remote areas often lack broadband infrastructure. Developing countries may have limited networks.

📚 Education

Without digital literacy training, people cannot make effective use of technology even when available.

👴 Age & Disability

Older people may lack confidence with technology. Disability can make standard devices difficult to use without assistive technology.

📝 Activity 4.1 — Digital Divide Debate

Research and prepare arguments for a class debate on the motion:

"Access to the Internet should be a basic human right."

Consider: education, healthcare, employment, cost, infrastructure challenges and government responsibility.

📋 Chapter 4 Summary

  • Networks allow sharing of files, resources, communication and collaboration
  • PAN = personal (few metres), LAN = local (one site), WAN = wide (across distances using third-party infrastructure)
  • Open source: code is free to view/modify; Proprietary: code is owned/restricted
  • The digital divide is the gap between information-rich and information-poor
  • Causes include economic, geographic, educational and demographic factors
  • Ethical issues include privacy, inclusion and equal access to technology
05
🗄️

Databases

Organising, querying and presenting structured data

🎯 Learning Objectives

  • Collect data from primary and secondary sources
  • Identify and use data types: text, number, date, currency, Boolean
  • Understand database structure: tables, records, fields, primary keys, foreign keys
  • Use searches and queries with relational and logical operators
  • Produce formatted reports

5.1 What is a Database?

📘 Key Term: Database

A database is an organised collection of structured data, stored electronically so it can be easily accessed, searched, sorted and updated.

Collecting Data

📋 Primary Data

Data you collect yourself for a specific purpose. Examples: surveys, experiments, sensor readings, interviews.

🌐 Secondary Data

Data collected by someone else. Examples: government statistics, APIs (like NASA's data), published research, websites.

5.2 Data Types

Data Type Description Example Values
Text / Alphanumeric Letters, numbers and symbols (not for calculations) "John Smith", "AB12 3CD"
Number / Numeric Whole numbers (integers) or decimals 42, 3.14, -7
Date Calendar dates (and sometimes times) 15/09/2024, 2024-09-15
Currency Monetary values with currency symbol £9.99, $150.00
Boolean / Logical Only two possible values True/False, Yes/No

⚠️ Choosing the Right Data Type

A phone number like "07123456789" should be stored as text, not a number. Why? Because you would never perform calculations on it, and storing it as a number would remove the leading zero!

5.3 Database Structure

Example: Students Table

StudentID 🔑 FirstName Surname DateOfBirth Year Group Active
1001 Emma Wilson 12/03/2011 9 Yes
1002 James Brown 28/07/2010 9 Yes
1003 Aisha Khan 15/11/2010 9 No

🔑 StudentID = Primary Key (unique identifier for each record)

↔ Each row is a record (one student's complete data)

↕ Each column is a field (one category of data)

📘 Key Database Terms

Table — a collection of related data organised in rows and columns.

Record — one complete row of data (e.g., one student's information).

Field — one column of data (e.g., "Surname").

Primary key — a unique field that identifies each record (no two records can have the same value).

Foreign key — a field in one table that links to the primary key of another table, creating a relationship between tables.

5.4 Searching and Querying

A query is a request to find specific data from a database. You specify criteria (conditions) using operators:

Relational Operators in Queries

Operator Meaning Example Query
= Equal to YearGroup = 9
<> or != Not equal to Active <> "No"
> Greater than Score > 50
< Less than Price < 10.00

Logical Operators in Queries

Operator Meaning Example
AND Both conditions must be true YearGroup = 9 AND Active = "Yes"
OR At least one condition must be true YearGroup = 9 OR YearGroup = 10
NOT Excludes matching records NOT Active = "No"

📝 Activity 5.1 — Space Database Project

Using secondary data from the People In Space API or similar source:

  1. Create a database with at least two related tables
  2. Identify the data type for each field
  3. Set appropriate primary and foreign keys
  4. Write 5 queries using AND, OR and relational operators
  5. Create a formatted report showing key findings

📋 Chapter 5 Summary

  • Databases organise data in tables with records (rows) and fields (columns)
  • Data types: text, number, date, currency, Boolean
  • Primary key = unique identifier; foreign key = links tables together
  • Queries use relational operators (=, <>, >, <) and logical operators (AND, OR, NOT)
  • Reports present query results in a professional, formatted layout
06
🌐

Web Authoring

Building web pages with HTML — the language of the World Wide Web

🎯 Learning Objectives

  • Use HTML to create web pages with headings, paragraphs, lists, images and links
  • Understand HTML structure: head, body, metadata and comments
  • Use hyperlinks, bookmarks and anchors
  • Apply font enhancements and insert multimedia
  • Create a digital portfolio showcasing your computing work

6.1 What is HTML?

📘 Key Term: HTML

HTML (HyperText Markup Language) is the standard language used to create the structure and content of web pages. It uses tags to define elements like headings, paragraphs, images and links.

HTML is not a programming language — it is a markup language. It tells the browser what to display, not how to perform calculations.

6.2 Basic HTML Structure

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>My First Web Page</title> <!-- This is a comment - browsers ignore it --> </head> <body> <h1>Welcome to My Website</h1> <p>This is my first paragraph.</p> </body> </html>

Anatomy of the HTML Structure

Element Purpose
<!DOCTYPE html> Tells the browser this is an HTML5 document
<html> The root element that wraps everything
<head> Contains metadata (title, character set, links to stylesheets) — not displayed on page
<meta> Metadata tags providing info about the page (charset, description, keywords)
<title> The page title shown in the browser tab
<body> Contains all visible content (text, images, links, etc.)

6.3 Essential HTML Tags

Headings and Text

<h1>Main Heading (largest)</h1> <h2>Sub Heading</h2> <p>This is a paragraph of text.</p> <br> <!-- Line break (no closing tag needed) -->

Lists

<!-- Unordered (bullet) list --> <ul> <li>First item</li> <li>Second item</li> </ul> <!-- Ordered (numbered) list --> <ol> <li>Step one</li> <li>Step two</li> </ol>

Images

<img src="photo.jpg" alt="A description of the image" width="400"> <!-- src = file path or URL of the image --> <!-- alt = text description (for accessibility and if image fails to load) -->

Hyperlinks

<!-- Link to another website --> <a href="https://www.bbc.co.uk">Visit BBC</a> <!-- Link to another page on your site --> <a href="about.html">About Me</a> <!-- Bookmark/anchor - link to a section on the SAME page --> <a href="#contact">Jump to Contact Section</a> <!-- The target section --> <h2 id="contact">Contact Me</h2>

📝 Activity 6.1 — Build Your Digital Portfolio

Create a multi-page website that showcases your computing work from this year. Your site must include:

  1. A home page with navigation links to other pages
  2. At least 3 separate HTML pages (e.g., Projects, About Me, Future Tech)
  3. Headings (h1–h3), paragraphs, bold/italic text
  4. At least one ordered and one unordered list
  5. At least two images with alt text
  6. Hyperlinks to external websites and between your own pages
  7. A bookmark/anchor link within a page
  8. Metadata (description, author) in the head
  9. Comments in your code explaining what each section does

📋 Chapter 6 Summary

  • HTML is a markup language that structures web page content using tags
  • Every HTML page has <html>, <head> and <body> sections
  • Key tags: h1–h6 (headings), p (paragraph), ul/ol/li (lists), img (images), a (links)
  • The <head> contains metadata (title, charset, description) — not visible on the page
  • Hyperlinks connect pages; bookmarks/anchors link to sections within a page
  • Comments (<!-- -->) help explain code without appearing on the page
📚

Glossary

Key terms and definitions from all Year 9 chapters

Term Definition
Abstraction Removing unnecessary detail to focus on key aspects of a problem
Amplitude The height of a sound wave — determines volume/loudness
Analogue Signal A continuous, smooth signal that varies over time
Argument The actual value passed to a parameter when calling a subprogram
Bit Depth Number of bits used to represent each sample of digital sound
Boolean A data type with only two values: True or False
Bubble Sort A sorting algorithm that compares adjacent items and swaps them if needed
Compiler Translates an entire high-level program into machine code before execution
CPU Central Processing Unit — the brain of the computer that executes instructions
Database An organised collection of structured data stored electronically
Digital Divide The gap between those with and without access to technology
Digital Signal Data represented as discrete binary values (0s and 1s)
Fetch-Decode-Execute The cycle the CPU follows: fetch instruction, decode it, execute it
Field A single column in a database table (one category of data)
Foreign Key A field that links to the primary key of another table
Global Variable A variable accessible from anywhere in the program
HDD Hard Disk Drive — magnetic storage with spinning platters
High-Level Language A programming language close to human language (e.g., Python)
HTML HyperText Markup Language — used to create web page structure
Interpreter Translates and executes a high-level program one line at a time
LAN Local Area Network — a network within one building or site
Linear Search A search algorithm that checks each item one by one from the start
Local Variable A variable that only exists inside the subprogram where it is declared
Low-Level Language A programming language close to machine hardware (machine code, assembly)
Machine Code Binary instructions that the CPU can directly execute
Metadata Data about data — e.g., author, description of a web page in the <head>
Open Source Software whose source code is freely available to view, modify and distribute
PAN Personal Area Network — a network within a few metres of a person
Parameter A variable in a subprogram definition that receives a value
Primary Key A unique field that identifies each record in a database table
Proprietary Software Software with restricted source code owned by a company
Query A request to find specific data from a database using criteria
RAM Random Access Memory — volatile main memory holding current data/instructions
Record A single row in a database table (one complete entry)
Return Value The result a function sends back to the code that called it
ROM Read Only Memory — non-volatile memory storing start-up instructions
Sample Rate Number of sound samples taken per second (measured in Hz)
Sampling Measuring an analogue signal at regular intervals to create a digital version
Secondary Storage Permanent storage (HDD, SSD) that retains data when power is off
SSD Solid State Drive — fast flash-based storage with no moving parts
Storage Device Hardware that reads and writes data (e.g., hard drive unit)
Storage Media The physical material data is stored on (e.g., disk, tape, flash chip)
Tag (HTML) An HTML element defined by angle brackets (e.g., <h1>, <p>, <img>)
Volatile Loses its contents when power is turned off (e.g., RAM)
WAN Wide Area Network — a network spanning large distances using third-party infrastructure

🎓

End of Year 9 Textbook

Computing