Skip to main content

Programming (exam style) Questions on Standard Algorithms

Downloaded: 91

Last edit: 25 April 2022

Resource Type Worksheets and Activities, Planning Assessments and Guidance
Key Stage 14-16 years (KS4), 16-18 Years (KS5)
Curriculum Topic Algorithmic Thinking, Programming
Awarding Bodies AQA, OCR, Pearson / Edexcel

Students are provided a scenario with four parallel arrays where each array stores the air pressure of a car tyre (front left, back right etc).

Each Question asks students to write code to solve a stated problem. Answers require that students write:

  • find maximum - code that finds the largest value in an array
  • find minimum - code that finds the smallest value in an array
  • linear search - code that traverses an array looking for values
  • count occurrence - code that count the number of times values are found in an array.

The questions get progressively harder.

Although many programming languages contain functions to carry out some or all of the above, knowing how to code these algorithms aids code understanding and gives students the ability to write alternative versions of each algorithm.

Marking Instructions and a completed Python program with the solutions are supplied.

The questions are suitable for any programming language your students may be familiar with. The marking instructions could be adapted for solutions in different languages.

These could also be turned into practical tasks by providing a partial program that sets up the data in the arrays.

Edit history

Greg Reid | 25.04.22

Updated 25th April 2020 as there were a couple of Copy & Paste errors in the marking instructions where the function return hadn't been updated from previous questions.

Greg Reid | 21.04.22

Initial creation