Algorithms › Exam Questions
Exam Practice
Algorithms Exam Questions

Questions covering the full series - computational thinking, pseudocode, searching, sorting, and evaluation. Click an answer or reveal the mark scheme.

Back to Series
Multiple Choice
Short Answer
Extended Response
Multiple Choice 1 mark
A developer removes details about server hardware, network protocols and database structure when designing a user login screen. Which computational thinking pillar is this?
  • A. Decomposition
  • B. Abstraction
  • C. Pattern recognition
  • D. Algorithmic thinking
Short Answer 3 marks
Describe how decomposition could be applied to the problem of building an online shopping website. Give three distinct sub-problems.
Mark Scheme
Award 1 mark for each distinct, appropriate sub-problem (up to 3):
  • Managing user accounts (login, registration, password reset)
  • Displaying products (categories, images, descriptions, search)
  • Handling the shopping cart and checkout process
  • Processing payments securely
  • Managing order tracking and delivery notifications
  • Any other clearly distinct and relevant sub-problem
Note: Sub-problems must be genuinely independent tasks, not just steps in a sequence.
Multiple Choice 1 mark
Which flowchart symbol represents an input or output operation?
  • A. Rectangle (process box)
  • B. Diamond (decision box)
  • C. Parallelogram
  • D. Oval (terminator)
Short Answer 4 marks
Write pseudocode for an algorithm that asks the user to enter a number between 1 and 100. If the number is outside this range, keep asking until a valid number is entered, then output the number multiplied by itself.
Mark Scheme - Accept AQA or OCR syntax
Award marks for:
  • [1] Input loop that continues while number < 1 OR number > 100 (DO…UNTIL or WHILE with re-prompt)
  • [1] Correct condition - both bounds checked (1 and 100)
  • [1] Re-prompting the user inside the loop
  • [1] Outputting number * number (or number²) after the loop
Example AQA solution:
DO
  number ← USERINPUT
UNTIL number >= 1 AND number <= 100
OUTPUT number * number
Short Answer 4 marks
The list below is searched using linear search for the value 23.

[14, 7, 23, 55, 31, 8, 40]

(a) How many comparisons are made before 23 is found? [1]
(b) What is the worst-case number of comparisons for this list? [1]
(c) State one advantage of linear search over binary search. [1]
(d) State one disadvantage of linear search for very large lists. [1]
Mark Scheme
  • (a) 3 comparisons (14→No, 7→No, 23→Yes)
  • (b) 7 comparisons (item not in list, or last item)
  • (c) Linear search works on unsorted data / does not require the list to be sorted
  • (d) Linear search is slow for large lists - in the worst case it checks every element / inefficient compared to binary search on sorted data
Short Answer 5 marks
The sorted list below is searched using binary search for the value 41.

[3, 11, 18, 27, 35, 41, 58, 66] (indices 0–7)

Complete the trace table below. The first row has been completed for you.

lowhighmidlist[mid]Action
0732741 > 27, low = 4
Complete remaining rows...
Mark Scheme - Award 1 mark per correct row (up to 4 marks) + 1 for correct outcome
  • Row 1 (given): low=0, high=7, mid=3, list[3]=27, 41>27 → low=4
  • [1] Row 2: low=4, high=7, mid=5, list[5]=41
  • [1] Action: list[5]=41=target → return 5 (found)
  • [1] mid calculated correctly as (4+7) DIV 2 = 5
  • [1] Correct termination - no further rows needed
  • [1] Total: 2 comparisons (rows) to find 41
Short Answer 4 marks
Show the state of the list [9, 3, 7, 1, 5] after each pass of bubble sort. Show all comparisons and swaps made during each pass.
Mark Scheme - 1 mark per correct pass state
  • Pass 1: [3, 7, 1, 5, 9] - swaps: 9↔3, 9↔7, 9↔1, 9↔5. 9 is sorted.
  • Pass 2: [3, 1, 5, 7, 9] - swaps: 7↔1, 7↔5. 7 sorted.
  • Pass 3: [1, 3, 5, 7, 9] - swap: 3↔1. 5 sorted.
  • Pass 4: [1, 3, 5, 7, 9] - no swaps. List sorted. (Early termination triggers)
Multiple Choice 1 mark
In bubble sort, why is a temporary variable (temp) needed when swapping two adjacent elements?
  • A. To count the number of swaps made
  • B. To store one value before it is overwritten, so it is not lost
  • C. To hold the index of the larger element
  • D. It is not needed - values can be directly swapped
Extended Response 6 marks
A school has a database of 80,000 student records stored in alphabetical order by surname. The school wants to add a search feature to find a student quickly by surname.

Discuss which searching algorithm would be most suitable. In your answer you should compare both algorithms and justify your recommendation. [6 marks]
Mark Scheme - Level-of-response marking
Level 3 (5–6 marks): Clear, well-structured comparison of both algorithms with correct technical detail and a justified recommendation.

Level 2 (3–4 marks): Some comparison with partial justification, or correct recommendation with limited explanation.

Level 1 (1–2 marks): Basic identification of algorithms with limited comparison.

Points to award (any 6 from):
  • Binary search should be recommended
  • The data is already sorted alphabetically - binary search's prerequisite is met
  • Binary search eliminates half the remaining records at each step
  • For 80,000 records: binary search needs at most 17 comparisons; linear needs up to 80,000
  • Linear search checks records one at a time from the beginning
  • Linear search works on unsorted data - but since data is sorted, this advantage is irrelevant here
  • Binary search is significantly more efficient for large data sets
  • Any correct quantitative comparison of efficiency
Extended Response 4 marks
Compare merge sort and bubble sort for sorting a large list of 50,000 exam scores. State which is more appropriate and give two reasons. [4 marks]
Mark Scheme
  • [1] Merge sort is more appropriate (must be stated)
  • [1] Merge sort is more efficient for large lists - worst case is n×log₂(n) vs bubble sort's n²
  • [1] Bubble sort would be extremely slow - with 50,000 items the worst case involves billions of comparisons
  • [1] Any other valid comparison: merge sort's consistent performance / bubble sort suitable only for small lists / merge sort is a divide and conquer algorithm
Finished the exam questions? Go back and review any lessons you found difficult.
Back to Algorithms Series