A Level Computer Science (A2) chapter 7: Computational thinking and Problem-solving MCQs with answers
By Team Megalecture · Updated 4 Nov 2026
60 exam-style questions on Computational thinking and Problem-solving, each with the answer and a short explanation. Ten of them are below to try. The chapter test draws ten fresh questions each time and is marked the moment you finish, with your score by topic.
Ten Computational thinking and Problem-solving questions with answers
Try each one, then open the answer. These ten stay the same; the test draws new ones every time.
1. Which is an advantage of a linked list over an array when a new item has to be inserted in the middle of a sorted list?
A
the items can be found more quickly by a binary search
B
less memory is used because pointers do not need to be stored
C
the items can be accessed directly by their index
D
no existing items need to be shifted; only pointers are changed
Show answer
Answer: D. Inserting into an array means moving every later item along, but in a linked list only two pointers change. The cost is the extra memory for pointers and no direct access by position.
2. An insertion sort is used on 8 items that are already in ascending order. Counting one comparison each time an item in the sorted part is compared with the item being inserted, how many comparisons are made, and how does this compare with data in reverse order?
A
28, against 7 for reversed data
B
8, against 64 for reversed data
C
7, as for reversed data
D
7, against 28 for reversed data
Show answer
Answer: D. In order, each of the 7 items to insert is compared once with its left neighbour and stays put: 7 comparisons. In reverse order, each item is compared with everything to its left: 1 + 2 + … + 7 = 28. Performance depends on the initial order.
3.FUNCTION Fib(N : INTEGER) RETURNS INTEGER IF N <= 1 THEN RETURN N ELSE RETURN Fib(N - 1) + Fib(N - 2) ENDIF ENDFUNCTIONHow many calls of Fib are made in total (including the first) when Fib(5) is evaluated?
A
5
B
8
C
10
D
15
Show answer
Answer: D. The number of calls is C(5) = 1 + C(4) + C(3), with C(0) = C(1) = 1: C(2) = 3, C(3) = 5, C(4) = 9, C(5) = 15. The same values are recalculated many times, which makes this version slow.
4. Which task is most naturally solved using recursion?
A
adding up the 100 numbers in an array
B
traversing every node of a binary tree
C
copying one file to another byte by byte
D
displaying a menu until the user chooses Quit
Show answer
Answer: B. A tree is made up of smaller trees (the left and right sub-trees), so a routine that visits the node and then calls itself on each sub-tree matches the structure. The other tasks are simple loops.
5. What happens when a pop is attempted on an empty stack?
A
a stack underflow error
B
a stack overflow error
C
the bottom item is returned
D
the top pointer becomes positive
Show answer
Answer: A. There is nothing to remove, so the attempt is an underflow. Overflow is what happens when an item is pushed onto a full stack.
6. A linked list of names is held in arrays Data and Next. The node holding Bina is at index 1 and index 5 holds Dev, and Next[1] holds the pointer to Dev. The name Cara is already stored in Data[6], an unused node, and is to be inserted between Bina and Dev. Which pair of assignments does this correctly, in this order?
A
Next[1] ← 6 then Next[6] ← Next[1]
B
Next[6] ← Next[1] then Next[1] ← 6
C
Next[6] ← 1 then Next[5] ← 6
D
Next[1] ← 6 then Next[6] ← 0
Show answer
Answer: B. The new node must first take over the pointer to Dev (Next[6] ← Next[1]), and then Bina is made to point to the new node (Next[1] ← 6). Changing Next[1] first would overwrite the only record of where Dev is, and the new node would end up pointing to itself.
7. What happens on the call stack when a recursive call returns?
A
its frame is kept, and a new frame is added above it for the return value
B
the return address is deleted and the program stops
C
its frame is popped and control returns to the caller with the result
D
every frame in the stack is removed at the same time
Show answer
Answer: C. The frame of the completed call is popped, the stored return address tells the processor where to carry on in the calling routine, and the returned value is passed on to it. The other frames remain for the calls still waiting.
8. Which starting order of data is the worst case for a bubble sort into ascending order?
A
the items are already in ascending order
B
the items are all identical
C
the items are in descending order
D
the items are nearly sorted with one pair swapped
Show answer
Answer: C. Reverse-order data needs the most swaps and passes, because every pair of items is out of order. Data already in order (or nearly so) needs very few.
9.FUNCTION Down(N : INTEGER) RETURNS INTEGER IF N = 0 THEN RETURN 0 ELSE RETURN Down(N - 2) ENDIF ENDFUNCTIONWhat happens when Down(5) is called?
A
it returns 0 after three calls, because 5 is close to 0
B
it returns 1 after three calls, the last odd value before 0
C
it returns 5, because the argument is never changed by the calls
D
it never reaches the base case, so it ends in a stack overflow
Show answer
Answer: D. The arguments are 5, 3, 1, −1, −3 … the odd number goes past 0 without ever being equal to it, so the base case is never reached. The argument must reach the base case for every valid input.
10.FOR i ← 1 TO N − 1 FOR j ← 1 TO N − i IF A[j] > A[j + 1] THEN swap A[j] and A[j + 1] ENDIF NEXT j NEXT i This bubble sort is used with N = 6. How many times is the comparison A[j] > A[j + 1] made in total, whatever the data?
A
30
B
36
C
25
D
15
Show answer
Answer: D. The inner loop runs 5, 4, 3, 2, 1 times for i = 1 to 5, and 5 + 4 + 3 + 2 + 1 = 15 (that is N(N − 1) ÷ 2). The upper limit N − i is used because the last i items are already in their final places.
Computational thinking and Problem-solving: questions students ask
How many Computational thinking and Problem-solving MCQs are there?
60, each with the answer and a short explanation, across 2 topics: Algorithms, Recursion. Every chapter test draws ten of them, so you can take it many times.
Is the A Level Computer Science (A2) chapter 7 test free?
Yes. The test, the answers and the explanations are free and need no sign-up. Sign in only if you want your scores kept across devices.
How is the chapter test marked?
The moment you press Finish: your score, the right answer and an explanation for every question, and the ones you got wrong saved in My mistakes to retry.