For after the lessons: one card per lesson, to check what you remember. Answer each question in your head or on paper first, then check it. Nothing here is marked.
Try firstThe number 66 is stored in memory. Give two different things it could mean.
Check your answer
Any two of: the letter B (as text), a dark grey (as a shade), a sound level below the middle (as audio), or the number 66 itself. Which one depends on the program's encoding.
A computer stores all data, whether text, pictures or sound, as numbers. The numbers alone don't say what they are. An encoding is the rule a program reads them with: as text, 72 is the letter H; as a grey shade (0 black to 255 white), 72 is dark grey; as sound (128 is silence), 72 is a level below the middle.
So the same numbers can be a word, a picture or a noise. The file type tells a program which rule to use.
72, 105, 33 read three ways: as text they spell Hi!, as grey shades they are three greys, as sound they are three levels below the middle line.One set of numbers, three meanings · Sound on for the voiceoverVoice: Open the lesson →
Text is stored as a list of numbers, one for each character. Each character has a code: capital A is 65 and the capitals count on to Z = 90; lower case a is 97 to z = 122 (each 32 more than its capital); a space is 32; even the digit 7 is a character, code 55.
Unicode gives codes to over a hundred thousand characters, including every script and emoji. Codes up to 255 fit in one byte; bigger ones take two to four bytes.
Hi 7! stored as text: H 72, i 105, a space 32, the digit 7 as 55, and ! 33. Every character has a code, even the space and the digit.Characters and their codes · Sound on for the voiceoverVoice: Open the lesson →
Try firstWhat colour is 0, 255, 0? How many numbers store a 3 × 2 image?
Check your answer
Green. 3 × 2 = 6 pixels × 3 = 18 numbers.
A screen picture is a grid of pixels. Each pixel is three numbers for red, green and blue light (RGB), each from 0 (off) to 255 (full). Light adds up, so red and green make yellow and all three make white. An image needs width × height × 3 numbers.
A vector picture stores shapes instead (a circle: centre, radius, colour), so it can be drawn sharp at any size.
A 4 by 4 image: each pixel is three numbers for red, green and blue. Yellow is 255, 255, 0 and blue is 0, 0, 255. 16 pixels × 3 = 48 numbers.Pixels are numbers · Sound on for the voiceoverVoice: Open the lesson →
Try firstWhy does a vector logo stay sharp on a banner when a bitmap logo doesn't?
Check your answer
The vector stores shapes as numbers and is drawn again at the new size; the bitmap only has its pixels, which get bigger.
A vector picture stores shapes, not pixels: a circle is its centre, its size and its colour.
The computer draws it again at any size, so it stays sharp.
It needs few numbers: the sun and hill are 13.
Photos suit bitmaps; logos, icons and fonts suit vectors.
3D models are numbers too: a list of corners (x, y, z) and the faces that join them.
The same picture two ways: as two shapes (13 numbers) and as a 32 by 32 bitmap (3,072 numbers).Zoom in on both · Sound on for the voiceoverVoice: Open the lesson →
Try firstA recording takes 8 000 samples a second for 5 seconds. How many samples? What happens to sound quality if you use 4 000 a second?
Check your answer
40 000 samples. Fewer samples: a rougher copy (and a smaller file).
A computer stores sound by sampling: it measures the height of the sound wave at regular times and rounds each measurement to one of a set of levels. A recording is the list of those numbers; playing it back rebuilds a stepped copy of the wave.
More samples each second and more levels make the copy closer to the real sound, but need more data. Music uses 44 100 samples a second.
A wave sampled 8 times each wave, each sample rounded to one of 8 levels. The dots are the stored numbers; the steps are what plays back.Sampling a wave · Sound on for the voiceoverVoice: Open the lesson →
Try firstWhat is 10101 in binary? Write 12 in binary.
Check your answer
10101 = 16 + 4 + 1 = 21. 12 = 8 + 4 = 1100.
A bit is one switch that is off (0) or on (1). In binary, bits sit side by side and each place is worth double the place on its right: 1, 2, 4, 8, 16. Add the places that hold a 1: 10110=16+4+2=22.
To write a number in binary, take the biggest place that fits, then the biggest that fits what is left, and so on. Computers use bits because two states (low or high voltage) are easy to tell apart reliably.
10110 in binary: the 16, 4 and 2 cards are face up, so the number is 16 + 4 + 2 = 22.Binary cards · Sound on for the voiceoverVoice: Open the lesson →
Try firstHow many patterns can 6 bits make, and what is the biggest number they can hold?
Check your answer
2⁶ = 64 patterns, so 0 to 63. The biggest is 63.
Each bit has two states, so each extra bit doubles the number of patterns: n bits make 2n patterns. One pattern is 0 (all bits off), so the biggest number is 2n−1. Four bits hold 0 to 15; eight bits, a byte, hold 0 to 255.
Counting one past the biggest number overflows: every bit flips back to 0, because there is no bit left for the carry.
Four cards all face up: 1111 = 8 + 4 + 2 + 1 = 15, the largest number four bits can hold. With 0, that is 16 patterns.Counting in binary · Sound on for the voiceoverVoice: Open the lesson →
Try firstFill in the output: 1 AND 1, 0 OR 1, NOT 0. Why are computers built on binary?
Check your answer
1, 1, 1. Switches have two reliable states, and gates combine them to do any calculation.
Inside a computer, each bit is a tiny electronic switch: off (0) or on (1). Two states are easy to tell apart reliably. Switches wired together make logic gates: AND gives 1 only when both inputs are 1 (switches in a line); OR gives 1 when at least one input is 1 (switches side by side); NOT flips one input.
Gates combined can add bits (1 + 1 = 10 in binary), compare and store them, which is why every computer is built on binary.
Two switches side by side (OR): the lamp lights when A or B is on, or both.Two switches in a line: AND · Sound on for the voiceoverVoice: Open the lesson →
Try firstWrite the letter C as a byte. How many bits is the word Hi?
Check your answer
C = 67 = 64 + 2 + 1 = 01000011. Hi = 2 bytes = 16 bits.
Every kind of data follows the same chain: data → numbers → bits. A character becomes its code (A = 65), and the code becomes 8 bits, one byte (01000001). A pixel is three colour amounts, so three bytes (24 bits). A sound sample is one or two bytes.
So everything a computer stores, a word, a photo or a song, is a long list of 0s and 1s, and the encoding says what they mean.
The letter A: code 65, which on 8 bits (one byte) is 01000001: the 64 card and the 1 card.A, 65, 01000001 · Sound on for the voiceoverVoice: Open the lesson →