Algorithm design and problem-solving — AS & A Level Computer Science (9618) questions by topic

Completing a trace table by dry-running a given procedure, calculating hash values with a modulus function, and stating the precondition an array must satisfy before a binary search will work are the sort of tasks set here, spanning 36 real questions from 2023 to 2025 papers and marks from 5 to 12.

Complete, identify, state, explain and describe are the top command words, and complete on a trace table means filling in every column exactly as the algorithm executes, including intermediate values, not just the final result. Because a single slip early in a trace propagates through later rows, drafting the full trace and checking it against instant marking catches that kind of cascading error immediately.

May–June 2025, Paper 21

Question 1 · 12 marks

A program is being developed to help the manager of a shop control the stock. An identifier table has been used during the design stage. Complete the identifier table: Example…

Answer this question and get it marked →
Question 2 · 10 marks

A program is being developed to calculate the pay of employees working for a company. A function CalculateBonus() calculates bonus pay based on the value of sales. Bonus pay is…

Answer this question and get it marked →
Question 3 · 8 marks

A student has been asked to create a simple guessing game program. This program will generate a random integer value between 1 and 100. It will then repeatedly prompt the user to…

Answer this question and get it marked →
Question 4 · 8 marks

Study the algorithm: DECLARE Chars : ARRAY[1:4] OF CHAR DECLARE I, J : INTEGER DECLARE Key : CHAR I ← 2 Chars[1] ← 'D' Chars[2] ← 'T' Chars[3] ← 'H' Chars[4] ← 'R' WHILE I <= 4…

Answer this question and get it marked →

May–June 2025, Paper 31

Question 4 · 7 marks

A linked list of nodes is used to store an ordered list of integers. Each node consists of the data, a left pointer and a right pointer, for example a node showing a left pointer,…

Answer this question and get it marked →

May–June 2025, Paper 33

Question 10 · 6 marks

State the purpose of the A and Dijkstra's algorithms.

Answer this question and get it marked →

May–June 2024, Paper 21

Question 2 · 7 marks

An algorithm has three steps. It will: 1. repeatedly input a pair of numeric values A and B 2. count the number of pairs that are input until A has been greater than B 10 times 3.…

Answer this question and get it marked →
Question 4 · 6 marks

A global 1D array Data contains 100 elements of type integer. A function Check() will: - total the element values in odd index locations (1, 3, 5 ... 97, 99) - total the element…

Answer this question and get it marked →
Question 5 · 8 marks

Complete the trace table by dry running the procedure when it is called as follows: CALL Process("X3Y2W4") The trace table has the following column headings and is otherwise…

Answer this question and get it marked →
Question 6 · 8 marks

A function IsRA() will: - take three sets of integers as parameters representing the coordinates of the three endpoints that form a triangle - return TRUE if the endpoints form a…

Answer this question and get it marked →

May–June 2024, Paper 22

Question 1 · 10 marks

The following table contains pseudocode examples. Each example may contain statements that relate to one or more of the following: - selection - iteration (repetition) -…

Answer this question and get it marked →
Question 2 · 10 marks

A program is being developed. An algorithm for part of the program will: - input three numeric values and assign them to identifiers Num1, Num2 and Num3 - assign the largest value…

Answer this question and get it marked →
Question 4 · 5 marks

A triangle has sides of length A, B and C. In the given example, A is the length of the longest side (the triangle is drawn with side A along the bottom, side B on the left and…

Answer this question and get it marked →
Question 6 · 10 marks

A music player stores music in a digital form and has a display which shows the track being played. Up to 16 characters can be displayed. Track titles longer than 16 characters…

Answer this question and get it marked →

May–June 2024, Paper 23

Question 1 · 9 marks

A program uses many complex algorithms. One algorithm is repeated in several places. The code for the algorithm is the same wherever it is used, but the calculations within the…

Answer this question and get it marked →
Question 2 · 7 marks

A program uses a global 1D array of type string and a text file. An algorithm that forms part of the program is expressed as follows: - copy the first line from the file into the…

Answer this question and get it marked →
Question 5 · 6 marks

The design of the procedure does not use the most appropriate loop construct. Suggest a more appropriate construct that could be used and explain your choice. Construct ...…

Answer this question and get it marked →
Question 7 · 9 marks

Identify the modules that would be implemented as functions.

Answer this question and get it marked →

May–June 2024, Paper 31

Question 10 · 8 marks

State a condition that must be true for an array to be searchable for a binary search.

Answer this question and get it marked →

May–June 2024, Paper 32

Question 8 · 8 marks

Complete the pseudocode to find an item in a 1D array Widgets of type STRING, using a linear search. DECLARE Widgets : ARRAY[1:50000] OF STRING DECLARE TopOfList : INTEGER DECLARE…

Answer this question and get it marked →

May–June 2024, Paper 33

Question 10 · 8 marks

State a condition that must be true for an array to be searchable for a binary search.

Answer this question and get it marked →

October–November 2024, Paper 21

Question 2 · 6 marks

A program uses three global integer variables HH, MM and SS to represent the current time in hours, minutes and seconds using the 24-hour clock notation. Midnight would be…

Answer this question and get it marked →
Question 3 · 9 marks

An algorithm will output the last three lines from a text file Result.txt. The lines need to be output in the same order as they appear in the file. Assume: • Three variables…

Answer this question and get it marked →

October–November 2024, Paper 22

Question 7 · 10 marks

Identify three items of customer information that will be used by the new module and justify your choices. Item 1 ............... Justification ............... Item 2…

Answer this question and get it marked →

May–June 2023, Paper 21

Question 2 · 7 marks

A program contains an algorithm to output a string of a specified length containing identical characters. The algorithm is described as follows: 1. prompt and input a character…

Answer this question and get it marked →
Question 7 · 8 marks

A school has a computerised library system that allows students to borrow books for a fixed length of time. The system uses text files to store details of students, books and…

Answer this question and get it marked →

May–June 2023, Paper 31

Question 11 · 11 marks

Write the pseudocode to declare MaxSize, FrontPointer, RearPointer, Length and Queue.

Answer this question and get it marked →

May–June 2023, Paper 33

Question 3 · 6 marks

A hashing algorithm is used to calculate storage locations for records in a random access file. It calculates hash values by using the function modulus 3. The function modulus…

Answer this question and get it marked →

October–November 2023, Paper 21

Question 1 · 11 marks

Complete the table by writing the answer for each row: Answer --- --- The value assigned to Level when ThisValue is 40 The value assigned to Check when ThisValue is 36 The value…

Answer this question and get it marked →
Question 2 · 7 marks

An algorithm is expressed as follows: - input 100 numbers, one at a time - keep a total of all numbers input that have a value between 30 and 70 inclusive and output this total…

Answer this question and get it marked →
Question 7 · 5 marks

An algorithm is represented by a state-transition diagram. The table shows the inputs, outputs and states for the algorithm: Current state Input Output Next state --- --- --- ---…

Answer this question and get it marked →

October–November 2023, Paper 22

Question 2 · 7 marks

Draw a program flowchart to represent the algorithm.

Answer this question and get it marked →
Question 5 · 6 marks

A global 1D array of integers contains four elements, which are assigned values as shown: Mix[1] ← 1 Mix[2] ← 3 Mix[3] ← 4 Mix[4] ← 2 A procedure Process() manipulates the values…

Answer this question and get it marked →

October–November 2023, Paper 23

Question 2 · 9 marks

An algorithm will output the index of the element with the smallest value. Draw a program flowchart to represent the algorithm. (A blank flowchart area is provided, pre-printed…

Answer this question and get it marked →
Question 5 · 6 marks

A global 1D array of integers contains four elements, which are assigned values as shown: Mix[1] ← 4 Mix[2] ← 2 Mix[3] ← 3 Mix[4] ← 5 A procedure Process() manipulates the values…

Answer this question and get it marked →

October–November 2023, Paper 32

Question 8 · 5 marks

Calculate the shortest distance between the Start and each of the destinations in the diagram using Dijkstra's algorithm. Show your working and write your answers in the table…

Answer this question and get it marked →

Other AS & A Level Computer Science topics

← All AS & A Level Computer Science (9618) past papers