Skip to content
AS & A Level Computer Science 9618 · Topic 9

Algorithm Design and Problem-solving: past paper questions

125 real questionsasked in 9 of the last 9 exam series2021–2025usually: Write, Describe, Complete, Explain, State

Real questions on algorithm design and problem-solving

The newest 20 of 125 written questions. Open one to see it on the real paper.

  1. 9618/13 · October/November 2025 · Q7e[3]

    The table contains three algorithms that perform data validation. The third algorithm uses the functions MID and LENGTH. The functions MID and LENGTH are defined as follows: • MID(ThisString : STRING, x : INTEGER, y : INTEGER) RETURNS STRING returns a string of length y starting at position x from ThisString • LENGTH(T...

    See it on the paper →
  2. 9618/21 · October/November 2025 · Q5a(ii)[1]

    Explain the purpose of the outer conditional clause.

    See it on the paper →
  3. 9618/21 · October/November 2025 · Q5a(iii)[1]

    The inner conditional clause ensures that only the index of the first matching element, if any, is returned. Explain how this clause works.

    See it on the paper →
  4. 9618/21 · October/November 2025 · Q5b(i)[1]

    Explain why this is not the most appropriate loop construct.

    See it on the paper →
  5. 9618/21 · October/November 2025 · Q5b(ii)[2]

    Suggest and justify a more appropriate loop construct that could be used. Construct Justification

    See it on the paper →
  6. 9618/21 · October/November 2025 · Q7a[5]

    One part of the program contains an algorithm which is represented by a state-transition diagram. Current state Input Output Next state S1 A2 X2 S3 S1 A1 X1 S2 S2 A4 X4 S5 S3 A1 S3 A3 X3 S2 S3 A2 X4 S4 S4 A1 X1 S4 S4 A3 S4 A4 The table shows the inputs, outputs and states for the algorithm: S3 S2 S5 X4 Complete the sta...

    See it on the paper →
  7. 9618/23 · October/November 2025 · Q2a[6]

    A program contains a global 1D array of type STRING containing 65 elements. An existing text file is used to store the data in the array. Only non-blank elements (those that do not contain an empty string) are written to the text file. An algorithm will: write the first element of the array as a new line in the text fi...

    See it on the paper →
  8. 9618/23 · October/November 2025 · Q7a[5]

    One part of the program contains an algorithm which is represented by a state-transition diagram. The table shows the inputs, outputs and states for the algorithm: Current state Input Output S1 A1 S2 A2 X4 S3 S3 A1 X1 S3 S3 A2 X1 S3 S3 A3 X3 S4 S3 A4 S4 A3 X4 S5 S4 A4 X4 S5 S4 A1 Next state S2 S2 S2 Complete the state-...

    See it on the paper →
  9. 9618/31 · October/November 2025 · Q9b[3]

    A stack is used to implement recursion. State the three essential features of recursion.

    See it on the paper →
  10. 9618/32 · October/November 2025 · Q8b[3]

    Convert this Reverse Polish Notation (RPN) back to its original infix form: a b - c + c a - * d /

    See it on the paper →
  11. 9618/32 · October/November 2025 · Q8c[4]

    The RPN expression: c a / b d – * b + is to be evaluated, where: a = 3, b = 16, c = 9 and d = 6. Show the changing contents of the stack as the RPN expression is evaluated.

    See it on the paper →
  12. 9618/33 · October/November 2025 · Q8[5]

    Calculate the shortest distance between the Start node and each of the nodes in the graph using Dijkstra’s algorithm. Show your working on the graph or in the working space. Write your answers in the table provided. V 4 9 T X 3 5 W 3 6 10 Y 22 8 Start Z Working Answers: T V W X Y Z

    See it on the paper →
  13. 9618/33 · October/November 2025 · Q11[3]

    Describe when the use of recursion would be beneficial and give an example. Description Example

    See it on the paper →
  14. 9618/21 · May/June 2025 · Q4b[4]

    Complete the trace table by dry running the algorithm. The first row has been completed. I Key J Chars 'D' 'T' 'H' 'R' 2 Chars[J]

    See it on the paper →
  15. 9618/21 · May/June 2025 · Q6b[8]

    Each sensor used in the system has a unique sensor ID number in the range 1 to 50. The program that is used to monitor the speed of each vehicle reads each sensor value every second and stores this value along with the sensor’s unique ID into a global 2D array Reading The global array Reading has been declared as follo...

    See it on the paper →
  16. 9618/22 · May/June 2025 · Q3[8]

    An algorithm is designed to generate and output two unique random integers. Each integer value is between –10 and 10 inclusive. If both integers output are negative, a third random integer between 30 and 35 inclusive will be generated and output. Write pseudocode for this algorithm.

    See it on the paper →
  17. 9618/22 · May/June 2025 · Q4[6]

    An algorithm will: • • • • input 100 integer values, one value at a time store the first value input into the first location of the array Number store the next input value in the next unused location of the array Number output the contents of Number array in the opposite sequence to that in which the values were input....

    See it on the paper →
  18. 9618/33 · May/June 2025 · Q6a[2]

    Describe one reason why scheduling is necessary in process management.

    See it on the paper →
  19. 9618/33 · May/June 2025 · Q6b[4]

    Explain the function of the round robin scheduling routine and give a benefit of this routine. Function Benefit

    See it on the paper →
  20. 9618/33 · May/June 2025 · Q10a[1]

    State the purpose of the A* and Dijkstra’s algorithms.

    See it on the paper →

What examiners said

The standard of answers seen were very variable. See the earlier comment in the General section concerning the interpretation of the question wording ‘a total of all numbers …’. The answers which gained 4 or all 5 marks were describing something happening to a single number. The key wording of the question was ‘steps …. which could be used to produce pseudocode’. The key steps were: • initialis...

— Examiner report, October/November 2023, 9618/21 Q2(a) (Cambridge)

Generally, well understood and answered. Most solutions correctly had a count-controlled loop, but a not uncommon error was the omission of the assignment arrow. Some solutions attempted a length calculation/check on the string parameter which was not required. A correct solution had the return value done either inside the loop when the count condition was met, or outside the loop. A common error...

— Examiner report, October/November 2023, 9618/21 Q4(a) (Cambridge)

There were many variants seen here producing a correct solution. Some candidates used a twoiteration loop to test each of the array values. This was not needed, and a simpler solution used two conditions joined by the AND operator. However, a common syntax structure error was to write this incorrect statement: Search = Data(Row, 1) OR Data(Row, 2) Many candidates used the correct syntax for the...

— Examiner report, October/November 2023, 9618/21 Q4(b) (Cambridge)

Past papers, syllabus and examiner reports © UCLES (Cambridge University Press & Assessment). Questions are matched to topics from the official syllabus. AssessPro is independent and not endorsed by Cambridge.