OCR H446 A Level Computer Science · 2.1 and 2.2 Computational Thinking and Problem Solving
Stretch tasks Elements of Computational Thinking
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.
- 12 cards to sort into 4 boxes
- Drag a card, tap a box or press its number
- Combo points for cards sorted in a row
12 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: Elements of Computational Thinking
Elements of Computational Thinking: the questions
Quiz Challenge, round 1: Quiz Blitz
A Tube map leaves out real distances and streets. Which kind of abstraction is this?
- Abstraction by generalisation
- Decomposition
- Thinking concurrently
- Representational abstraction
A Vehicle class serves cars, vans and lorries. Which kind of abstraction is this?
- Backtracking
- Abstraction by generalisation
- Representational abstraction
- Caching
A binary search has the precondition that the data is sorted.
- True
- False
What does caching trade?
- Speed for accuracy
- Accuracy for memory
- Security for speed
- Memory for speed
Which THREE are costs of thinking concurrently?
Tick 3.
- Less need for synchronisation
- Race conditions
- Deadlock
- Harder testing and debugging
- Guaranteed faster programs
Two threads add to the same total at once and one update is lost. What is this?
- A deadlock
- A precondition
- A cache miss
- A race condition
Which of these is decomposition?
- Breaking a problem into smaller sub problems
- Removing detail that is not needed
- Storing results for reuse
- Running tasks at the same time
Thinking concurrently always makes a program run faster.
- True
- False
What is the name for a condition that must be true before a subroutine may be called?
Order these the way top down design works, from the whole problem down.
Number these 1 to 3.
- Draw the first level's map
- Build a game
- Design the levels
Which task can be done concurrently?
- Rendering separate frames of a video
- Keeping a running total of a bank balance
- Following a recipe where each step needs the last
- Counting a file's lines after reading it
What is apparent concurrency?
- Two programs sharing one variable
- A task that never finishes
- One processor switching between tasks so fast they seem simultaneous
- Several processors running tasks at the same time
Quiz Challenge, round 2: Quick Fire
Explain the difference between abstraction and decomposition. [2 marks]
Give an example of thinking ahead in a program, and explain why it helps. [2 marks]
Explain why race conditions make concurrent programs hard to test. [2 marks]
Explain how thinking logically helps a programmer avoid defects. [2 marks]
Quiz Challenge, round 3: Big Think
A school wants a program to produce timetables. Explain how thinking abstractly, ahead, procedurally and concurrently could help. [6 marks]
Explain the benefits and drawbacks of concurrent processing. [4 marks]
This or That: tick the right answer
Which removes detail that is not needed?
- Abstraction
- Decomposition
Which design starts with the whole problem and keeps dividing it?
- Bottom up
- Top down
A traffic simulation assumes every driver is rational. What is the risk?
- The program will not compile
- The model may not match reality
Several processors run tasks at the same instant. What is this?
- Apparent concurrency
- Genuine concurrency
Each thread holds a resource the other needs. What happens?
- A race condition
- Deadlock
Which job can be split across several cores?
- Resizing 1,000 separate photos
- Keeping a running total
What must be true before a binary search runs?
- The data is sorted
- The data has no duplicates
Which element of thinking finds every path through the code?
- Thinking logically
- Thinking ahead
Memory Match: match each term to its meaning
| Term | Meaning |
|---|---|
| A Abstraction | 1 Must be true before a subroutine is called |
| B Decomposition | 2 Removing detail not needed for the problem |
| C Precondition | 3 Splitting a problem into sub problems |
| D Caching | 4 Result depends on the order threads run |
| E Race condition | 5 Threads each hold what the other needs |
| F Deadlock | 6 Storing results likely to be needed again |
Sort It: tick one box in each row
Which element of computational thinking does each example show?
| Statement | Thinking abstractly | Thinking ahead | Thinking procedurally | Thinking concurrently |
|---|---|---|---|---|
| Breaking a project into sub problems | ||||
| Deciding which sub problem must be solved first | ||||
| A Tube map leaves out real distances | ||||
| A game ignores the weather because it does not affect play | ||||
| Downloading updates while the user keeps working | ||||
| Splitting a game into menus, levels and scoring | ||||
| A browser caches pages it has already loaded | ||||
| Rendering video frames on several cores at once | ||||
| A Vehicle class covers cars, vans and lorries | ||||
| Listing the inputs and outputs before design begins | ||||
| Checking the data is sorted before a binary search | ||||
| Spotting which steps depend on earlier results |
Code Word: write the word that fits each clue
Fast storage for results that are likely to be needed again. (5 letters)
This kind of condition means the result depends on which thread reaches shared data first. (4 letters)
A simplified version of reality, useful precisely because it leaves things out. (5 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.
- Reusable parts
- Floor plan
- Tube map
- Flight simulator
- Race conditions
- Inputs and outputs
- Preconditions
- Harder debugging
- Traffic simulation
- Coordination
- Deadlock
- Caching
| 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.
- Abstraction means splitting a problem into smaller parts.
- Decomposition splits a problem into sub problems.
- Abstraction removes detail that is not needed.
- A cache keeps results that will never be used again.
- A precondition must be true before a subroutine is called.
- Caching trades memory for speed.
- Genuine concurrency needs more than one processor.
- Apparent concurrency needs several processors running at once.
- Apparent concurrency switches quickly between tasks.
- Deadlock leaves threads each waiting for the other.
- Race conditions always show up the first time a program is tested.
- A race condition depends on the order threads access shared data.
- Top down design starts with the whole problem.
- Bottom up design builds small components first.
- Real projects only ever use top down design.
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.
- Race conditions
- Traffic simulation
- Coordination
- Deadlock
What links the other three?
- Reusable parts
- Flight simulator
- Inputs and outputs
- Caching
What links the other three?
- Floor plan
- Flight simulator
- Traffic simulation
- Deadlock
What links the other three?
- Race conditions
- Preconditions
- Coordination
- Deadlock
What links the other three?
- Reusable parts
- Preconditions
- Traffic simulation
- Caching
What links the other three?
- Tube map
- Flight simulator
- Inputs and outputs
- Traffic simulation
What links the other three?
Brain game: Memory Flash, on paper
Which term means this? Write your answer from memory.
Must be true before a subroutine is called
Removing detail not needed for the problem
Splitting a problem into sub problems
Result depends on the order threads run
Threads each hold what the other needs
Storing results likely to be needed again
Brain game: Fact or Fib
Tick Fact if the statement is true and Fib if it is not.
Thinking concurrently always makes a program run faster.
- Fact
- Fib
Real projects only ever use top down design.
- Fact
- Fib
Race conditions always show up the first time a program is tested.
- Fact
- Fib
Genuine concurrency needs more than one processor.
- Fact
- Fib
Deadlock leaves threads each waiting for the other.
- Fact
- Fib
Top down design starts with the whole problem.
- Fact
- Fib
A cache keeps results that will never be used again.
- Fact
- Fib
Bottom up design builds small components first.
- Fact
- Fib
Apparent concurrency switches quickly between tasks.
- Fact
- Fib
Abstraction means splitting a problem into smaller parts.
- Fact
- Fib
Apparent concurrency needs several processors running at once.
- Fact
- Fib
A binary search has the precondition that the data is sorted.
- 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
- Representational abstraction Detail is removed until only what a traveller needs remains: stations, lines and connections.
- Abstraction by generalisation Grouping things by what they share lets one solution serve many cases.
- True Binary search discards half the range by comparing with the middle item, which only works on sorted data.
- Memory for speed Results likely to be needed again are stored, using memory so they need not be worked out again.
- Race conditions; Deadlock; Harder testing and debugging Shared data, waiting threads and timing dependent faults all make concurrent code costly. It is never guaranteed to be faster.
- A race condition The result depends on the order in which the threads happened to reach the shared data.
- Breaking a problem into smaller sub problems Decomposition splits the problem. Abstraction removes detail, caching stores results and concurrency runs tasks together.
- False Only the parts that can run in parallel benefit, and coordination, dependencies and Amdahl's law limit the gain.
- precondition A binary search, for example, has the precondition that its data is sorted.
- Build a game → Design the levels → Draw the first level's map Top down design starts with the whole problem and keeps dividing it into smaller tasks.
- Rendering separate frames of a video Each frame is independent, so frames can be rendered at the same time. The others depend on earlier results.
- One processor switching between tasks so fast they seem simultaneous Genuine concurrency needs several processors. Apparent concurrency is rapid switching on one.
Round 2: Quick Fire
- Abstraction removes detail that is not needed
- Decomposition breaks the problem into smaller sub problems
Model answerAbstraction removes detail that is not needed to solve the problem, while decomposition breaks the problem into smaller sub problems that can be solved separately.
- Gives an example such as caching, preconditions or planning inputs
- So what is needed is ready in advance and time is saved
Model answerA web browser caches pages it has already loaded, so when the user goes back the page is ready at once and does not need to be downloaded again.
- The result depends on the order threads reach shared data
- So the fault only appears sometimes and may be missed in testing
Model answerThe result depends on the order in which threads happen to access shared data, so the fault only appears with certain timings and may not show up when the program is tested.
- It identifies every decision and the conditions for each outcome
- Every case is checked, including boundaries and unexpected cases
Model answerThinking logically means identifying every decision in the program and the conditions for each outcome, then checking every case, including boundary values and cases nobody expected.
Round 3: Big Think
- Abstraction leaves out irrelevant detail, keeping only what matters
- Thinking ahead identifies the inputs and outputs
- Thinking ahead plans preconditions or reusable components
- Thinking procedurally decomposes the problem into sub problems
- The sub problems become subroutines solved in a sensible order
- Independent parts could run at the same time
- Parts that depend on each other cannot run together
Model answerThinking abstractly, the program can leave out irrelevant details, keeping only the rooms, teachers, classes and time slots. Thinking ahead means identifying the inputs, such as staff availability, and the output, the finished timetable, and designing reusable components. Thinking procedurally, the problem can be decomposed into sub problems such as allocating rooms and checking for clashes, each written as a subroutine and solved in a sensible order. Thinking concurrently, independent parts, such as timetabling different year groups, could run at the same time, although allocations that depend on shared teachers cannot.
- The total time falls when independent parts run in parallel
- The system stays responsive while long work runs in the background
- Only the parallel part benefits: sequential parts and dependencies limit it
- Shared data can cause race conditions and deadlock
- Concurrent code is harder to write, test and debug
Model answerWhen independent parts of a task run in parallel the total time falls, and the system stays responsive while long work continues in the background. However, only the parts that can run in parallel benefit, so the sequential part and any dependencies limit the gain, as Amdahl's law says. Shared data can cause race conditions and deadlock, and concurrent code is harder to write, test and debug.
This or That
- Abstraction Abstraction strips out what does not matter. Decomposition splits the problem into smaller parts.
- Top down Top down divides the whole. Bottom up builds small components first and assembles them.
- The model may not match reality A model is simpler than reality, which is why it is useful and why it can mislead.
- Genuine concurrency Apparent concurrency is one processor switching between tasks very quickly.
- Deadlock Neither thread can go on. A race condition is about the order of access to shared data.
- Resizing 1,000 separate photos The photos are independent. A running total needs each previous value first.
- The data is sorted Sorted data is the precondition. Binary search copes with duplicates, but not with unsorted data.
- Thinking logically Logical thinking finds every decision and every path, including the case nobody expected.
Memory Match
- A 2 Abstraction: Removing detail not needed for the problem
- B 3 Decomposition: Splitting a problem into sub problems
- C 1 Precondition: Must be true before a subroutine is called
- D 6 Caching: Storing results likely to be needed again
- E 4 Race condition: Result depends on the order threads run
- F 5 Deadlock: Threads each hold what the other needs
Sort It
- Thinking procedurally Breaking a project into sub problems Decomposition is thinking procedurally.
- Thinking procedurally Deciding which sub problem must be solved first Ordering the steps is thinking procedurally.
- Thinking abstractly A Tube map leaves out real distances Removing detail that does not matter is abstraction.
- Thinking abstractly A game ignores the weather because it does not affect play Leaving out irrelevant detail is abstraction.
- Thinking concurrently Downloading updates while the user keeps working Two tasks progressing together is concurrency.
- Thinking procedurally Splitting a game into menus, levels and scoring Dividing the problem into parts is thinking procedurally.
- Thinking ahead A browser caches pages it has already loaded Storing what will be needed again is thinking ahead.
- Thinking concurrently Rendering video frames on several cores at once Running independent work at the same time is thinking concurrently.
- Thinking abstractly A Vehicle class covers cars, vans and lorries Grouping by shared features is abstraction by generalisation.
- Thinking ahead Listing the inputs and outputs before design begins Deciding in advance what is needed is thinking ahead.
- Thinking ahead Checking the data is sorted before a binary search Making sure a precondition holds is thinking ahead.
- Thinking concurrently Spotting which steps depend on earlier results Thinking concurrently means finding what can and cannot run together.
Code Word
- CACHE Fast storage for results that are likely to be needed again.
- RACE This kind of condition means the result depends on which thread reaches shared data first.
- MODEL A simplified version of reality, useful precisely because it leaves things out.
Link Up
- Costs of concurrency Race conditions; Deadlock; Harder debugging; Coordination
- Thinking ahead Caching; Preconditions; Inputs and outputs; Reusable parts
- Models of reality Tube map; Flight simulator; Floor plan; Traffic simulation
Bug Hunt: the wrong statement, and why
- Abstraction means splitting a problem into smaller parts. That is decomposition. Abstraction removes detail that does not matter to the problem.
- A cache keeps results that will never be used again. A cache stores results likely to be needed again, so they need not be worked out a second time.
- Apparent concurrency needs several processors running at once. Apparent concurrency is one processor switching tasks so quickly they seem simultaneous. Genuine concurrency needs several.
- Race conditions always show up the first time a program is tested. They depend on timing, so they may only appear occasionally, which makes them hard to find.
- Real projects only ever use top down design. Real projects use both: dividing the whole problem and assembling small, reliable components.
Odd One Out
- Traffic simulation is the odd one out: it goes with Models of reality. The other three: Costs of concurrency.
- Flight simulator is the odd one out: it goes with Models of reality. The other three: Thinking ahead.
- Deadlock is the odd one out: it goes with Costs of concurrency. The other three: Models of reality.
- Preconditions is the odd one out: it goes with Thinking ahead. The other three: Costs of concurrency.
- Traffic simulation is the odd one out: it goes with Models of reality. The other three: Thinking ahead.
- Inputs and outputs is the odd one out: it goes with Thinking ahead. The other three: Models of reality.
Memory Flash
- Precondition Must be true before a subroutine is called
- Abstraction Removing detail not needed for the problem
- Decomposition Splitting a problem into sub problems
- Race condition Result depends on the order threads run
- Deadlock Threads each hold what the other needs
- Caching Storing results likely to be needed again
Fact or Fib
- Fib Thinking concurrently always makes a program run faster. The fix: Only the parts that can run in parallel benefit, and coordination, dependencies and Amdahl's law limit the gain.
- Fib Real projects only ever use top down design. The fix: Real projects use both: dividing the whole problem and assembling small, reliable components.
- Fib Race conditions always show up the first time a program is tested. The fix: They depend on timing, so they may only appear occasionally, which makes them hard to find.
- Fact Genuine concurrency needs more than one processor.
- Fact Deadlock leaves threads each waiting for the other.
- Fact Top down design starts with the whole problem.
- Fib A cache keeps results that will never be used again. The fix: A cache stores results likely to be needed again, so they need not be worked out a second time.
- Fact Bottom up design builds small components first.
- Fact Apparent concurrency switches quickly between tasks.
- Fib Abstraction means splitting a problem into smaller parts. The fix: That is decomposition. Abstraction removes detail that does not matter to the problem.
- Fib Apparent concurrency needs several processors running at once. The fix: Apparent concurrency is one processor switching tasks so quickly they seem simultaneous. Genuine concurrency needs several.
- Fact A binary search has the precondition that the data is sorted.

