6 exam-style questions with full mark schemes and model answers. Write your own answer and the AI examiner marks it against the mark scheme.
Learn this properly: What is Computational ThinkingA team is asked to write a program for a cinema self-service ticket machine. A customer chooses a film and showing, says how many tickets they want, the machine works out the total price (applying a child and a concession discount), takes payment, and prints the tickets.
Discuss how the team could use decomposition and abstraction to help them design this program. Your answer should explain what each technique means, give a clear example of each applied to the ticket machine, and explain why these techniques make the program easier to design and maintain. (6 marks)
A programmer has written the code below using pattern recognition to spot that the same instructions are repeated. The code asks for four daily rainfall readings and adds them up.
total <- 0
OUTPUT "Enter rainfall for day 1:"
INPUT r
total <- total + r
OUTPUT "Enter rainfall for day 2:"
INPUT r
total <- total + r
OUTPUT "Enter rainfall for day 3:"
INPUT r
total <- total + r
OUTPUT "Enter rainfall for day 4:"
INPUT r
total <- total + r
OUTPUT total
The repeated lines follow a clear pattern.
(a) Identify the pattern that is repeated in this code. (1 mark)
(b) Rewrite the program so that it uses a count-controlled loop to remove the repetition. You may answer in AQA-style pseudocode (using <- for assignment and FOR ... END FOR) or any high-level language. (3 marks)
Computational thinking is often described using four key techniques (sometimes called the "four pillars").
(a) Name the four techniques of computational thinking. (2 marks)
(b) State which of the four techniques is being used in this situation: "A designer studies last year's sales figures and notices that sales always rise in December and fall in January, then uses this repeated trend to plan stock." (1 mark)
When solving a problem computationally, it is useful to identify the inputs, processes and outputs of the required program.
A program is needed to work out a customer's change at a till: the customer's program is given the price of the item and the amount of money paid, and it should display the change due.
State one input, one process and one output for this program. (3 marks)
A map of a city's bus network shows the bus stops and the routes between them as a simple diagram of dots and lines. It deliberately leaves out the exact distances, the real road layout and the surrounding streets.
(a) Name the computational-thinking technique that has been used to create this simplified map. (1 mark)
(b) State one advantage to the bus passenger of presenting the network in this simplified way. (1 mark)
Decomposition is one of the four techniques of computational thinking.
State what is meant by decomposition. (1 mark)