# How do Computers work?

Have you ever wondered how a computer actually works? Have you ever looked inside your computer and wondered what all those parts are? We hope this worksheet will help to answer those questions for you.

### **What is a computer?**

A computer is an electronic device that takes input from the outside world, processes it according to a set of instructions, stores some data and produces output. This is true if you are doing your homework: typing your answers (input), formatting and arranging it on a page (processing), storing it on your computer (storage) and showing it on the screen or printing it out (output). It’s also true if you are using your computer to play a game. You give input to the computer with your keyboard, mouse or controller, the computer responds to your input by moving your character around and checking if you have collided with something, for example. It stores your current position and score and the output is the graphics on the screen and sound.

![](https://lh6.googleusercontent.com/Gkq3cdE0_T1WaqHNwprOM74kFchYjgjJRhyD40LaOOoIjIx0E2g7fjpjSmQphwvbT1DqcOuiGkzPskRL8UwrG3UOjC6bR9qzNFVEAcA5MpZYfTGbE0jGnh4-rfYnSs1KmgwSt_rA)

### Input and Output devices&#x20;

<mark style="color:red;">An input device is one that allows you to send data to the computer. An output device is one that the computer sends data to. Can you categorise these devices into input or output devices?</mark>&#x20;

* Keyboard&#x20;
* Printer&#x20;
* Screen
* Mouse
* Microphone
* Speakers
* Scanner
* Projector
* Barcode reader

### Computers and Electricity

Computers use electric circuits and switches to represent all data and instructions. These switches allow electricity to be on or off in a circuit. We combine lots of circuits and switches to represent data and instructions.

![](https://2662351606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_6UDUiGoJDhr_OXetO%2Fuploads%2F3kZSjPN89rf4GCg4Kslp%2Fimage.png?alt=media\&token=a1c56240-bb74-4d6a-8d04-c1b8383cd944)

Switches in this state could represent the number 174, the character **®** or this colour:

![](https://2662351606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_6UDUiGoJDhr_OXetO%2Fuploads%2FoXMKq4prM08hb7atkZUd%2Fimage.png?alt=media\&token=4f80f656-671e-41d1-b732-6d874e31d5fe)

<mark style="color:red;">**How is this possible and why would we do this?**</mark>&#x20;

Computers use electric wires and circuits to carry all information and the electricity in those wires is either on or off. With one wire, you can represent: yes or no; true or false; 1 or 0. We can create codes for colours, text characters and sound and represent them with numbers.&#x20;

We can then convert these numbers into something called binary. Binary is a counting system that uses two different characters: 0 and 1.

### Binary and decimal

**Decimal**

Think about the numbers you use every day. You are, of course, happy that with a number like 9999 those 9s have different values because they are in different places in the number. The one on the left is worth 9000 because it is in the 1000s column.

![Table showing Decimal numbering](https://2662351606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_6UDUiGoJDhr_OXetO%2Fuploads%2Fqsh4HLvffEbgidVICXKK%2FScreenshot%202022-02-14%20at%2012.21.55.png?alt=media\&token=e65aa71b-8a4f-423d-9670-35d639787dad)

This number system is called **decimal** or **base ten**. We have ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The place values are multiplied by ten as you move from right to left.

**Binary**

Computers use binary to represent all data. **Binary** is also called **base 2**. This follows the same system but multiplies <mark style="color:blue;">**by 2 instead of 10**</mark>.  <mark style="color:red;">Can you guess how many digits there are in binary? What about the place values, can you fill them in?</mark>

![](https://2662351606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_6UDUiGoJDhr_OXetO%2Fuploads%2FDmd16fObXCP04jFXDkvk%2Fimage.png?alt=media\&token=8f4b14e2-be1d-43b8-80da-b22f2b4c8870)

If you have got this right, you will have represented the decimal number **15 in binary**. Can you see why?

{% hint style="info" %}

### <mark style="color:blue;">Answers</mark>

<mark style="color:blue;">**Input and output devices**</mark>

* <mark style="color:blue;">Keyboard - input device</mark>
* <mark style="color:blue;">Printer - output device</mark>
* <mark style="color:blue;">Screen - output device (unless it's a touch screen, then it's both input and output)</mark>
* <mark style="color:blue;">Mouse - input device</mark>
* <mark style="color:blue;">Microphone - input device</mark>
* <mark style="color:blue;">Speakers - output device</mark>
* <mark style="color:blue;">Scanner - input device</mark>
* <mark style="color:blue;">Projector - output device</mark>
* <mark style="color:blue;">Barcode reader - input device</mark>

<mark style="color:blue;">**Binary place values**</mark>

![](https://2662351606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_6UDUiGoJDhr_OXetO%2Fuploads%2FxLWcbZcyBLU11a5oAc3V%2Fimage.png?alt=media\&token=e7169545-141c-4a52-95f3-d4e804123bfc)
{% endhint %}

### **Exercises**

1. We often use binary numbers in groups of 8 bits called a byte. \ <mark style="color:red;">**Can you fill in the rest of these place values?**</mark>

![](https://2662351606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_6UDUiGoJDhr_OXetO%2Fuploads%2FHbVf3SmnNbrNdrbU0fRu%2FScreenshot%202022-02-14%20at%2009.35.44.png?alt=media\&token=af4bc9cd-1b08-4f92-b591-9a0fabc8334e)

2\. <mark style="color:red;">Convert this</mark> <mark style="color:red;"></mark><mark style="color:red;">**binary**</mark> <mark style="color:red;"></mark><mark style="color:red;">number to</mark> <mark style="color:red;"></mark><mark style="color:red;">**decimal**</mark><mark style="color:red;">: 00101001</mark>

3\. <mark style="color:red;">Convert the</mark> <mark style="color:red;"></mark><mark style="color:red;">**binary**</mark> <mark style="color:red;"></mark><mark style="color:red;">number 00001001 to</mark> <mark style="color:red;"></mark><mark style="color:red;">**decimal**</mark>

4\. <mark style="color:red;">Convert the</mark> <mark style="color:red;"></mark><mark style="color:red;">**binary**</mark> <mark style="color:red;"></mark><mark style="color:red;">number 10001000 to</mark> <mark style="color:red;"></mark><mark style="color:red;">**decimal**</mark>

5\. <mark style="color:red;">Convert the</mark> <mark style="color:red;"></mark><mark style="color:red;">**decimal**</mark> <mark style="color:red;"></mark><mark style="color:red;">number 7 to</mark> <mark style="color:red;"></mark><mark style="color:red;">**binary**</mark>

6\. <mark style="color:red;">Convert the</mark> <mark style="color:red;"></mark><mark style="color:red;">**decimal**</mark> <mark style="color:red;"></mark><mark style="color:red;">number 100 to</mark> <mark style="color:red;"></mark><mark style="color:red;">**binary**</mark>

7\. <mark style="color:red;">How many different values can you store in</mark> <mark style="color:red;"></mark><mark style="color:red;">**two binary**</mark> <mark style="color:red;"></mark><mark style="color:red;">digits?</mark>&#x20;
