How computers work
A computer does four jobs: input (keyboard, mouse, touch, microphone), processing (the CPU, the brain that follows instructions), output (screen, speaker, printer) and storage. There are two kinds of keeping data: memory (RAM) is fast but forgets when power goes off, and storage (SSD, hard disk, memory card) keeps files for a long time.
Hardware is the parts you can touch. Software is the instructions. The operating system (such as Windows, Android, Linux or iOS) is the manager: it starts programs, shares memory and the CPU between them, handles files, and talks to devices through drivers. Application software (a browser, a spreadsheet, a game, a photo editor) is what you use to do a task. When you pick an application, check that it works with your operating system.
Ways of representing information: bits and bytes
A computer is built from tiny switches that are ON or OFF. We write ON as 1 and OFF as 0. One such digit is a bit. Eight bits make a byte.
In binary, each place is worth double the one to its right: 128, 64, 32, 16, 8, 4, 2, 1. For 01000001, add the values where there is a 1: 64 + 1 = 65. A character code (such as ASCII or Unicode) says 65 is the letter A, 66 is B, and so on.
- Numbers: binary.
- Text: a number for each character.
- Pictures: a grid of tiny coloured squares (pixels), each with number codes for colour.
- Sound: many measurements of the sound wave per second.
Units: 1 kilobyte (KB) is about a thousand bytes, 1 megabyte (MB) about a million, 1 gigabyte (GB) about a billion.
Algorithms and programs
An algorithm is a finite list of clear steps that solves a problem. It can be written in words or drawn as a flowchart. Every algorithm is built from three ideas:
- Sequence: steps one after another.
- Selection: a decision, such as if the flag is reached, stop.
- Repetition (loop): do something again, such as repeat 4 times: move.
A program is an algorithm written in a programming language (such as Python or Scratch) so the computer can run it. The computer does exactly what you write, not what you meant. A mistake in a program is a bug, and finding and fixing it is debugging. Good habit: test with small examples and fix one bug at a time.
Example in plain code: repeat 4: move() makes a robot walk four cells.
Using information networks
A network joins computers so they can share information. Your phone connects to a router, which links to the wider internet. A server is a computer that stores web pages or services and answers requests (the client asks, the server replies).
Messages do not travel in one piece. They are cut into small packets, each with an address, sent by different routes, and put back in order at the end. That is why the network keeps working even if one route is busy.
Use networks safely: use strong passwords, do not share private details, check a link before opening it, and remember that anything you post can be copied.
Modelling and simulation
A model is a simple copy of something real that keeps the important parts and drops the rest. A simulation runs the model on a computer to see what happens when we change something, without the cost or danger of the real thing. Examples: testing how a bridge handles load, forecasting rain, or trying different traffic light timings. Results are only as good as the model and the numbers put in, so we compare with reality.
Try it: be the robot
Ask a friend to be a robot on a line of 5 floor tiles. Write an algorithm on paper (sequence, one decision, one loop). The robot must follow your words exactly. Where did the robot go wrong? That is a bug. Fix it and try again. Then flip the lamps in the 3D free play to make the letter C (67).
Key formulas and definitions
- Computer jobs: Input, Process, Output, Store.
- 1 byte = 8 bits.
- Binary place values: 128, 64, 32, 16, 8, 4, 2, 1.
- Number of different values in n bits = 2 to the power n.
- Algorithm = sequence + selection + repetition.
- Program = algorithm written in a programming language.
Worked examples
1. Convert the binary number 00001101 to decimal.
Add the place values with a 1: 8 + 4 + 1 = 13.
2. How many different values can 8 bits store?
Each bit has 2 choices, so 2 x 2 x ... eight times = 2^8 = 256 values (0 to 255).
3. Write an algorithm to find the largest of three numbers.
1) Take the first number as 'largest'. 2) Look at the second number: if it is bigger than 'largest', make it the new 'largest'. 3) Do the same for the third number. 4) Say 'largest'. It uses sequence and selection.
4. A photo file is 3 MB and your phone has 12 GB free. About how many such photos fit?
12 GB = 12,000 MB (about). 12,000 / 3 = 4,000 photos.
Common mistakes
- Mixing up memory (RAM, temporary) and storage (permanent).
- Thinking an algorithm and a program are the same. The algorithm is the idea; the program is the idea written in code.
- Assuming the computer understands what you mean. It follows exactly what you write, so a missing step is a bug.
- Reading binary from the wrong side. The right-most bit is worth 1.