Try it free

A real sample of the course: no account needed. Try a simulation, write some Python, answer five exam-style questions and read a topic note. The full course has every topic in National 5 Computing Science.

1. A simulation: step through a program

Press Step to run the program one line at a time and watch the variables change. Before a line displays anything, you are asked to predict what it will show. Finish with the Check yourself questions at the bottom.

2. Write real code

The first lesson of Python from scratch. Type in the box, press Run, and the exercises check your code for you. It all runs in your browser: nothing to install.

3. Five exam-style questions

One from each part of the course. Choose an answer, say how sure you are, then press Check. Every wrong answer tells you why it is wrong.

4. A topic note

Every topic has a short note like this one, ending with what the exam asks and what gains the mark.

Bit, a cartoon seagull

Meet Bit. Bit is a seagull who lives on the roof of Morag's chip van, and Bit understands exactly two things in this world: chip and no chip.

Ask Bit about the weather, the football or the meaning of life and you get a blank stare. Hold up a chip and you have Bit's full attention. That is not much of a personality, but it is exactly how a computer works.

Two states, two digits

A computer is built from billions of tiny switches. Each switch is either on or off. There is no "sort of on". So a computer stores everything using just two digits: 1 for on and 0 for off. That is binary.

Two boxes: a chip labelled 1 and an empty box labelled 0

We count in tens (denary), probably because we have ten fingers. Bit has no fingers and counts in twos.

Place values

In denary, each column is worth ten times the one to its right: units, tens, hundreds. In binary, each column is worth twice the one to its right. Eight columns look like this:

Place-value table: 79 in binary is 0 1 0 0 1 1 1 1, because 64 + 8 + 4 + 2 + 1 = 79
1286432168421
01001101

Binary to denary: add up the columns that have a 1 in them. Here that is 64 + 8 + 4 + 1 = 77.

Denary to binary: work from the left and ask, "does this column fit?" Take 77. Does 128 fit? No: write 0. Does 64 fit? Yes: write 1, and you have 13 left. 32? No. 16? No. 8? Yes, leaving 5. 4? Yes, leaving 1. 2? No. 1? Yes. Answer: 01001101.

How big can it get? With all eight columns set to 1 you get 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. So 8 bits can store any whole number from 0 to 255. That is 256 different values, because 0 counts too.
In the exam You are asked to convert a denary number to 8-bit binary nearly every year, for 1 mark. Write all 8 digits, including the zeros at the front. 1001101 is not an 8-bit answer; 01001101 is.

Create an account