OCR H446 A Level Computer Science · 1.4 Data Types, Data Structures and Boolean Algebra
Stretch tasks Data Types, Number Systems and Boolean Algebra
Quiz Challenge
A quiz game against four computer players, then short and long written answers.
- Quiz Blitz12 questions against the clock
- Quick Fire4 short answers
- Big Think2 long answers
About 20 minutes
This or That
Pixel the cat asks 8 questions. Each has two answers: pick the right one.
- Two answers to every question
- A fish treat for every right answer
- Streaks win Pixel shades, then a party hat
About 4 minutes
Memory Match
Flip the cards two at a time to match each term card to its meaning card.
- 12 cards: each term has a meaning
- One peek at every card
- Combo points for pairs found in a row
6 pairs, about 4 minutes
Sort It
Sort each statement into the right box, like the tick box tables in the exam.
- 8 cards to sort into 4 boxes
- Drag a card, tap a box or press its number
- Combo points for cards sorted in a row
8 cards, about 4 minutes
Code Word
Guess the lesson's secret words. Every guess shows which letters are right.
- A clue for every word
- Tiles turn green, amber or grey after each guess
- Fewer guesses win more points
3 words, about 4 minutes
Link Up
12 tiles hide 3 groups of 4. Work out what links them.
- Pick four tiles that belong together
- Four slips and the round is over
- Fewer slips win more points
3 groups, about 3 minutes
Bug Hunt
Two statements are true and one has a bug. Catch the bug before it gets away.
- Three statements in every round
- Tap the one with the mistake
- Streaks win bonus points
5 rounds, about 4 minutes
Brain games
Train your brain on this lesson
Logic, memory and speed, built from this lesson's own key ideas. Win up to three diamonds in each game.
Odd One Out
Four tiles: three share a link and one does not. Spot the odd one out, then see what links the rest.
- Three belong together, one does not
- A hint shows the link, for fewer points
- Quick answers and streaks win more
8 rounds, about 3 minutes
Memory Flash
Study the term cards, then they flip over. Find the card that goes with each clue, from memory.
- Three levels: 3, 4 and 6 cards
- Two tries to find each card
- Streaks win bonus points
3 levels, about 4 minutes
Fact or Fib
Statements fly in one at a time. Is each one a fact or a fib? Decide fast.
- Swipe, tap or use the arrow keys
- Every fib comes with its fix
- Streaks multiply your points
12 statements, about 3 minutes
The final challenge
City Run
Race a robot cat on inline skates through a neon cyber city, from Neon Station to the Hyper Tunnel. Every question is a row of neon gates across the tracks: skate through the one with the right answer, dodge the trains and barriers, and grab diamonds.
- 20 questions from this lesson, in four parts of the city
- Swipe, tap or use the arrow keys
- Dodge trains and holograms, and jump crates and cones
20 questions, about 6 minutes
Bonus challenge
Neon Roll
Roll a glowing ball down an endless neon slope, past towers lit up with neon signs of Pixel the cat. Steer, jump the gaps and dodge the blocks. Questions from this lesson wait at gates along the way: every right answer keeps the ball rolling.
- Questions from this lesson at every gate
- Hold the arrow keys or a side of the slope to steer
- 8 right answers win two diamonds, 15 win three
Endless, about 5 minutes
The games need JavaScript. Every question is below, with the answers at the end.
Read the lesson: Data Types, Number Systems and Boolean Algebra
Data Types, Number Systems and Boolean Algebra: the questions
Quiz Challenge, round 1: Quiz Blitz
What is the place value of the most significant bit in 8 bit two's complement?
- Minus 1
- 256
- Minus 128
- 128
Which steps turn 00010100 into its negative in two's complement?
- Invert every bit, then add one
- Invert every bit only
- Add one, then invert every bit
- Shift every bit left once
For a fixed number of bits, more mantissa bits give more precision but less range.
- True
- False
Why is a floating point number normalised?
- To turn it into an integer
- To store it with the greatest possible precision
- To make it positive
- To remove the exponent
Which TWO of these mantissas are normalised?
Tick 2.
- 1.0010
- 0.0110
- 1.1010
- 0.1101
Which bitwise operation with 00001111 keeps only the low four bits of a byte?
- AND
- OR
- XOR
- NOT
What does shifting a binary number left by two places do?
- Multiplies it by 4
- Multiplies it by 2
- Divides it by 4
- Adds 2 to it
De Morgan's laws say (A.B)' is the same as A' . B'.
- True
- False
Simplify A + A.B using the absorption law.
Put the steps to simplify A.B + A.B' in order.
Number these 1 to 3.
- A.1
- A
- A.(B + B')
In a Karnaugh map, which group sizes are allowed?
- 3, 6 or 9 cells
- 1, 2, 4 or 8 cells
- Any number of cells
- Only pairs of cells
Why do engineers simplify Boolean expressions?
- It makes the truth table longer
- Fewer gates mean lower cost, less power and less delay
- Simpler expressions give different outputs
- Logic gates cannot carry out NOT
Quiz Challenge, round 2: Quick Fire
Explain how to turn 20 into minus 20 in 8 bit two's complement. [2 marks]
Explain the trade off between range and precision in floating point. [2 marks]
Explain why simplifying a Boolean expression is useful when building a circuit. [2 marks]
Explain why floating point cannot store 0.1 exactly. [2 marks]
Quiz Challenge, round 3: Big Think
Describe how a floating point number is stored, and why it is normalised. [6 marks]
Explain what AND, OR and XOR masks do to a binary value, with a use for each. [4 marks]
This or That: tick the right answer
Which representation lets hardware subtract using only an adder?
- Sign and magnitude
- Two's complement
The total stays the same but the exponent gets more bits. What improves?
- Precision
- Range
Which is faster and keeps the same absolute accuracy everywhere?
- Floating point
- Fixed point
Which operation toggles chosen bits?
- AND
- XOR
What is A . A' always equal to?
- A
- 0
What is A + 1 always equal to?
- A
- 1
Which is (A + B)' by De Morgan's law?
- A' . B'
- A' + B'
Why do financial systems store money as whole pence?
- Floating point cannot store 0.1 exactly
- Integers take more memory
Memory Match: match each term to its meaning
| Term | Meaning |
|---|---|
| A Mantissa | 1 Time for a signal to pass through the gates |
| B Exponent | 2 The significant digits of a floating point number |
| C Bit mask | 3 Break the bar and change the operator |
| D De Morgan's laws | 4 Grid for simplifying by grouping adjacent ones |
| E Karnaugh map | 5 A pattern used with AND or OR to pick out bits |
| F Propagation delay | 6 The power of two the mantissa is multiplied by |
Sort It: tick one box in each row
Which Boolean law does each identity show?
| Statement | Identity | Inverse | Absorption | De Morgan's |
|---|---|---|---|---|
| A + A.B = A | ||||
| A . A' = 0 | ||||
| A + 0 = A | ||||
| (A.B)' = A' + B' | ||||
| A + A' = 1 | ||||
| (A + B)' = A' . B' | ||||
| A . (A + B) = A | ||||
| A . 1 = A |
Code Word: write the word that fits each clue
The part of a floating point number that holds its significant digits. (8 letters)
The power of two that sets where the binary point goes. (8 letters)
Four bits, which is one hexadecimal digit. (6 letters)
Link Up: find the three groups
These 12 tiles make 3 groups of 4. Write each group in the table, and what links its tiles.
- De Morgan's
- Groups may overlap
- Wrap around edges
- Left shift
- OR
- Powers of two
- Identity
- Distributive
- XOR
- Absorption
- AND
- Group only 1s
| Group | The 4 tiles | What links them |
|---|---|---|
| Group 1 | ||
| Group 2 | ||
| Group 3 |
Bug Hunt: tick the statement that is wrong
In each set, two statements are true and one has a mistake in it.
- In 8 bit two's complement the most significant bit is worth minus 128.
- To negate a two's complement number, invert the bits and add one.
- The range of 8 bit two's complement is minus 127 to 128.
- More exponent bits give a larger range.
- A normalised positive mantissa starts with 01.
- Normalising a mantissa reduces its precision.
- OR with 10000000 forces the top bit on.
- AND with 00001111 keeps only the low four bits.
- Shifting a binary number right by one place doubles it.
- A + A' always equals 1.
- A . 0 always equals 0.
- A + A always equals 2A.
- Groups in a Karnaugh map may wrap around the edges.
- Groups in a Karnaugh map must never overlap.
- Karnaugh map groups must contain 1, 2, 4 or 8 cells.
Brain game: Odd One Out
Three tiles in each set share a link. Tick the odd one out, then write what links the other three.
- De Morgan's
- Identity
- Distributive
- Group only 1s
What links the other three?
- Left shift
- XOR
- Absorption
- AND
What links the other three?
- De Morgan's
- Groups may overlap
- Wrap around edges
- Powers of two
What links the other three?
- Left shift
- Identity
- Distributive
- Absorption
What links the other three?
- Groups may overlap
- Left shift
- OR
- AND
What links the other three?
- De Morgan's
- Groups may overlap
- Powers of two
- Group only 1s
What links the other three?
Brain game: Memory Flash, on paper
Which term means this? Write your answer from memory.
The power of two the mantissa is multiplied by
Time for a signal to pass through the gates
The significant digits of a floating point number
Break the bar and change the operator
Grid for simplifying by grouping adjacent ones
A pattern used with AND or OR to pick out bits
Brain game: Fact or Fib
Tick Fact if the statement is true and Fib if it is not.
OR with 10000000 forces the top bit on.
- Fact
- Fib
Normalising a mantissa reduces its precision.
- Fact
- Fib
A + A always equals 2A.
- Fact
- Fib
A . 0 always equals 0.
- Fact
- Fib
The range of 8 bit two's complement is minus 127 to 128.
- Fact
- Fib
Groups in a Karnaugh map may wrap around the edges.
- Fact
- Fib
A + A' always equals 1.
- Fact
- Fib
AND with 00001111 keeps only the low four bits.
- Fact
- Fib
Shifting a binary number right by one place doubles it.
- Fact
- Fib
In 8 bit two's complement the most significant bit is worth minus 128.
- Fact
- Fib
Groups in a Karnaugh map must never overlap.
- Fact
- Fib
De Morgan's laws say (A.B)' is the same as A' . B'.
- Fact
- Fib
City Run
City Run is a race through a neon cyber city, played on screen. It asks 20 of the questions above, from the quiz, This or That, Memory Flash and Fact or Fib.
Neon Roll
Neon Roll is a ball rolling down an endless neon slope, played on screen. Every right answer keeps it rolling. It asks the questions above, from the quiz, This or That, Memory Flash and Fact or Fib.
Answers
Round 1: Quiz Blitz
- Minus 128 The most significant bit carries a negative place value, so 10000000 is minus 128.
- Invert every bit, then add one Inverting gives 11101011, and adding one gives 11101100, which is minus 20.
- True Bits moved to the mantissa improve precision but leave fewer for the exponent, which sets the range.
- To store it with the greatest possible precision A normalised mantissa starts 01 or 10, so no bits are wasted on repeated leading digits.
- 0.1101; 1.0010 A normalised positive mantissa starts 0.1 and a negative one starts 1.0. A leading 00 or 11 wastes a bit.
- AND ANDing with 0 clears a bit and ANDing with 1 keeps it, so the mask keeps the low four bits.
- Multiplies it by 4 Each place left doubles the value, so two places multiply by 4, as long as no 1s are lost off the end.
- False Break the bar and change the operator: (A.B)' equals A' + B'.
- a Absorption: A + A.B = A. If A is true the whole expression is already true.
- A.(B + B') → A.1 → A Factor out A by the distributive law, B + B' = 1 by the inverse law, then A.1 = A by the identity law.
- 1, 2, 4 or 8 cells Groups must be rectangles whose size is a power of two, and as large as possible.
- Fewer gates mean lower cost, less power and less delay The same logic with fewer gates is cheaper, cooler, smaller and faster.
Round 2: Quick Fire
- Invert every bit
- Then add one
Model answerWrite 20 as 00010100, invert every bit to get 11101011, then add one to get 11101100.
- More mantissa bits give more precision
- More exponent bits give more range
- The total is fixed, so improving one worsens the other
Model answerWith a fixed number of bits, giving more bits to the mantissa increases precision but leaves fewer for the exponent, which reduces the range.
- It needs fewer logic gates
- So the circuit is cheaper, uses less power, makes less heat and is faster
Model answerA simpler expression needs fewer logic gates, so the circuit is cheaper, uses less power, produces less heat and has a shorter propagation delay.
- 0.1 is a recurring fraction in binary
- The mantissa has a limited number of bits, so the value is rounded
Model answerIn binary 0.1 is a recurring fraction that never ends, like one third in denary, and the mantissa has only a limited number of bits, so the value has to be rounded.
Round 3: Big Think
- It is stored as a mantissa and an exponent
- The value is the mantissa times 2 to the power of the exponent, which moves the binary point
- Both parts are in two's complement
- A normalised mantissa starts 01 when positive or 10 when negative
- Normalising gives the greatest precision
- No bits are wasted on leading repeated digits
- Each number has only one representation
Model answerA floating point number is stored as a mantissa and an exponent, both in two's complement. The value is the mantissa multiplied by 2 to the power of the exponent, so the exponent moves the binary point. The mantissa is normalised so that it starts with 01 for a positive number or 10 for a negative one. This means no bits are wasted on leading repeated digits, which gives the greatest possible precision, and each number has only one representation.
- AND keeps the bits where the mask has a 1 and clears the rest
- OR sets chosen bits to 1
- XOR toggles chosen bits
- XORing twice restores the value, so it works as a simple cipher
Model answerANDing with a mask keeps the bits where the mask has a 1 and clears the rest, which can isolate the low nibble. ORing with a mask sets chosen bits to 1, such as forcing the top bit on. XORing with a mask toggles chosen bits, and doing it twice gives the original back, which makes it a simple reversible cipher.
This or That
- Two's complement In two's complement, subtracting is adding the negative, so the hardware needs only an adder.
- Range The exponent sets how far the point can move, so more exponent bits widen the range but leave fewer for the mantissa.
- Fixed point Fixed point keeps the binary point in one place, which is fast and uniform, but its range is far smaller.
- XOR XOR with a 1 flips a bit and with a 0 leaves it, so XORing twice restores the original.
- 0 Inverse law: something and its opposite can never both be true.
- 1 Null law: OR with a true input is always true.
- A' . B' Break the bar and change the operator, so the OR becomes an AND.
- Floating point cannot store 0.1 exactly Fractions like 0.1 recur in binary, so floating point rounds them. Counting whole pence avoids rounding errors.
Memory Match
- A 2 Mantissa: The significant digits of a floating point number
- B 6 Exponent: The power of two the mantissa is multiplied by
- C 5 Bit mask: A pattern used with AND or OR to pick out bits
- D 3 De Morgan's laws: Break the bar and change the operator
- E 4 Karnaugh map: Grid for simplifying by grouping adjacent ones
- F 1 Propagation delay: Time for a signal to pass through the gates
Sort It
- Absorption A + A.B = A If A is true the whole thing is true, so A.B adds nothing: absorption.
- Inverse A . A' = 0 A value and its opposite can never both be true: the inverse law.
- Identity A + 0 = A ORing with false leaves A unchanged: the identity law.
- De Morgan's (A.B)' = A' + B' Break the bar and change AND to OR: De Morgan's law.
- Inverse A + A' = 1 A value or its opposite is always true: the inverse law.
- De Morgan's (A + B)' = A' . B' Break the bar and change OR to AND: De Morgan's law.
- Absorption A . (A + B) = A Whenever A is true, A + B is true too, so the result is just A: absorption.
- Identity A . 1 = A ANDing with true leaves A unchanged: the identity law.
Code Word
- MANTISSA The part of a floating point number that holds its significant digits.
- EXPONENT The power of two that sets where the binary point goes.
- NIBBLE Four bits, which is one hexadecimal digit.
Link Up
- Boolean laws Identity; Absorption; Distributive; De Morgan's
- Bitwise operations AND; OR; XOR; Left shift
- Karnaugh map rules Group only 1s; Powers of two; Groups may overlap; Wrap around edges
Bug Hunt: the wrong statement, and why
- The range of 8 bit two's complement is minus 127 to 128. It is minus 128 to 127. There is one more negative value because zero uses a positive pattern.
- Normalising a mantissa reduces its precision. Normalising removes wasted leading bits, so it gives the greatest possible precision.
- Shifting a binary number right by one place doubles it. A right shift halves the number, losing the bit shifted out. A left shift doubles it.
- A + A always equals 2A. By the idempotent law A + A = A. In Boolean algebra a value ORed with itself is unchanged.
- Groups in a Karnaugh map must never overlap. Groups may overlap. Making each group as large as possible matters more.
Odd One Out
- Group only 1s is the odd one out: it goes with Karnaugh map rules. The other three: Boolean laws.
- Absorption is the odd one out: it goes with Boolean laws. The other three: Bitwise operations.
- De Morgan's is the odd one out: it goes with Boolean laws. The other three: Karnaugh map rules.
- Left shift is the odd one out: it goes with Bitwise operations. The other three: Boolean laws.
- Groups may overlap is the odd one out: it goes with Karnaugh map rules. The other three: Bitwise operations.
- De Morgan's is the odd one out: it goes with Boolean laws. The other three: Karnaugh map rules.
Memory Flash
- Exponent The power of two the mantissa is multiplied by
- Propagation delay Time for a signal to pass through the gates
- Mantissa The significant digits of a floating point number
- De Morgan's laws Break the bar and change the operator
- Karnaugh map Grid for simplifying by grouping adjacent ones
- Bit mask A pattern used with AND or OR to pick out bits
Fact or Fib
- Fact OR with 10000000 forces the top bit on.
- Fib Normalising a mantissa reduces its precision. The fix: Normalising removes wasted leading bits, so it gives the greatest possible precision.
- Fib A + A always equals 2A. The fix: By the idempotent law A + A = A. In Boolean algebra a value ORed with itself is unchanged.
- Fact A . 0 always equals 0.
- Fib The range of 8 bit two's complement is minus 127 to 128. The fix: It is minus 128 to 127. There is one more negative value because zero uses a positive pattern.
- Fact Groups in a Karnaugh map may wrap around the edges.
- Fact A + A' always equals 1.
- Fact AND with 00001111 keeps only the low four bits.
- Fib Shifting a binary number right by one place doubles it. The fix: A right shift halves the number, losing the bit shifted out. A left shift doubles it.
- Fact In 8 bit two's complement the most significant bit is worth minus 128.
- Fib Groups in a Karnaugh map must never overlap. The fix: Groups may overlap. Making each group as large as possible matters more.
- Fib De Morgan's laws say (A.B)' is the same as A' . B'. The fix: Break the bar and change the operator: (A.B)' equals A' + B'.

