Computer Science lessons
Computer Science: programming, data structures, algorithms, data representation, computer systems, networks and databases.
Key topics
- Programming fundamentals
- Data structures
- Algorithms
- Data representation
- Computer systems
- Networks & databases
Lesson course
Work through each lesson, run the interactive practice, and tick it off as you go.
1. Programming fundamentals
Core
Variables & data types
Use variables, types and operators.
A variable is a named store for a value with a data type (integer, real, boolean, string, char). Operators do arithmetic, comparison and logic.
Write a program using three different data types.
Selection & iteration
Use if/else and loops to control flow.
Selection (if/else) chooses a path based on a condition; iteration (for/while) repeats code. Together they control program flow.
Write a program using selection and a loop.
Subroutines & decomposition
Use procedures, functions and decomposition.
Subroutines (procedures and functions) are reusable named blocks; decomposition breaks a problem into smaller, manageable parts.
Refactor a program into two subroutines.
2. Data structures
Core
Arrays & lists
Use arrays and access by index.
An array stores many items of the same type under one name, accessed by an index (usually starting at 0).
Write code to total the values in an array.
Stacks & queues
Compare LIFO and FIFO structures.
A stack is LIFO (last in, first out); a queue is FIFO (first in, first out).
Trace push/pop and enqueue/dequeue operations.
Trees & hash tables
Describe trees and hashing.
A tree is a hierarchical structure of nodes; a hash table maps keys to values via a hash function for fast lookup.
Explain how a hash table gives fast lookup.
3. Algorithms
Core
Searching
Compare linear and binary search.
Linear search checks each item in turn; binary search repeatedly halves a sorted list, which is much faster.
Trace a binary search on a sorted list.
Sorting
Compare bubble and merge sort.
Bubble sort repeatedly swaps adjacent out-of-order items; merge sort divides, sorts and merges, and is more efficient on large data.
Trace one pass of bubble sort.
Complexity (Big-O)
Describe time complexity with Big-O.
Big-O describes how run time grows with input size: O(1) constant, O(n) linear, O(log n) logarithmic, O(n²) quadratic.
Match algorithms to their Big-O.
4. Data representation
Core
Binary & hexadecimal
Convert between binary, denary and hex.
Computers store data in binary (base 2). Hexadecimal (base 16) is a shorthand where one hex digit equals 4 bits.
Convert five numbers between bases.
Representing data
Explain how text, images and sound are stored.
Text uses character sets (ASCII, Unicode); images are grids of pixels with colour values; sound is sampled amplitude.
Explain how an image is represented digitally.
Compression
Compare lossless and lossy compression.
Compression reduces file size: lossless keeps all data (e.g. run-length encoding); lossy discards some data (e.g. JPEG).
Give one use of each compression type.
5. Computer systems
Core
CPU & fetch-execute
Describe the CPU and its cycle.
The CPU runs the fetch-decode-execute cycle. Key parts are the ALU, control unit and registers; performance depends on clock speed, cores and cache.
Describe each step of the fetch-execute cycle.
Memory & storage
Compare RAM, ROM and secondary storage.
RAM is volatile working memory; ROM is non-volatile; secondary storage (SSD/HDD) keeps data permanently.
Classify five examples as RAM/ROM/storage.
Operating systems
Explain what an operating system does.
An operating system manages hardware, memory, processes and files, and provides a user interface.
List four jobs of an operating system.
6. Networks & databases
Core
Networks & protocols
Explain networks, LAN/WAN and protocols.
Networks share data using protocols (TCP/IP, HTTP). LANs cover a small area; WANs span large areas; the internet is a WAN.
Explain the role of TCP/IP.
Databases
Explain relational databases and keys.
A relational database stores data in linked tables; normalisation removes redundancy; a primary key uniquely identifies a record.
Normalise one flat table into linked tables.
SQL basics
Write simple SQL queries.
SQL queries databases: SELECT chooses fields, FROM names a table, WHERE filters rows to those meeting a condition.
Write a SELECT query with a WHERE clause.
Sign in to save your progress as you go.