📘 CodingMarble Learn

Computers and Programming: How Computers Work and How We Instruct Them

A computer takes input, processes it with the CPU using memory, and gives output; storage keeps files and the operating system manages everything. All information (numbers, letters, pictures, sound) is stored as bits, 1s and 0s, in groups of 8 called bytes. To solve a problem we first write an algorithm (clear steps using sequence, decision and repetition) and then a program, which is the algorithm written in a programming language. Computers also share information through networks, in small packets, and can run models and simulations to test ideas safely.

🎬 Step-by-step story

  1. A computer takes input, works on it with the CPU and memory, and gives output. Storage keeps your files.
  2. All information is bits: ON is 1 and OFF is 0. Eight lamps make a byte. 01000001 is 65, which means the letter A.
  3. An algorithm is a list of clear steps: do things in order, decide, and repeat. It comes before any code.
  4. A program is the algorithm in a language the computer can read. The robot follows 'repeat 4: move' exactly.
  5. A network sends messages as small packets through a router to a server and back.
  6. Free play: flip the eight lamps and watch the number and the letter change.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

What is the difference between memory and storage?

Memory is quick and temporary, used while working. Storage is for keeping files when the power is off.

How can a computer show pictures and play songs if it only knows 0 and 1?

Everything is turned into numbers first: letters get a number, pictures are grids of coloured dots with number codes, sounds are many measurements per second.

Do I write the algorithm or the program first?

Algorithm first. Plan the steps (sequence, decision, repetition), and then write them in a programming language.

Why does the computer not do what I meant?

It does exactly what is written. A missing or wrong step is a bug. Test and fix it step by step.

How does a message reach my friend so fast?

It is cut into small packets that travel through routers to the server and are put back together at the end.

How do I read a binary number?

Add the place values (128, 64, 32, 16, 8, 4, 2, 1) wherever the lamp is on. Try the free play.

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.

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:

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

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

Practice quiz

1. How many bits make one byte?
2. Which part keeps files when the power is off?
3. Which is a decision in an algorithm?
4. What does an operating system do?
5. A message sent over the internet is split into:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

How does a computer work in simple words?

It takes input, the CPU processes it using memory, it shows output, and storage keeps the files. The operating system manages everything.

What is the difference between an algorithm and a program?

An algorithm is a list of clear steps to solve a problem. A program is that algorithm written in a programming language.

Why do computers use binary?

Computer parts are tiny switches that are ON or OFF, so two digits, 1 and 0, are easy and reliable to store and process.

Where this is taught

Japan高校(専門学科)1〜3年Marine Information Technology
Japan高校(専門学科)1〜3年Information for Lifestyle Industries
Japan高校(専門学科)1〜3年Information Industry and Society

Learn first

Learn next

Related lessons

All Computer Science lessons