Answer key · Unit 2
Logic gates.
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
AND, OR and NOT
The three basic gates: AND needs both inputs, OR settles for one, NOT flips; and how to choose a gate for what a circuit has to do.
The 5 steps and their answers
Practice · Predict, then look
Question
Both switches are down, and the AND and OR lights are dark. What will happen to the A AND B light when A goes up to 1 and B stays down?
Correct answer
Correct It stays dark
Setup, choices and feedback
The Scene at this step
- Input bits
- 0fixed
- Three gates / Half adder
- Three gateshidden
Choices
Correct It stays dark
Wrong It lights, because A is on
Misconception: Thinks AND outputs 1 when either input is 1.
Feedback from the catalogue
AND gives only when both inputs are , like a door that opens only with a card and a code. A single 0 at an input is enough to make the output 0. The gate that gives 1 when at least one input is 1 is OR.
Once the prediction is locked in, the Scene changes
- Input bits
- 2fixed
The Scene then shows: 0 · Logic: A AND B, the first LED (and the carry)
/nodes/board/outputs/andOutA prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
1 AND 0 is 0: AND needs both inputs. The OR light, though, has come on: one is enough for it.
Worked solution
- AND gives 1 only when both inputs are 1.
- After the change A = 1 and B = 0.
- One input is 0, so 1 AND 0 = 0: the light stays dark.
Practice · Predict, then look
Question
A is up and B is down, and the A OR B light is on. What will happen to it when B goes up as well?
Correct answer
Correct It stays on
Setup, choices and feedback
The Scene at this step
- Input bits
- 2fixed
- Three gates / Half adder
- Three gateshidden
Choices
Correct It stays on
Wrong It goes off, since OR means one of the two, not both
Misconception: Takes OR to be 0 when both inputs are 1, as the everyday "or" (one or the other, not both).
Feedback from the catalogue
In everyday speech “or” sometimes means “one of the two, not both”: tea or coffee. A logic gate’s OR includes both: it gives 1 when at least one input is 1, so 1 OR 1 is 1. The gate that gives 0 when both inputs are on is XOR, “exclusive or”.
Once the prediction is locked in, the Scene changes
- Input bits
- 3fixed
The Scene then shows: 1 · Logic: A OR B, the second LED
/nodes/board/outputs/orOutA prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
1 OR 1 is 1: OR gives 1 when at least one input is 1, and two is at least one. Now the AND light is on too.
Worked solution
- OR gives 0 only when both inputs are 0.
- After the change A = 1 and B = 1.
- At least one input is 1, so 1 OR 1 = 1.
The everyday “or”, only one of the two, is another gate: XOR.
Practice · Reach the target
Question
The NOT A light is on. Change Input bits until it goes dark, and press Check.
Goal
0 ± 0.01
At the start of the step: 1
Setup, choices and feedback
The Scene at this step
- Input bits
- 0
- Three gates / Half adder
- Three gateshidden
- Read from the Scene at
- Logic: NOT A, the third LED
/nodes/board/outputs/notOut
One setting that reaches it
- Input bits
- 2
Feedback for a right answer
NOT flips A: with A = 1 the output is 0. B makes no difference to it: it is not connected at all.
Feedback for a wrong answer
Not yet. NOT is on while A is down; raise A.
Hint
NOT has one input, A. What does it do to it?
Worked solution
- NOT A is the opposite of A.
- For the output to be 0, A must be 1.
- Choose 1 0 or 1 1: B makes no difference.
Practice · Reach the target
Question
Light the A AND B light, and press Check.
Goal
1 ± 0.01
At the start of the step: 0
Setup, choices and feedback
The Scene at this step
- Input bits
- 1
- Three gates / Half adder
- Three gateshidden
- Read from the Scene at
- Logic: A AND B, the first LED (and the carry)
/nodes/board/outputs/andOut
One setting that reaches it
- Input bits
- 3
Feedback for a right answer
Only 1 1 lights AND: it is the one row of its table with a 1. Notice that in the same state NOT A is dark.
Feedback for a wrong answer
Not yet. AND needs both inputs up.
Worked solution
- AND gives 1 only when A = 1 and B = 1.
- Choose 1 1.
Practice · Choose
Question
An alarm should ring if the window opens, if the door opens, or if both do. Each sensor gives 1 when what it guards is open. Which gate joins the two sensors to the alarm?
Correct answer
Correct OR
Setup, choices and feedback
The Scene at this step
- Input bits
- 0
- Three gates / Half adder
- Three gateshidden
Choices
Shown in a random order.
Correct OR
Wrong AND
Misconception: Mixes up AND and OR.
Feedback from the catalogue
AND is strict: it needs every input at 1. OR is lenient: one is enough. In a two-input truth table AND gives 1 on only one row, 11, and OR gives 0 on only one row, 00. The symbols help: the AND gate has a flat back, and OR a curved back and a pointed nose.
Wrong XOR
Misconception: Takes OR to be 0 when both inputs are 1, as the everyday "or" (one or the other, not both).
Feedback from the catalogue
In everyday speech “or” sometimes means “one of the two, not both”: tea or coffee. A logic gate’s OR includes both: it gives 1 when at least one input is 1, so 1 OR 1 is 1. The gate that gives 0 when both inputs are on is XOR, “exclusive or”.
Wrong NOT
Feedback
NOT has only one input, and here two must be combined.
Feedback for a right answer
OR: one sensor at 1 is enough to ring the alarm, and it rings when both are open too. AND would ring only when both are open, and XOR would go quiet exactly then.
Worked solution
- Write the table: alarm on 01, 10 and 11, silence only on 00.
- That is exactly the table of OR.
XOR gives 0 on the row 11: a burglar who opened both the window and the door would not set it off.
Lesson 2 of 4 · About 25 minutes
Truth tables
A table that describes a gate completely: a row for every combination of inputs, the columns of AND, OR and XOR, gates built from gates, and how many different gates there are at all.
The 6 steps and their answers
Practice · Calculate
Question
A truth table has a row for every combination of the inputs. How many rows does the truth table of a gate with three inputs have?
Correct answer
8 ± 0.01
Setup, choices and feedback
The Scene at this step
- Input bits
- 0
- Three gates / Half adder
- Three gateshidden
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
6 ± 0.01
Misconception: Thinks each extra input adds two rows to a truth table instead of doubling them.
Feedback from the catalogue
Each extra input doubles the number of rows: every old row appears once with 0 in the new input and once with 1. So inputs have rows: two inputs 4, three 8, four 16. They are exactly all the binary numbers of bits.
3 ± 0.01
Misconception: Thinks each extra input adds two rows to a truth table instead of doubling them.
Feedback from the catalogue
Each extra input doubles the number of rows: every old row appears once with 0 in the new input and once with 1. So inputs have rows: two inputs 4, three 8, four 16. They are exactly all the binary numbers of bits.
Feedback for a right answer
: the rows 000 to 111, the numbers to in base 2.
Hint
On the board, two inputs have four rows. What does a third input do?
Worked solution
- Each input has two values, 0 or 1.
- Three inputs: combinations.
- The rows are .
Practice · Choose
Question
A truth table lists the rows in the order 00, 01, 10, 11 (A then B). What is the column of A OR B, from top to bottom? Step through the four Input bits and check.
Correct answer
Correct 0, 1, 1, 1
Setup, choices and feedback
The Scene at this step
- Input bits
- 0
- Three gates / Half adder
- Three gateshidden
Choices
Shown in a random order.
Correct 0, 1, 1, 1
Wrong 0, 0, 0, 1
Misconception: Mixes up AND and OR.
Feedback from the catalogue
AND is strict: it needs every input at 1. OR is lenient: one is enough. In a two-input truth table AND gives 1 on only one row, 11, and OR gives 0 on only one row, 00. The symbols help: the AND gate has a flat back, and OR a curved back and a pointed nose.
Wrong 0, 1, 1, 0
Misconception: Takes OR to be 0 when both inputs are 1, as the everyday "or" (one or the other, not both).
Feedback from the catalogue
In everyday speech “or” sometimes means “one of the two, not both”: tea or coffee. A logic gate’s OR includes both: it gives 1 when at least one input is 1, so 1 OR 1 is 1. The gate that gives 0 when both inputs are on is XOR, “exclusive or”.
Wrong 1, 0, 0, 0
Feedback
That is the column of NOR, the opposite of OR: 1 only when both inputs are 0.
Feedback for a right answer
OR is 0 only on the row 00, and 1 on the other three.
Worked solution
- 00: no input at 1, so 0.
- 01 and 10: one input at 1, so 1.
- 11: both, so 1.
- The column: 0, 1, 1, 1.
0, 0, 0, 1 is the column of AND, and 0, 1, 1, 0 that of XOR.
Practice · Reach the target
Question
Find inputs at which the A OR B light is on and the A AND B light is dark, and press Check.
Goal
1 ± 0.01
At the start of the step: 0
0 ± 0.01
At the start of the step: 0
Setup, choices and feedback
The Scene at this step
- Input bits
- 0
- Three gates / Half adder
- Three gateshidden
- Read from the Scene at
- Logic: A OR B, the second LED
/nodes/board/outputs/orOut - Read from the Scene at
- Logic: A AND B, the first LED (and the carry)
/nodes/board/outputs/andOut
One setting that reaches it
- Input bits
- 1
Feedback for a right answer
Both 0 1 and 1 0 work: exactly one input is on. “OR but not AND” is XOR, the gate the next Lesson builds an adder from.
Feedback for a wrong answer
Not yet. OR needs at least one input up, and AND needs them not both up.
Worked solution
- OR is on at 01, 10, 11.
- AND is dark at 00, 01, 10.
- Both hold at 01 and 10: choose either.
Practice · Choose
Question
XOR, “exclusive or”, gives 1 when exactly one input is 1. What is its column in the order 00, 01, 10, 11?
Correct answer
Correct 0, 1, 1, 0
Setup, choices and feedback
The Scene at this step
- Input bits
- 0
- Three gates / Half adder
- Three gateshidden
Choices
Shown in a random order.
Correct 0, 1, 1, 0
Wrong 0, 1, 1, 1
Feedback
That is the column of OR. XOR differs from it exactly on the row 11.
Wrong 1, 0, 0, 1
Feedback
That is the column of XNOR, “equal”: 1 when the two inputs match.
Feedback for a right answer
0, 1, 1, 0: XOR asks whether the inputs differ. And if you see the two inputs as two one-bit numbers, it is exactly the right-hand digit of their sum.
Worked solution
- 00 and 11: none or both on, not exactly one: 0.
- 01 and 10: exactly one: 1.
- The column: 0, 1, 1, 0.
Practice · Choose
Question
The expression is built from the board’s three kinds of gate. At which inputs is it 1? Mark them all.
Correct answer
Correct 0 1
Correct 1 0
Setup, choices and feedback
The Scene at this step
- Input bits
- 0
- Three gates / Half adder
- Three gateshidden
Choices
Shown in a random order. More than one choice is correct: every one must be selected.
Wrong 0 0
No feedback of its own; the learner sees the standard message
Not yet. Look again and try once more.
Correct 0 1
Correct 1 0
Wrong 1 1
Misconception: Takes OR to be 0 when both inputs are 1, as the everyday "or" (one or the other, not both).
Feedback from the catalogue
In everyday speech “or” sometimes means “one of the two, not both”: tea or coffee. A logic gate’s OR includes both: it gives 1 when at least one input is 1, so 1 OR 1 is 1. The gate that gives 0 when both inputs are on is XOR, “exclusive or”.
Feedback for a right answer
Only 01 and 10. It is the table of XOR, built from AND, OR and NOT alone: with those three you can build any gate.
Hint
Work each row in stages: first OR, then AND, then NOT, and finally the AND joining them.
Worked solution
- 00: OR is 0, so the whole thing is 0.
- 01, 10: OR is 1, AND is 0, its NOT is 1, and 1 AND 1 = 1.
- 11: OR is 1, but AND is 1 and its NOT is 0, so 1 AND 0 = 0.
Practice · Calculate
Question
A two-input gate is decided entirely by its output column in the truth table. How many different two-input gates can be defined?
Correct answer
16 ± 0.01
Setup, choices and feedback
The Scene at this step
- Input bits
- 0
- Three gates / Half adder
- Three gateshidden
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
4 ± 0.01
Misconception: Confuses the number of rows in a truth table with the number of different tables, that is of different gates.
Feedback from the catalogue
A gate with two inputs has 4 rows, and a gate is decided by what it writes on each of them: 0 or 1. Four rows, with two choices on each, give different tables, that is 16 different two-input gates. AND, OR and XOR are three of them.
8 ± 0.01
Misconception: Thinks each extra input adds two rows to a truth table instead of doubling them.
Feedback from the catalogue
Each extra input doubles the number of rows: every old row appears once with 0 in the new input and once with 1. So inputs have rows: two inputs 4, three 8, four 16. They are exactly all the binary numbers of bits.
Feedback for a right answer
different columns, from 0000 to 1111. Among them AND, OR, XOR, NAND, NOR, and even dull gates that always give 0 or always 1.
Hint
The column has four rows, each 0 or 1.
Worked solution
- A two-input table has 4 rows.
- On each row the output is 0 or 1: 2 choices.
- .
is the number of rows, not of tables.
Lesson 3 of 4 · About 20 minutes
A half adder
Gates that compute: adding two bits, a carry that is AND and a sum that is XOR, how the NOT blocks the sum at 1 + 1, and why it is only half an adder.
The 5 steps and their answers
Practice · Predict, then look
Question
The gates are rewired into a half adder, and both inputs are 0. What will the Carry and Sum lights show when we add ?
Correct answer
Correct Carry 1, sum 0
Setup, choices and feedback
The Scene at this step
- Input bits
- 0fixed
- Three gates / Half adder
- Half adderfixed
Choices
Correct Carry 1, sum 0
Wrong Carry 0, sum 1
Misconception: Takes the half adder's sum bit to be A OR B, so that 1 + 1 gives a sum of 1.
Feedback from the catalogue
The sum bit is XOR, not OR. , and in base 2 two is written 10: sum bit 0, and a carry of 1 into the next place, just as in base ten. So the sum is 1 only when exactly one input is 1, and in the half adder the NOT after the AND blocks it when both are on.
Wrong Carry 1, sum 1
Misconception: Takes the half adder's sum bit to be A OR B, so that 1 + 1 gives a sum of 1.
Feedback from the catalogue
The sum bit is XOR, not OR. , and in base 2 two is written 10: sum bit 0, and a carry of 1 into the next place, just as in base ten. So the sum is 1 only when exactly one input is 1, and in the half adder the NOT after the AND blocks it when both are on.
Once the prediction is locked in, the Scene changes
- Input bits
- 3fixed
The Scene then shows: 2 · Logic: carry and sum read as a binary number, carry × 2 + sum (equals A + B)
/nodes/board/outputs/totalA prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
: the carry is the 2s digit and the sum the 1s digit. The board reads the two lights together as a binary number.
Worked solution
- .
- In base 2, : the 2s digit is 1 and the 1s digit is 0.
- The carry is the 2s digit: 1. The sum is the 1s digit: 0.
A sum of 1 would be right if the sum were OR. It is XOR.
Practice · Reach the target
Question
The carry is on and the sum is dark. Find inputs at which the Sum light is on and the Carry light is dark, and press Check.
Goal
1 ± 0.01
At the start of the step: 0
0 ± 0.01
At the start of the step: 1
Setup, choices and feedback
The Scene at this step
- Input bits
- 3
- Three gates / Half adder
- Half adderfixed
- Read from the Scene at
- Logic: the half adder's sum bit, A XOR B
/nodes/board/outputs/sum - Read from the Scene at
- Logic: the half adder's carry, A AND B
/nodes/board/outputs/carry
One setting that reaches it
- Input bits
- 1
Feedback for a right answer
and are both : a sum with no carry.
Feedback for a wrong answer
Not yet. Which sum of two bits gives exactly 1?
Worked solution
- Sum 1 and carry 0 are .
- when exactly one input is 1.
- Choose 0 1 or 1 0.
Practice · Choose
Question
The carry light is on only for . Which gate on its own computes the carry?
Correct answer
Correct AND
Setup, choices and feedback
The Scene at this step
- Input bits
- 3
- Three gates / Half adder
- Half adderfixed
Choices
Shown in a random order.
Correct AND
Wrong OR
Misconception: Mixes up AND and OR.
Feedback from the catalogue
AND is strict: it needs every input at 1. OR is lenient: one is enough. In a two-input truth table AND gives 1 on only one row, 11, and OR gives 0 on only one row, 00. The symbols help: the AND gate has a flat back, and OR a curved back and a pointed nose.
Wrong XOR
Misconception: Takes the half adder's sum bit to be A OR B, so that 1 + 1 gives a sum of 1.
Feedback from the catalogue
The sum bit is XOR, not OR. , and in base 2 two is written 10: sum bit 0, and a carry of 1 into the next place, just as in base ten. So the sum is 1 only when exactly one input is 1, and in the half adder the NOT after the AND blocks it when both are on.
Feedback for a right answer
The carry is 1 only when both inputs are 1: the table of AND. On the board the AND’s output goes straight to the carry light, and also to the NOT on the way.
Worked solution
- The carry column: 0, 0, 0, 1.
- That is the column of AND.
OR would carry for too, and XOR is the sum digit.
Practice · Predict, then look
Question
The sum is built as . Now A = 1 and B = 0, and the sum is on. When B goes up too, the sum will go dark. What will the NOT’s output, , be then?
Correct answer
Correct 0: it blocks the sum
Setup, choices and feedback
The Scene at this step
- Input bits
- 2fixed
- Three gates / Half adder
- Half adderfixed
Choices
Correct 0: it blocks the sum
Wrong 1: it is the OR that goes off and blocks
Misconception: Takes OR to be 0 when both inputs are 1, as the everyday "or" (one or the other, not both).
Feedback from the catalogue
In everyday speech “or” sometimes means “one of the two, not both”: tea or coffee. A logic gate’s OR includes both: it gives 1 when at least one input is 1, so 1 OR 1 is 1. The gate that gives 0 when both inputs are on is XOR, “exclusive or”.
Once the prediction is locked in, the Scene changes
- Input bits
- 3fixed
The Scene then shows: 0 · Logic: NOT (A AND B), the half adder's inner NOT
/nodes/board/outputs/nandOutA prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
At 1 1 the AND gives 1, the NOT turns it into 0, and the last AND, which needs both its inputs, shuts. The OR stays at 1 throughout.
Worked solution
- = 1 AND 1 = 1.
- NOT(1) = 0.
- = 1, so the sum is 1 AND 0 = 0: it is the NOT that blocks.
Practice · Choose
Question
Why is this circuit called a half adder?
Correct answer
Correct Because it has no input for a carry coming from the column to its right, so it suits only the rightmost column
Setup, choices and feedback
The Scene at this step
- Input bits
- 1
- Three gates / Half adder
- Half adder
Choices
Shown in a random order.
Correct Because it has no input for a carry coming from the column to its right, so it suits only the rightmost column
Wrong Because it adds only half the numbers
Feedback
It adds any two bits correctly. What it lacks is a third bit, the carry from the column before.
Wrong Because it has only half the gates it needs
Feedback
The name comes not from the number of gates but from what it can add: two bits, not three.
Feedback for a right answer
In column addition every column but the rightmost must add three bits: the two digits and the carry. A full adder does that, and is built from two half adders and an OR gate.
Worked solution
- When adding long numbers, a carry passes from each column to the one on its left.
- A half adder adds only two bits.
- So it suits the rightmost column, which has no carry in, and the others need a full adder.
Lesson 4 of 4 · About 25 minutes
A full adder and the processor
Three bits in a column: the full adder, eight of them in a row in a processor's arithmetic unit, binary addition with carries, and what happens when the sum does not fit in a byte.
The 5 steps and their answers
Practice · Predict, then look
Question
The processor is about to add . The Zoom into the chip loupe will hold bit 3 of the arithmetic unit: a full adder receiving , and a carry in of 1 from the bit to its right. What will it give?
Correct answer
Correct Sum 1, carry out 1
Setup, choices and feedback
The Scene at this step
- Clock tick
- 7fixed
- First number
- 28fixed
- Second number
- 14fixed
- Zoom into the chip
- Blocksfixed
- Other settings
- Loupe bit
/nodes/cpu/props/loupeBit= 3
Choices
Correct Sum 1, carry out 1
Wrong Sum 0, carry out 1
Misconception: Adds only a and b in a full adder, ignoring the carry coming in from the bit to its right.
Feedback from the catalogue
A full adder adds three bits: , , and the carry from the column to its right, just as in column addition at school. : sum bit 1 and carry 1. Without the carry in, each column would ignore what happened in the columns before it.
Wrong Sum 1, carry out 0
Feedback
, more than 1, so there must be a carry out.
Once the prediction is locked in, the Scene changes
- Zoom into the chip
- Transistorsfixed
A prediction is never marked as a failure: the learner sees the outcome and the explanation either way.
Feedback for a right answer
: sum digit 1 and a carry of 1 into bit 4. The loupe shows the three bits going in and the two coming out, with transistors switching to match.
Worked solution
- A full adder adds three bits: .
- : the 1s digit is 1 and the 2s digit is 1.
- Sum 1, carry out 1.
Sum 0 comes from ignoring the carry in and adding only .
Practice · Calculate
Question
The first number is and the second . Add them in base 2, column by column with carries, as the arithmetic unit does. What is the result in base ten?
Correct answer
42 ± 0.01
Setup, choices and feedback
The Scene at this step
- Clock tick
- 7
- First number
- 28
- Second number
- 14
- Zoom into the chip
- Transistors
- Other settings
- Loupe bit
/nodes/cpu/props/loupeBit= 3
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
18 ± 0.01
Misconception: Adds binary numbers column by column without carrying.
Feedback from the catalogue
When a column gives , its sum is 0 and a 1 carries to the next column. Dropping the carry gives the XOR of the two numbers, not their sum: and give instead of . Correct addition carries as in base ten.
Feedback for a right answer
, and . Run the processor until it stores the result in cell 13, and it will appear there.
Hint
Start on the right. In a column with , write 0 and carry 1 to the left.
Worked solution
- Bits 0 and 1: , , no carry.
- Bit 2: : write 0, carry 1.
- Bit 3: : write 1, carry 1.
- Bit 4: : write 0, carry 1. Bit 5: .
- The result is .
If you got , you dropped the carries.
Practice · Choose
Question
This processor’s arithmetic unit adds two bytes. How is it built?
Correct answer
Correct Eight full adders in a row, each passing its carry to the next
Setup, choices and feedback
The Scene at this step
- Clock tick
- 7
- First number
- 28
- Second number
- 14
- Zoom into the chip
- Transistors
- Other settings
- Loupe bit
/nodes/cpu/props/loupeBit= 3
Choices
Shown in a random order.
Correct Eight full adders in a row, each passing its carry to the next
Wrong A table in memory with the answer for every pair of numbers
Misconception: Thinks the processor adds by looking up memorised answers rather than computing them with gates.
Feedback from the catalogue
There is no table of every sum in the processor: two bytes have combinations, and such a table would be huge. The arithmetic unit computes the sum: eight full adders in a row, each made of a few gates, each passing its carry to the next. The same simple gates add any pair of numbers.
Wrong One big gate per bit, with no link between the bits
Misconception: Adds binary numbers column by column without carrying.
Feedback from the catalogue
When a column gives , its sum is 0 and a 1 carries to the next column. Dropping the carry gives the XOR of the two numbers, not their sum: and give instead of . Correct addition carries as in base ten.
Feedback for a right answer
Eight copies of the same full adder, one per bit. The carry “ripples” from right to left, hence the name ripple-carry adder. The loupe shows one of them, transistor by transistor.
Worked solution
- Each column of binary addition adds three bits: two digits and a carry. That is a full adder.
- A byte has eight columns, so eight full adders.
- Each one’s carry out is the carry in of the one to its left.
A table of every sum would need 65,536 rows; the gates work each sum out afresh.
Practice · Calculate
Question
The first number is and the second . The result has to fit in one byte, in cell 13. Which number will be stored there?
Correct answer
44 ± 0.01
Setup, choices and feedback
The Scene at this step
- Clock tick
- 0
- First number
- 200
- Second number
- 100
- Zoom into the chip
- Blocks
- Accepted within
- ± 0.01
- A fixed value in the question
Wrong answers it recognises
300 ± 0.01
Misconception: Expects an 8-bit adder to hold any sum, not knowing that a result over 255 wraps around.
Feedback from the catalogue
A byte has only eight places, so it holds at most 255. When a sum goes past 255, the carry out of the leftmost bit has nowhere to go: it lights as the carry flag, and the byte keeps only what is past 256. , and the byte keeps . Programs that compute with bigger numbers use several bytes.
255 ± 0.01
Misconception: Expects an 8-bit adder to hold any sum, not knowing that a result over 255 wraps around.
Feedback from the catalogue
A byte has only eight places, so it holds at most 255. When a sum goes past 255, the carry out of the leftmost bit has nowhere to go: it lights as the carry flag, and the byte keeps only what is past 256. , and the byte keeps . Programs that compute with bigger numbers use several bytes.
Feedback for a right answer
: nine bits. The ninth leaves as the carry and lights the carry flag, and the byte keeps the eight on the right, . Try it: set the numbers and move Clock tick to the end.
Hint
A byte holds only to . What happens to the carry out of the leftmost bit?
Worked solution
- .
- , so the sum does not fit in a byte: the carry from the leftmost bit goes to the carry flag.
- The byte keeps .
cannot be stored in a byte, and is not what happens: the hardware does not stop at the limit, it starts again from .
Practice · Reach the target
Question
Set the First number so that cell 14 holds the byte , and press Check.
Goal
37 ± 0.01
At the start of the step: 28
Setup, choices and feedback
The Scene at this step
- Clock tick
- 0fixed
- First number
- 28
- Second number
- 14fixed
- Zoom into the chip
- Blocks
- Read from the Scene at
- Cell14
/nodes/cpu/props/cell14
One setting that reaches it
- First number
- 37
Feedback for a right answer
. Cell 14 in memory now shows the same eight bits.
Feedback for a wrong answer
Not yet. Add the place values over the ones.
Hint
.
Worked solution
- The place values: .
- The ones in stand under , and .
- : set the First number to 37.
Across the unit · 11 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.
Thinks AND outputs 1 when either input is 1.
- The learner reads
AND gives only when both inputs are , like a door that opens only with a card and a code. A single 0 at an input is enough to make the output 0. The gate that gives 1 when at least one input is 1 is OR.
- Recognised in
Takes OR to be 0 when both inputs are 1, as the everyday "or" (one or the other, not both).
- The learner reads
In everyday speech “or” sometimes means “one of the two, not both”: tea or coffee. A logic gate’s OR includes both: it gives 1 when at least one input is 1, so 1 OR 1 is 1. The gate that gives 0 when both inputs are on is XOR, “exclusive or”.
Mixes up AND and OR.
- The learner reads
AND is strict: it needs every input at 1. OR is lenient: one is enough. In a two-input truth table AND gives 1 on only one row, 11, and OR gives 0 on only one row, 00. The symbols help: the AND gate has a flat back, and OR a curved back and a pointed nose.
Thinks each extra input adds two rows to a truth table instead of doubling them.
- The learner reads
Each extra input doubles the number of rows: every old row appears once with 0 in the new input and once with 1. So inputs have rows: two inputs 4, three 8, four 16. They are exactly all the binary numbers of bits.
Confuses the number of rows in a truth table with the number of different tables, that is of different gates.
- The learner reads
A gate with two inputs has 4 rows, and a gate is decided by what it writes on each of them: 0 or 1. Four rows, with two choices on each, give different tables, that is 16 different two-input gates. AND, OR and XOR are three of them.
- Recognised in
Takes the half adder's sum bit to be A OR B, so that 1 + 1 gives a sum of 1.
- The learner reads
The sum bit is XOR, not OR. , and in base 2 two is written 10: sum bit 0, and a carry of 1 into the next place, just as in base ten. So the sum is 1 only when exactly one input is 1, and in the half adder the NOT after the AND blocks it when both are on.
Adds only a and b in a full adder, ignoring the carry coming in from the bit to its right.
- The learner reads
A full adder adds three bits: , , and the carry from the column to its right, just as in column addition at school. : sum bit 1 and carry 1. Without the carry in, each column would ignore what happened in the columns before it.
- Recognised in
Adds binary numbers column by column without carrying.
- The learner reads
When a column gives , its sum is 0 and a 1 carries to the next column. Dropping the carry gives the XOR of the two numbers, not their sum: and give instead of . Correct addition carries as in base ten.
Expects an 8-bit adder to hold any sum, not knowing that a result over 255 wraps around.
- The learner reads
A byte has only eight places, so it holds at most 255. When a sum goes past 255, the carry out of the leftmost bit has nowhere to go: it lights as the carry flag, and the byte keeps only what is past 256. , and the byte keeps . Programs that compute with bigger numbers use several bytes.
- Recognised in
Thinks the processor adds by looking up memorised answers rather than computing them with gates.
- The learner reads
There is no table of every sum in the processor: two bytes have combinations, and such a table would be huge. The arithmetic unit computes the sum: eight full adders in a row, each made of a few gates, each passing its carry to the next. The same simple gates add any pair of numbers.
- Recognised in
Expects NOT to pass its input through unchanged, or to output 0 whatever comes in.
- The learner reads
NOT flips: 0 in, 1 out; 1 in, 0 out. It has just one input, here A. So the NOT light is on exactly when A is down, and goes dark when A goes up.
- Recognised in
- Not used by any question yet.