Answer key · Unit 1
Bits and data.
Each lesson’s practice questions, their correct answers and the mistakes they spot. Answers read off the Scene use the same setting the learner sees.
Answer key 4
Lesson 1 of 4 · About 20 minutes
Bits on switches
A switch that is a number: what a bit is, how many patterns two bits make, place value in base 2, and why 10 in base 2 is two.
The 5 steps and their answers
Practice · Calculate
Question
The board has two switches, A and B, and each can be set to 0 or 1. How many different patterns can the two switches make?
Correct answer
4 ± 0.01
Setup, choices and feedback
The Scene at this step
- Number
- 0fixed
- Three gates / Half adder
- Three gateshidden
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
3 ± 0.01
Misconception: Confuses the largest value with how many values there are, forgetting that counting starts at 0.
Feedback from the catalogue
A computer counts from . Two bits have four patterns, 00, 01, 10 and 11, and they are the numbers to : four numbers, the largest of which is . In general bits give values, the largest being . So a byte, 8 bits, holds 256 values, from to .
2 ± 0.01
Misconception: Thinks each extra bit adds a fixed number of values instead of doubling them (2 bits give 2, 8 bits give twice what 4 give).
Feedback from the catalogue
Each extra bit doubles the number of values: every pattern of the earlier bits appears once with a 0 in the new bit and once with a 1. So bits give values: 4 bits give 16, and 8 bits give not 32 but .
Feedback for a right answer
Four: 00, 01, 10 and 11. Each of A’s two settings goes with each of B’s two, , and they are the numbers to .
Hint
List them: A at 0 with each setting of B, then A at 1 with each setting of B.
Worked solution
- With A at 0, B has two settings: 00 and 01.
- With A at 1, two more: 10 and 11.
- In all, patterns.
If you answered , you counted up to the largest number and forgot . If you answered , you counted one setting per switch instead of combining them.
Practice · Predict, then look
Question
Number is at 0, and both switches are down. A is the 2s place and B the 1s place. How will the switches stand when the number is ?
Correct answer
Correct A = 1, B = 0
Setup, choices and feedback
The Scene at this step
- Number
- 0fixed
- Three gates / Half adder
- Three gateshidden
Choices
Correct A = 1, B = 0
Wrong A = 0, B = 1
Misconception: Gives the rightmost bit the largest place value, reading the number back to front.
Feedback from the catalogue
As in decimal numbers, the rightmost digit is the ones, and the place values grow to its left. In base 2 the rightmost bit is worth , the next , then , and so on. On the board’s switches A is the 2s place and B the 1s place, so the number is A = 1, B = 0. Read backwards, turns into .
Wrong A = 1, B = 1, since two needs two switches
Misconception: Takes the value of a binary number to be the number of 1s in it.
Feedback from the catalogue
Each 1 adds its place value, not . has three 1s, but they stand in the places of , and , so the value is . And , with a single 1, is , because that 1 stands in the 2s place.
Once the prediction is locked in, the Scene changes
- Number
- 2fixed
A prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
, so A, the 2s place, goes up and B stays down: . It reads “one zero”, and in base 2 it is two.
Worked solution
- The place values: A is worth and B is worth .
- To make you need the 2 and not the 1: .
- So A = 1, B = 0, that is .
A = 0, B = 1 is : what you get by reading the bits from the end. A = 1, B = 1 is .
Practice · Reach the target
Question
Move Number until both switches are up, the bits 11, and press Check. Which number is it?
Goal
1 ± 0.01
At the start of the step: 0
1 ± 0.01
At the start of the step: 0
Setup, choices and feedback
The Scene at this step
- Number
- 0
- Three gates / Half adder
- Three gateshidden
- Read from the Scene at
- Logic: input bit A, the 2s place of inputs
/nodes/board/outputs/bitA - Read from the Scene at
- Logic: input bit B, the 1s place of inputs
/nodes/board/outputs/bitB
One setting that reaches it
- Number
- 3
Feedback for a right answer
: the largest number two bits can hold. To reach you need a third bit, in the 4s place.
Feedback for a wrong answer
Not yet. While either switch is down, raise Number.
Hint
A is worth and B is worth . What do they add up to when both are on?
Worked solution
- With both switches up, A adds and B adds .
- .
- Move Number to 3.
It is not eleven: 11 in base 2 is three.
Practice · Calculate
Question
Add two more switches on the left, in the 4s and 8s places. The four switches show 1011. Which decimal number is that?
Correct answer
11 ± 0.01
Setup, choices and feedback
The Scene at this step
- Number
- 3
- Three gates / Half adder
- Three gateshidden
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
1011 ± 0.01
Misconception: Reads a binary numeral as if it were decimal: takes 10 in binary to be ten.
Feedback from the catalogue
The digits 0 and 1 are the same digits, but the place values differ. In base ten each place is worth 10 times the one to its right; in base 2 only twice: from right to left So is , not ten, and is . When in doubt, write the base as a subscript.
13 ± 0.01
Misconception: Gives the rightmost bit the largest place value, reading the number back to front.
Feedback from the catalogue
As in decimal numbers, the rightmost digit is the ones, and the place values grow to its left. In base 2 the rightmost bit is worth , the next , then , and so on. On the board’s switches A is the 2s place and B the 1s place, so the number is A = 1, B = 0. Read backwards, turns into .
3 ± 0.01
Misconception: Takes the value of a binary number to be the number of 1s in it.
Feedback from the catalogue
Each 1 adds its place value, not . has three 1s, but they stand in the places of , and , so the value is . And , with a single 1, is , because that 1 stands in the 2s place.
Feedback for a right answer
.
Hint
The place values from left to right: . Add the ones with a 1 above them.
Worked solution
- The place values of four bits, from left to right: .
- The bits take the , not the , and the and the .
- .
If you got , you read the bits from the end. If you got , you counted the 1s instead of adding their place values.
Practice · Calculate
Question
What is the largest number four bits can hold?
Correct answer
15 ± 0.01
Setup, choices and feedback
The Scene at this step
- Number
- 3
- Three gates / Half adder
- Three gateshidden
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
16 ± 0.01
Misconception: Confuses the largest value with how many values there are, forgetting that counting starts at 0.
Feedback from the catalogue
A computer counts from . Two bits have four patterns, 00, 01, 10 and 11, and they are the numbers to : four numbers, the largest of which is . In general bits give values, the largest being . So a byte, 8 bits, holds 256 values, from to .
8 ± 0.01
Misconception: Thinks each extra bit adds a fixed number of values instead of doubling them (2 bits give 2, 8 bits give twice what 4 give).
Feedback from the catalogue
Each extra bit doubles the number of values: every pattern of the earlier bits appears once with a 0 in the new bit and once with a 1. So bits give values: 4 bits give 16, and 8 bits give not 32 but .
Feedback for a right answer
. Four bits give values, to , and the largest is one less than , the worth of the next bit.
Hint
Turn all four bits on.
Worked solution
- The largest is with every bit on: .
- .
- Check: values, from to .
If you answered , you counted how many values there are, not the largest of them.
Lesson 2 of 4 · About 30 minutes
Counting in base 2
How many values fit in so many bits, why each bit doubles them, the byte and 255, and converting between base 2 and base ten both ways.
The 7 steps and their answers
Practice · Predict, then look
Question
Each of a pixel’s three colour channels, red, green and blue, is stored here in 3 bits. How many different levels can one channel take?
Correct answer
8 ± 0.01
A number prediction counts as right within ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 3 bitfixed
- Picture / Red, green, blue
- Picturefixed
Once the prediction is locked in, the Scene changes
- Picture / Red, green, blue
- Red, green, bluefixed
The Scene then shows: 8 · Levels each channel can take, 2^bits
/nodes/picture/outputs/levelsA prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
levels, from to , that is to . Look inside shows the red, green and blue columns beside a ruler of eight levels.
Worked solution
- Each bit doubles the number of patterns: .
- .
- The levels are to .
The board also shows 512 colours: that is , the combinations of the three channels.
Practice · Predict, then look
Question
At four bits per channel there are 16 levels. How many will there be when the bits double to 8?
Correct answer
Correct 256
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 4 bitfixed
- Picture / Red, green, blue
- Picturefixed
Choices
Wrong 32, twice as many
Misconception: Thinks each extra bit adds a fixed number of values instead of doubling them (2 bits give 2, 8 bits give twice what 4 give).
Feedback from the catalogue
Each extra bit doubles the number of values: every pattern of the earlier bits appears once with a 0 in the new bit and once with a 1. So bits give values: 4 bits give 16, and 8 bits give not 32 but .
Wrong 64
Feedback
: that is what six bits give. Each of the four extra bits doubles.
Correct 256
Once the prediction is locked in, the Scene changes
- Bits per channel
- 8 bitfixed
- Picture / Red, green, blue
- Red, green, bluefixed
The Scene then shows: 256 · Levels each channel can take, 2^bits
/nodes/picture/outputs/levelsA prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
. The four extra bits double it four times: . The bands in the sky disappear.
Worked solution
- 4 bits: levels.
- Each extra bit doubles: four more bits are .
- .
Doubling the bits does not double the levels; it squares them.
Practice · Reach the target
Question
Change Bits per channel so that each channel has exactly 64 levels, and press Check.
Goal
64 ± 0.01
At the start of the step: 8
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 3 bit
- Picture / Red, green, blue
- Red, green, blue
- Read from the Scene at
- Levels each channel can take, 2^bits
/nodes/picture/outputs/levels
One setting that reaches it
- Pixels across
- 16 px
- Bits per channel
- 6 bit
Feedback for a right answer
Six bits: , levels to .
Feedback for a wrong answer
Not yet. Each bit doubles the levels: count the doublings from to .
Hint
How many times must you multiply 2 by itself to reach ?
Worked solution
- : six doublings.
- So , that is 6 bits.
- Set Bits per channel to 6.
Practice · Calculate
Question
In true colour each channel is a byte, 8 bits. What is the largest value such a channel stores, the brightest red?
Correct answer
255 ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bitfixed
- Picture / Red, green, blue
- Red, green, blue
- Accepted within
- ± 0.01
- Computed from the Scene at this step’s setting
- The largest value a channel stores, 2^bits − 1 (255 for 8 bits)
/nodes/picture/outputs/maxLevel
Wrong answers it recognises
256 ± 0.01
Misconception: Confuses the largest value with how many values there are, forgetting that counting starts at 0.
Feedback from the catalogue
A computer counts from . Two bits have four patterns, 00, 01, 10 and 11, and they are the numbers to : four numbers, the largest of which is . In general bits give values, the largest being . So a byte, 8 bits, holds 256 values, from to .
Feedback for a right answer
. A byte has values, to , which is why colour codes go up to 255 and not 256.
Hint
How many values are there, and does the count start at or at ?
Worked solution
- 8 bits give values.
- They start at , so the largest is .
- Check: .
Practice · Calculate
Question
A pixel’s red channel is stored as the byte . What is it in base ten?
Correct answer
200 ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Red, green, blue
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
19 ± 0.01
Misconception: Gives the rightmost bit the largest place value, reading the number back to front.
Feedback from the catalogue
As in decimal numbers, the rightmost digit is the ones, and the place values grow to its left. In base 2 the rightmost bit is worth , the next , then , and so on. On the board’s switches A is the 2s place and B the 1s place, so the number is A = 1, B = 0. Read backwards, turns into .
3 ± 0.01
Misconception: Takes the value of a binary number to be the number of 1s in it.
Feedback from the catalogue
Each 1 adds its place value, not . has three 1s, but they stand in the places of , and , so the value is . And , with a single 1, is , because that 1 stands in the 2s place.
11000000 ± 0.01
Misconception: Reads a binary numeral as if it were decimal: takes 10 in binary to be ten.
Feedback from the catalogue
The digits 0 and 1 are the same digits, but the place values differ. In base ten each place is worth 10 times the one to its right; in base 2 only twice: from right to left So is , not ten, and is . When in doubt, write the base as a subscript.
Feedback for a right answer
: a strong red, near the brightest, 255.
Hint
The place values of a byte, from left to right: .
Worked solution
- Write the place values over the bits: over .
- The 1s stand under , and .
- .
If you got , you read the byte from the end ().
Practice · Choose
Question
Which byte stores the number ?
Correct answer
Correct
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Red, green, blue
Choices
Shown in a random order.
Correct
Wrong
Misconception: Gives the rightmost bit the largest place value, reading the number back to front.
Feedback from the catalogue
As in decimal numbers, the rightmost digit is the ones, and the place values grow to its left. In base 2 the rightmost bit is worth , the next , then , and so on. On the board’s switches A is the 2s place and B the 1s place, so the number is A = 1, B = 0. Read backwards, turns into .
Wrong , the digits 1, 0, 0 at the end
Misconception: Reads a binary numeral as if it were decimal: takes 10 in binary to be ten.
Feedback from the catalogue
The digits 0 and 1 are the same digits, but the place values differ. In base ten each place is worth 10 times the one to its right; in base 2 only twice: from right to left So is , not ten, and is . When in doubt, write the base as a subscript.
Wrong
Feedback
. Start from the largest place that fits: , leaving .
Feedback for a right answer
, so there is a 1 in the 64s, 32s and 4s places: .
Hint
Take the largest place value that fits away from , then the next, until is left.
Worked solution
- is more than : bit 0.
- fits: bit 1, leaving .
- fits: 1, leaving .
- and do not fit: 0, 0. fits: 1, leaving . and : 0, 0.
- .
is : the digits of “a hundred” in base 2 are a different number.
Practice · Calculate
Question
You want to give each of 1000 people a different number of their own. How many bits does each number need, at least?
Correct answer
10 ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Picture
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
500 ± 0.01
Misconception: Thinks each extra bit adds a fixed number of values instead of doubling them (2 bits give 2, 8 bits give twice what 4 give).
Feedback from the catalogue
Each extra bit doubles the number of values: every pattern of the earlier bits appears once with a 0 in the new bit and once with a 1. So bits give values: 4 bits give 16, and 8 bits give not 32 but .
Feedback for a right answer
is too few, and is enough: 10 bits. It is also , rounded up.
Hint
Find the smallest power of 2 that is not less than .
Worked solution
- Each bit doubles: , , .
- .
- So you need 10 bits.
If you answered , you took each bit to add two values; it doubles all of them.
Lesson 3 of 4 · About 25 minutes
Colour and hexadecimal
A pixel is three numbers: how many colours so many levels give, bits per pixel, counting in base 16, web colour codes, and light that adds up.
The 6 steps and their answers
Practice · Calculate
Question
The board shows that at this depth a pixel can show 4096 colours. How many levels can each channel, red, green or blue, take?
Correct answer
16 ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 4 bitfixed
- Picture / Red, green, blue
- Picture
- Accepted within
- ± 0.01
- Computed from the Scene at this step’s setting
- Levels each channel can take, 2^bits
/nodes/picture/outputs/levels
Wrong answers it recognises
1365 ± 0.5
Misconception: Adds or divides the channels' levels instead of multiplying: takes the colours of a pixel to be 3 × the levels.
Feedback from the catalogue
A pixel’s colour is a combination of three levels: every level of red can go with every level of green and every level of blue. So the number of colours is a product, , not . At 8 bits per channel: colours, not 768. Going back from colours to levels takes a cube root, not a division by .
Feedback for a right answer
, so 16 levels, four bits per channel, and 12 bits per pixel in all.
Hint
The colours are red’s levels times green’s times blue’s. Which number cubed gives 4096?
Worked solution
- With levels per channel there are colours.
- , so .
- : four bits per channel.
If you divided by , you added the channels instead of multiplying them.
Practice · Reach the target
Question
Change Bits per channel so that a whole pixel, all three of its channels, takes exactly 12 bits, a byte and a half, and press Check.
Goal
12 ± 0.01
At the start of the step: 24
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Red, green, blue
- Read from the Scene at
- Bits a pixel takes, 3 channels × bits
/nodes/picture/outputs/bitsPerPixel
One setting that reaches it
- Pixels across
- 16 px
- Bits per channel
- 4 bit
Feedback for a right answer
Four bits for each of the three channels, : 16 levels per channel and 4096 colours.
Feedback for a wrong answer
Not yet. A pixel is three channels, and each takes the number of bits on the slider.
Worked solution
- A pixel is three channels: bits per pixel bits per channel.
- .
- Set Bits per channel to 4.
Practice · Calculate
Question
In base 16 the digits are 0 to 9 and then A to F, which are to . What is in base ten?
Correct answer
255 ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Red, green, blue
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
1515 ± 0.01
Feedback from the catalogue
In base 16 each digit is worth to (A to F are to ), and the left digit is worth 16 times the right one. So : not “15 15” and not . Likewise . Two hexadecimal digits are exactly one byte, to .
30 ± 0.01
Feedback from the catalogue
In base 16 each digit is worth to (A to F are to ), and the left digit is worth 16 times the right one. So : not “15 15” and not . Likewise . Two hexadecimal digits are exactly one byte, to .
Feedback for a right answer
, that is : a full byte. Each hexadecimal digit is exactly four bits, so two of them are a byte.
Hint
The left digit is the 16s place and the right one the 1s place.
Worked solution
- .
- The left digit is worth 16 times as much: .
- .
and forget that the left digit is worth sixteen times as much.
Practice · Choose
Question
Which colour is #FF8000?
Correct answer
Correct Orange: full red, half green, no blue
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Red, green, blue
Choices
Shown in a random order.
Correct Orange: full red, half green, no blue
Wrong Azure: full blue, half green, no red
Misconception: Reads a #RRGGBB colour code in the wrong order, as blue, green, red.
Feedback from the catalogue
In a web colour code the order is always red, green, blue: the first two digits after the # are red, the middle two green, and the last two blue. #FF8000 is full red, green 128 and no blue: orange. Read backwards it would be a light blue, .
Wrong Grey, since the values average out in the middle
Feedback
Grey is three equal channels, like #808080. Here the channels are very different.
Wrong Green
Feedback
80 is the green, in the middle, but the first FF is full red.
Feedback for a right answer
Red FF is , green 80 is , and blue 00 is . Red with half green looks orange.
Worked solution
- Split the code into three pairs: FF, 80, 00, in the order red, green, blue.
- , , .
- : full red and half green, orange.
Practice · Calculate
Question
In the colour code #3CB371 the two green digits are B3. How strong is the green, in base ten?
Correct answer
179 ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Red, green, blue
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
113 ± 0.01
Feedback from the catalogue
In base 16 each digit is worth to (A to F are to ), and the left digit is worth 16 times the right one. So : not “15 15” and not . Likewise . Two hexadecimal digits are exactly one byte, to .
14 ± 0.01
Feedback from the catalogue
In base 16 each digit is worth to (A to F are to ), and the left digit is worth 16 times the right one. So : not “15 15” and not . Likewise . Two hexadecimal digits are exactly one byte, to .
Feedback for a right answer
, out of 255. It is a medium sea green: red 60, green 179, blue 113.
Hint
, and it stands in the 16s place.
Worked solution
- and .
- .
- .
is “11” and “3” side by side, and is the digits added.
Practice · Choose
Question
A pixel stores red 255, green 255 and blue 0. Which colour do you see on the screen?
Correct answer
Correct Yellow
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Red, green, blue
Choices
Shown in a random order.
Correct Yellow
Wrong Brown, as when you mix red and green paint
Misconception: Mixes coloured light as if it were paint: expects red and green light to make brown.
Feedback from the catalogue
Paint absorbs light, so mixing paints darkens. A screen gives out light: when red and green are lit together the eye receives both and sees yellow, brighter than either. All three at full give white, and all three off give black. This is additive mixing, and it is how a pixel of three small lights shows any colour.
Wrong White
Feedback
White needs all three lights at full; here the blue is off.
Feedback for a right answer
Red and green light together look yellow: a screen adds light, it does not mix paint. Add full blue and you get white.
Worked solution
- Two lights are fully on, red and green, and blue is off.
- On a screen the lights add up: the eye receives both.
- Red and green together look yellow.
Paint absorbs light, so mixing it darkens; added light brightens.
Lesson 4 of 4 · About 25 minutes
Images and text as numbers
The size of a picture: resolution, colour depth and bytes, and why doubling the width makes the file four times bigger; and text as numbers, from ASCII to Hebrew letters in UTF-8.
The 6 steps and their answers
Practice · Predict, then look
Question
The picture is 32 pixels across. When Pixels across doubles to 64, how many times bigger will the uncompressed file be?
Correct answer
Correct 4 times
Setup, choices and feedback
The Scene at this step
- Pixels across
- 32 pxfixed
- Bits per channel
- 8 bitfixed
- Picture / Red, green, blue
- Picture
Choices
Wrong 2 times
Misconception: Thinks doubling the pixels across doubles the picture's pixels and its size, forgetting that the height doubles too.
Feedback from the catalogue
The picture keeps its shape, 4 : 3: when you double the pixels across, the pixels down double as well. The number of pixels is width times height, so it grows times, and so does the file. It is the same sum as for an area: a square with twice the side is four times as big.
Correct 4 times
Wrong 8 times
Feedback
The width and the height double, but the depth, the bits per channel, stays the same: .
Once the prediction is locked in, the Scene changes
- Pixels across
- 64 pxfixed
The Scene then shows: 9216 · Uncompressed size in bytes: pixels × 3 channels × bits ÷ 8
/nodes/picture/outputs/bytesA prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
pixels become , four times as many, and the file grows from 2304 bytes to 9216.
Worked solution
- The picture keeps its 4 : 3 shape, so the height doubles with the width: from to .
- Pixels: before, after, 4 times as many.
- Each pixel takes the same three bytes, so the file grows 4 times too.
Practice · Calculate
Question
The picture is pixels, at 8 bits per channel, and the board rounds its size to kilobytes. Exactly how many bytes does it take uncompressed?
Correct answer
9216 ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 pxfixed
- Bits per channel
- 8 bitfixed
- Picture / Red, green, blue
- Picture
- Accepted within
- ± 0.01
- Computed from the Scene at this step’s setting
- Uncompressed size in bytes: pixels × 3 channels × bits ÷ 8
/nodes/picture/outputs/bytes
Wrong answers it recognises
3072 ± 0.01
Misconception: Stores one number per pixel, forgetting its three channels.
Feedback from the catalogue
A colour pixel is three numbers: red, green and blue. In true colour each of them is a byte, so a pixel takes three bytes, 24 bits. The uncompressed size of a picture is the number of pixels times times the bits per channel, divided by .
73730 ± 0.01
Misconception: Mixes up bits and bytes: gives a size in bits as bytes, off by a factor of 8.
Feedback from the catalogue
A byte is eight bits. File sizes are measured in bytes (B, kB, MB), and network speeds usually in bits per second (Mbit/s). To go from bits to bytes, divide by ; from bytes to bits, multiply by . An answer eight times too big is nearly always a count of bits.
Feedback for a right answer
pixels, bytes, about 9.2 kB. A phone photo, pixels, would take 36 MB this way, which is why photos are stored compressed.
Hint
Pixels, times three channels, times a byte per channel.
Worked solution
- Pixels: .
- Each pixel is three channels of a byte: 3 bytes.
- bytes.
forgets the three channels, and is the size in bits.
Practice · Reach the target
Question
You need a small icon that takes exactly 576 bytes, at 2 bits per channel. Change Pixels across and Bits per channel until it does, and press Check.
Goal
576 ± 0.01
At the start of the step: 9216
6 ± 0.01
At the start of the step: 24
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Picture
- Read from the Scene at
- Uncompressed size in bytes: pixels × 3 channels × bits ÷ 8
/nodes/picture/outputs/bytes - Read from the Scene at
- Bits a pixel takes, 3 channels × bits
/nodes/picture/outputs/bitsPerPixel
One setting that reaches it
- Pixels across
- 32 px
- Bits per channel
- 2 bit
Feedback for a right answer
pixels, times 6 bits, is 4608 bits, that is 576 bytes. The same size also fits in true colour: fewer pixels and more colours.
Feedback for a wrong answer
Not yet. Set 2 bits per channel first, then find the width.
Hint
At 2 bits per channel a pixel takes 6 bits. How many pixels fit in bits?
Worked solution
- 576 bytes are bits.
- At 2 bits per channel a pixel takes bits, so there are pixels.
- At 4 : 3: .
- Set Pixels across to 32 and Bits per channel to 2.
Practice · Calculate
Question
In ASCII each character is a number, and the capital letters come in order: A is , B is . Which number stores the letter D?
Correct answer
68 ± 0.01
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Picture
- Accepted within
- ± 0.01
- A fixed value in the question
Feedback for a right answer
. The computer stores no shape for the letter, only its number; the font draws it on the screen.
Worked solution
- A, B, C, D: D is three letters after A.
- .
Practice · Choose
Question
How many bytes does the word HELLO take in ASCII?
Correct answer
Correct 5
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Picture
Choices
Shown in a random order.
Correct 5
Wrong 40
Misconception: Mixes up bits and bytes: gives a size in bits as bytes, off by a factor of 8.
Feedback from the catalogue
A byte is eight bits. File sizes are measured in bytes (B, kB, MB), and network speeds usually in bits per second (Mbit/s). To go from bits to bytes, divide by ; from bytes to bits, multiply by . An answer eight times too big is nearly always a count of bits.
Wrong 1, one word
Feedback
The computer does not know what a word is; it stores each character separately, the second L too.
Feedback for a right answer
Five characters, a byte each: . That is 40 bits in all.
Worked solution
- In ASCII each character takes one byte.
- HELLO has five characters.
- bytes, which are bits.
Practice · Choose
Question
In UTF-8, the encoding of most of the web, how many bytes does the Hebrew word שלום (four letters) take?
Correct answer
Correct 8
Setup, choices and feedback
The Scene at this step
- Pixels across
- 64 px
- Bits per channel
- 8 bit
- Picture / Red, green, blue
- Picture
Choices
Shown in a random order.
Correct 8
Wrong 4, a byte per letter
Misconception: Assumes every character takes one byte, as in ASCII, including Hebrew letters.
Feedback from the catalogue
ASCII has only 128 characters, Latin letters, digits and signs, and each fits in a byte. To write every language, Unicode gives a number to every character in the world, more than a hundred thousand, and that no longer fits in one byte. In the UTF-8 encoding a Latin character is still one byte, a Hebrew letter is two bytes, and an emoji is four.
Wrong 64
Misconception: Mixes up bits and bytes: gives a size in bits as bytes, off by a factor of 8.
Feedback from the catalogue
A byte is eight bits. File sizes are measured in bytes (B, kB, MB), and network speeds usually in bits per second (Mbit/s). To go from bits to bytes, divide by ; from bytes to bits, multiply by . An answer eight times too big is nearly always a count of bits.
Feedback for a right answer
Each Hebrew letter in UTF-8 is two bytes, so four letters are 8 bytes. ש is character number 1513 in Unicode, too big to fit in one byte.
Worked solution
- One byte has only values, and Unicode needs a number for every character in every language.
- In UTF-8 a Latin character is one byte, and a Hebrew letter two.
- שלום is four letters: bytes.
is the size in bits.
Across the unit · 13 misconceptions
Misconception catalogue
Each common mistake this unit recognises, in a few words. Open one for what the learner reads when an answer matches it, and where it is asked.
Confuses the largest value with how many values there are, forgetting that counting starts at 0.
- The learner reads
A computer counts from . Two bits have four patterns, 00, 01, 10 and 11, and they are the numbers to : four numbers, the largest of which is . In general bits give values, the largest being . So a byte, 8 bits, holds 256 values, from to .
Thinks each extra bit adds a fixed number of values instead of doubling them (2 bits give 2, 8 bits give twice what 4 give).
- The learner reads
Each extra bit doubles the number of values: every pattern of the earlier bits appears once with a 0 in the new bit and once with a 1. So bits give values: 4 bits give 16, and 8 bits give not 32 but .
Reads a binary numeral as if it were decimal: takes 10 in binary to be ten.
- The learner reads
The digits 0 and 1 are the same digits, but the place values differ. In base ten each place is worth 10 times the one to its right; in base 2 only twice: from right to left So is , not ten, and is . When in doubt, write the base as a subscript.
Gives the rightmost bit the largest place value, reading the number back to front.
- The learner reads
As in decimal numbers, the rightmost digit is the ones, and the place values grow to its left. In base 2 the rightmost bit is worth , the next , then , and so on. On the board’s switches A is the 2s place and B the 1s place, so the number is A = 1, B = 0. Read backwards, turns into .
Takes the value of a binary number to be the number of 1s in it.
- The learner reads
Each 1 adds its place value, not . has three 1s, but they stand in the places of , and , so the value is . And , with a single 1, is , because that 1 stands in the 2s place.
Adds or divides the channels' levels instead of multiplying: takes the colours of a pixel to be 3 × the levels.
- The learner reads
A pixel’s colour is a combination of three levels: every level of red can go with every level of green and every level of blue. So the number of colours is a product, , not . At 8 bits per channel: colours, not 768. Going back from colours to levels takes a cube root, not a division by .
- Recognised in
Reads each hexadecimal digit as a decimal number and writes them side by side, or adds them, ignoring that the left digit is worth 16 times as much.
- The learner reads
In base 16 each digit is worth to (A to F are to ), and the left digit is worth 16 times the right one. So : not “15 15” and not . Likewise . Two hexadecimal digits are exactly one byte, to .
Reads a #RRGGBB colour code in the wrong order, as blue, green, red.
- The learner reads
In a web colour code the order is always red, green, blue: the first two digits after the # are red, the middle two green, and the last two blue. #FF8000 is full red, green 128 and no blue: orange. Read backwards it would be a light blue, .
- Recognised in
Mixes coloured light as if it were paint: expects red and green light to make brown.
- The learner reads
Paint absorbs light, so mixing paints darkens. A screen gives out light: when red and green are lit together the eye receives both and sees yellow, brighter than either. All three at full give white, and all three off give black. This is additive mixing, and it is how a pixel of three small lights shows any colour.
- Recognised in
Thinks doubling the pixels across doubles the picture's pixels and its size, forgetting that the height doubles too.
- The learner reads
The picture keeps its shape, 4 : 3: when you double the pixels across, the pixels down double as well. The number of pixels is width times height, so it grows times, and so does the file. It is the same sum as for an area: a square with twice the side is four times as big.
- Recognised in
Stores one number per pixel, forgetting its three channels.
- The learner reads
A colour pixel is three numbers: red, green and blue. In true colour each of them is a byte, so a pixel takes three bytes, 24 bits. The uncompressed size of a picture is the number of pixels times times the bits per channel, divided by .
- Recognised in
Mixes up bits and bytes: gives a size in bits as bytes, off by a factor of 8.
- The learner reads
A byte is eight bits. File sizes are measured in bytes (B, kB, MB), and network speeds usually in bits per second (Mbit/s). To go from bits to bytes, divide by ; from bytes to bits, multiply by . An answer eight times too big is nearly always a count of bits.
Assumes every character takes one byte, as in ASCII, including Hebrew letters.
- The learner reads
ASCII has only 128 characters, Latin letters, digits and signs, and each fits in a byte. To write every language, Unicode gives a number to every character in the world, more than a hundred thousand, and that no longer fits in one byte. In the UTF-8 encoding a Latin character is still one byte, a Hebrew letter is two bytes, and an emoji is four.
- Recognised in