💻 Year 7 Computer Science

Algorithms, binary, hardware, networks, and e-safety — the foundations of computing.

Algorithms

What is an Algorithm?

  • An algorithm is a precise, step-by-step set of instructions for solving a problem
  • A good algorithm: works for all valid inputs, terminates (doesn't run forever), produces the correct output
  • Algorithms can be expressed as pseudocode, flowcharts, or plain English

Flowcharts

  • Oval: start/end (terminal) | Rectangle: process (action) | Diamond: decision (question with yes/no)
  • Parallelogram: input/output | Arrows show the flow of control

Three Types of Programming Structure

  • Sequence: instructions execute in order, one after another
  • Selection (IF statements): choose between two or more paths based on a condition
  • Iteration (loops): repeat instructions. Two main types: count-controlled (for loop) and condition-controlled (while loop)

Searching Algorithms

  • Linear search: check each item one by one from start to finish. Works on any list. Can be slow for large lists (worst case: check all items)
  • Binary search: requires a sorted list. Check the middle item; if the target is smaller, search the left half; if larger, search the right half. Repeat. Much faster for large lists

Sorting Algorithms

  • Bubble sort: compare adjacent pairs; swap if out of order; repeat passes until no swaps needed. Simple but slow for large lists
  • Merge sort: split list in half repeatedly, sort each half, then merge them back together. Faster for large lists

Programming Basics

Key Programming Concepts

  • Variable: a named location in memory that stores a value (can change). e.g. score = 0
  • Constant: like a variable, but its value cannot change. e.g. MAX_LIVES = 3
  • Data type: the type of value stored. Common types: integer (whole number), float/real (decimal number), string (text), Boolean (True or False)
  • Input: data entered by the user. e.g. name = input("Enter your name: ")
  • Output: data displayed to the user. e.g. print("Hello")
  • Operator: performs a calculation. Arithmetic: + − × / // (integer division) % (modulo/remainder)
  • Comparison operators: == (equal to) != (not equal) > < >= <=
  • Logical operators: AND, OR, NOT

Selection (IF Statements)

Python Example score = int(input("Enter score: ")) if score >= 70: print("Pass") elif score >= 50: print("Near pass") else: print("Fail")

Iteration (Loops)

  • FOR loop (count-controlled): repeats a fixed number of times
  • WHILE loop (condition-controlled): repeats as long as a condition is True
For Loop Example for i in range(1, 6): print(i) # Prints 1, 2, 3, 4, 5 While Loop Example password = "" while password != "secret": password = input("Enter password: ") print("Access granted")

Subprograms (Functions and Procedures)

  • A function / procedure is a named block of code that can be called multiple times
  • Reduces repetition (DRY principle: Don't Repeat Yourself)
  • Functions return a value; procedures do not

Binary & Data Representation

Binary (Base 2)

  • Computers use binary (0s and 1s) because electronic circuits have two states: off (0) and on (1)
  • A bit (binary digit) is the smallest unit: 0 or 1
  • A byte = 8 bits
  • 1 KB (kilobyte) ≈ 1000 bytes; 1 MB ≈ 1,000,000 bytes; 1 GB ≈ 1,000,000,000 bytes

Binary Column Values

  • 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 (powers of 2, from left to right)
  • To convert decimal to binary: find which powers of 2 add up to the number
  • e.g. 75 = 64 + 8 + 2 + 1 = 01001011 in binary
  • To convert binary to decimal: multiply each bit by its column value and add
  • e.g. 10110101 = 128+32+16+4+1 = 181

Adding Binary Numbers

  • 0 + 0 = 0 | 0 + 1 = 1 | 1 + 0 = 1 | 1 + 1 = 10 (carry 1)
  • 1 + 1 + 1 = 11 (write 1, carry 1)

Hexadecimal (Base 16)

  • Hex digits: 0 1 2 3 4 5 6 7 8 9 A B C D E F (A=10, B=11, C=12, D=13, E=14, F=15)
  • Used in computing because each hex digit represents exactly 4 binary digits (a nibble)
  • e.g. hex FF = 1111 1111 in binary = 255 in decimal
  • Used in: web colours (#FF5733), MAC addresses, memory addresses

Data Types & Storage

Text (Character Encoding)

  • ASCII: 7-bit code; represents 128 characters (letters, digits, punctuation)
  • e.g. 'A' = 65, 'a' = 97, '0' = 48
  • Unicode: extended system that covers all world languages; UTF-8 most common
  • Unicode uses more bits, allowing over 1 million characters

Images

  • A bitmap image is made of pixels (picture elements)
  • Each pixel stores colour data as binary
  • Colour depth: the number of bits used per pixel. 1 bit = 2 colours; 8 bits = 256 colours; 24 bits = 16.7 million colours
  • Image file size (bits) = width × height × colour depth
  • Higher resolution (more pixels) = larger file size, more detail

Sound

  • Analogue sound is converted to digital using Analogue-to-Digital Converter (ADC)
  • Sample rate: how many times per second the sound is measured (Hz). Higher = better quality
  • Sample resolution (bit depth): how many bits used per sample. Higher = more precise
  • Sound file size = sample rate × sample resolution × duration (seconds) × channels

Data Compression

  • Compression reduces file size for faster transmission and less storage
  • Lossy compression: removes some data permanently; quality is slightly reduced (MP3 for audio, JPEG for images)
  • Lossless compression: no data is lost; the original can be perfectly restored (PNG, ZIP)

Hardware & Software

Inside a Computer

  • CPU (Central Processing Unit): the "brain" — fetches, decodes, and executes instructions
  • RAM (Random Access Memory): temporary memory; holds currently running programs and data; lost when power off
  • ROM (Read Only Memory): permanent memory; holds the boot instructions (BIOS/UEFI); not lost when power off
  • Hard disk drive (HDD) / Solid state drive (SSD): permanent secondary storage for files, programs, OS
  • Motherboard: the main circuit board; connects all components
  • GPU (Graphics Processing Unit): handles graphics and display rendering
  • Power supply unit (PSU): converts mains electricity to DC for components

Input and Output Devices

  • Input devices: keyboard, mouse, touchscreen, microphone, scanner, webcam, barcode reader
  • Output devices: monitor, printer, speakers, headphones, projector
  • Some devices are both input and output: touchscreen, headphones with microphone

Software

  • System software: manages the hardware and provides a platform for other software. Includes: operating system (OS), device drivers, utilities
  • Application software: designed for a specific user task. Includes: word processors, web browsers, games, email clients
  • Operating system (OS): manages memory, runs programs, handles file management, provides user interface. Examples: Windows, macOS, Linux, Android, iOS

Networks & the Internet

Types of Network

  • LAN (Local Area Network): covers a small area (home, school, office); connected by cables or Wi-Fi; owned by the organisation
  • WAN (Wide Area Network): covers a large area (country, world); the Internet is the world's largest WAN; uses leased telephone lines and satellites

Network Hardware

  • Router: directs data packets between networks; connects a LAN to the Internet
  • Switch: connects devices within a LAN; sends data only to the intended device
  • Network Interface Card (NIC): hardware in a device that enables network connection
  • Wireless Access Point (WAP): allows devices to connect via Wi-Fi
  • Modem: converts digital data to analogue signals (for transmission over telephone lines) and back

Network Topologies

  • Star topology: all devices connect to a central switch/hub. Reliable (if one device fails, others work); fast; expensive
  • Bus topology: all devices share one cable. Cheaper; if the cable fails, whole network fails
  • Ring topology: devices connected in a circle. Each device has exactly two connections

Protocols

  • A protocol is an agreed set of rules for how data is transmitted
  • TCP/IP: the fundamental protocol suite of the Internet; breaks data into packets and reassembles them
  • HTTP: used to request web pages (HyperText Transfer Protocol)
  • HTTPS: secure version of HTTP; data is encrypted using SSL/TLS
  • FTP: File Transfer Protocol; used to transfer files between computers
  • SMTP/POP3/IMAP: used for sending and receiving email
  • DNS (Domain Name System): translates domain names (e.g. google.com) into IP addresses

E-Safety & Cybersecurity

Staying Safe Online

  • Use strong, unique passwords for each account. A strong password is long, mixes letters/numbers/symbols, and doesn't use personal information
  • Enable two-factor authentication (2FA) where possible
  • Never share personal information (full name, address, school, photos) with strangers online
  • Recognise phishing emails: urgent language, poor spelling, suspicious links — do NOT click unknown links
  • Only download software from trusted sources
  • Use privacy settings on social media to control who sees your information
  • If you see something that worries you online, tell a trusted adult

Types of Cybercrime and Threats

  • Malware: malicious software. Types include: virus (spreads and damages files), worm (spreads itself across networks), Trojan (looks legitimate but is harmful), ransomware (encrypts files and demands payment), spyware (records user activity secretly)
  • Phishing: fake emails/websites pretending to be trusted organisations to steal login details or financial information
  • Hacking: gaining unauthorised access to computer systems
  • Social engineering: manipulating people into giving away sensitive information
  • DDoS attack: overwhelming a server with traffic so it cannot function

Protection

  • Antivirus software: detects and removes malware
  • Firewall: monitors and controls incoming/outgoing network traffic based on rules
  • Encryption: scrambles data so only authorised users can read it
  • Regular updates and patches: fix security vulnerabilities in software
  • Backup: keeping copies of data in case of data loss from attack or hardware failure

Digital Wellbeing

  • Screen time: balance screen use with offline activities, sleep, and face-to-face interaction
  • Cyberbullying: bullying that takes place through digital technology. If experienced: keep evidence, block the bully, tell a trusted adult, report to the platform
  • Online gaming: be careful about in-game purchases, stranger contact, and excessive play time
  • Copyright: using someone else's work (images, music, code) without permission may be illegal
  • Digital footprint: everything you do online can leave a permanent record — think before you post