Learn Extracted exam questions A-Level Computer Science 9618 Computer Science June 2025 Question Paper 22
9618 Computer Science June 2025 Question Paper 22
Source PDF on the left, extracted YAML on the right. Compare numbering, marks, options and text.
Refer to the insert for the list of pseudocode functions and operators.
A program is being developed to control the production line in a factory.
A number of different program life cycles are available for the development of a program.
Explain the need for different program development life cycles.
Coding is a stage in a program development life cycle.
State \textbf{one} consideration that would influence the choice of programming language.
The program has been in use for a number of months and adaptive maintenance is required.
Give \textbf{three} reasons why adaptive maintenance may be required.
- \hrulefill
- \hrulefill
- \hrulefill
As well as adaptive maintenance, other types of program maintenance may be needed.
Identify \textbf{one} other type of program maintenance.
Pseudocode has been used to design modules for the program to control the production line.
The table shows \textbf{four} valid pseudocode expressions.
Complete the table by giving the data type of the evaluated expression.
\begin{tabular}{|l|l|} \hline \textbf{Expression} & \textbf{Data type} \ \hline \texttt{RIGHT(MachineCode, 4)} & \ \hline \texttt{Speed * 2.5} & \ \hline \texttt{NOT Status} & \ \hline \texttt{IS_NUM(Check)} & \ \hline \end{tabular}
A global array \texttt{Product} is used as part of the pseudocode design being developed to control the production line. \texttt{Product} is used to store the number of rejected items each day.
The following pseudocode statement is used to assign a value to an element of the array:
\texttt{Product[x, y] <- 23}
The lower and upper bound values are shown in the table:
\begin{tabular}{|c|c|c|} \hline \textbf{Variable} & \textbf{Lower bound} & \textbf{Upper bound} \ \hline \texttt{x} & 0 & 99 \ \hline \texttt{y} & 0 & 9 \ \hline \end{tabular}
State the number of dimensions of \texttt{Product}
State the total number of elements in array \texttt{Product}
Give the pseudocode declaration for the array \texttt{Product}
A program to calculate the pay of employees working for a company is being designed.
Stepwise refinement has been used in the design of the program.
Describe stepwise refinement.
One of the program modules used to calculate employees' weekly bonus pay has been completed. The amount of bonus pay they receive is based on the number of hours worked and the value of sales made as shown in the table.
Bonus pay and value of sales are both in dollars.
\begin{tabular}{|l|l|c|} \hline \textbf{Hours worked} & \textbf{Value of sales} & \textbf{Bonus pay} \ \hline between 1 and 40 inclusive & 2000 or less & 0 \ \hline between 1 and 40 inclusive & above 2000 & 50 \ \hline above 40 & 2000 or less & 10 \ \hline above 40 & above 2000 & 100 \ \hline \end{tabular}
The module is tested using white-box testing.
State \textbf{two} tests, using valid data, that can be used to test different paths through the program.
Test one:
Hours worked \hrulefill Value of sales \hrulefill Bonus pay \hrulefill
Test two:
Hours worked \hrulefill Value of sales \hrulefill Bonus pay \hrulefill
The program to calculate pay uses a number of modules which are each called from different places in the program.
The program is to be tested using stub testing before all the program modules have been completed.
Describe stub testing.
The program has been completed and compiles successfully.
The program is tested using black-box testing.
Identify and describe \textbf{one} type of error that black-box testing could detect.
Type of error \hrulefill
Description
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.
An algorithm will:
\begin{itemize} \item input 100 integer values, one value at a time \item store the first value input into the first location of the array \texttt{Number} \item store the next input value in the next unused location of the array \texttt{Number} \item output the contents of \texttt{Number} array in the opposite sequence to that in which the values were input. \end{itemize}
Complete the program flowchart to represent the algorithm.
Variable declarations are \textbf{not} required.
An automated digital camera system is used to take a sequence of pictures of animals in a garden. During the design of the system, a state-transition diagram is produced.
The table details the states in the automated digital camera system along with the events which cause the states to change.
The system starts in standby mode. The sequence of pictures is taken when in active mode.
\begin{tabular}{|l|l|l|} \hline \textbf{Current state} & \textbf{Event} & \textbf{Next state} \ \hline standby mode & turn on & detect mode \ \hline detect mode & turn off & standby mode \ \hline detect mode & movement detected & active mode \ \hline active mode & 20 seconds elapsed & sequence complete \ \hline active mode & turn off & standby mode \ \hline sequence complete & time saved & detect mode \ \hline \end{tabular}
Complete the state-transition diagram for the automated digital camera system.
At the end of each sequence of pictures, the time is saved as a string in the format \texttt{
\begin{itemize} \item \texttt{HH} represents the hours using two digits \item \texttt{MM} represents the minutes using two digits \item \texttt{SS} represents the seconds using two digits. \end{itemize}
For example:
\begin{itemize} \item \texttt{"081230"} is stored to represent the time 8:12:30, in the morning \item \texttt{"152235"} is stored to represent the time 15:22:35, in the afternoon. \end{itemize}
Each string is stored on a new line in the text file \texttt{TimeTaken.txt}
An algorithm is required to process the content of the text file \texttt{TimeTaken.txt} once it has been transferred to the computer.
For each hour when pictures are taken, output a suitable message showing the hour and the total number of sequences of pictures taken within that hour.
Example outputs:
\begin{alltt} Hour : 15 Total : 32 Hour : 18 Total : 1 \end{alltt}
Write pseudocode for this algorithm.
Assume the text file \texttt{TimeTaken.txt} contains at least one line.
Two arrays \texttt{Data} and \texttt{Pointer} are accessed by the procedure \texttt{Place()}
\texttt{Data} and \texttt{Pointer} are both global arrays of type \texttt{INTEGER}
The contents of these two arrays are shown:
\begin{tabular}{cc|cc} \multicolumn{2}{c}{\textbf{Data}} & \multicolumn{2}{c}{\textbf{Pointer}} \ 1 & \multicolumn{1}{|c|}{1018} & 1 & \multicolumn{1}{|c}{7} \ \cline{2-2} \cline{4-4} 2 & \multicolumn{1}{|c|}{1007} & 2 & \multicolumn{1}{|c}{3} \ \cline{2-2} \cline{4-4} 3 & \multicolumn{1}{|c|}{1010} & 3 & \multicolumn{1}{|c}{1} \ \cline{2-2} \cline{4-4} 4 & \multicolumn{1}{|c|}{1056} & 4 & \multicolumn{1}{|c}{6} \ \cline{2-2} \cline{4-4} 5 & \multicolumn{1}{|c|}{1092} & 5 & \multicolumn{1}{|c}{-1} \ \cline{2-2} \cline{4-4} 6 & \multicolumn{1}{|c|}{1062} & 6 & \multicolumn{1}{|c}{5} \ \cline{2-2} \cline{4-4} 7 & \multicolumn{1}{|c|}{1034} & 7 & \multicolumn{1}{|c}{4} \ \cline{2-2} \cline{4-4} 8 & \multicolumn{1}{|c|}{0} & 8 & \multicolumn{1}{|c}{9} \ \cline{2-2} \cline{4-4} 9 & \multicolumn{1}{|c|}{0} & 9 & \multicolumn{1}{|c}{10} \ \cline{2-2} \cline{4-4} 10 & \multicolumn{1}{|c|}{0} & 10 & \multicolumn{1}{|c}{-1} \ \cline{2-2} \cline{4-4} \end{tabular}
Study the pseudocode:
\begin{alltt} PROCEDURE Place(Value : INTEGER, Start : INTEGER, Unused : INTEGER) DECLARE New, Current, Last : INTEGER CONSTANT NullPointer = -1 New <- Unused Last <- NullPointer Current <- Start WHILE Current <> NullPointer AND Data[Current] < Value Last <- Current Current <- Pointer[Current] ENDWHILE Pointer[New] <- Pointer[Last] Pointer[Last] <- New Data[New] <- Value ENDPROCEDURE \end{alltt}
Complete the trace table below by dry running the procedure \texttt{Place()} when it is called by the statement:
\texttt{CALL Place(1043, 2, 8)}
\begin{tabular}{|c|c|c|c|c|c|} \hline \textbf{Value} & \textbf{Start} & \textbf{Unused} & \textbf{New} & \textbf{Last} & \textbf{Current} \ \hline & & & & & \ \hline & & & & & \ \hline & & & & & \ \hline & & & & & \ \hline & & & & & \ \hline & & & & & \ \hline & & & & & \ \hline & & & & & \ \hline & & & & & \ \hline & & & & & \ \hline \end{tabular}
Complete the diagram showing the contents of the global arrays \texttt{Data} and \texttt{Pointer} after the procedure \texttt{Place()} has run to completion when called as shown in part (a)(i).
\begin{tabular}{rlcrl} \multicolumn{2}{c}{\textbf{Data}} & \quad & \multicolumn{2}{c}{\textbf{Pointer}} \ 1 & \multicolumn{1}{|l|}{1018} & & 1 & \multicolumn{1}{|l|}{\hspace{2em}} \ 2 & \multicolumn{1}{|l|}{1007} & & 2 & \multicolumn{1}{|l|}{} \ 3 & \multicolumn{1}{|l|}{1010} & & 3 & \multicolumn{1}{|l|}{} \ 4 & \multicolumn{1}{|l|}{1056} & & 4 & \multicolumn{1}{|l|}{} \ 5 & \multicolumn{1}{|l|}{1092} & & 5 & \multicolumn{1}{|l|}{} \ 6 & \multicolumn{1}{|l|}{1062} & & 6 & \multicolumn{1}{|l|}{} \ 7 & \multicolumn{1}{|l|}{1034} & & 7 & \multicolumn{1}{|l|}{} \ 8 & \multicolumn{1}{|l|}{} & & 8 & \multicolumn{1}{|l|}{} \ 9 & \multicolumn{1}{|l|}{} & & 9 & \multicolumn{1}{|l|}{} \ 10 & \multicolumn{1}{|l|}{} & & 10 & \multicolumn{1}{|l|}{} \ \end{tabular}
The operation carried out by procedure \texttt{Place()} together with the arrays form part of the implementation of an Abstract Data Type (ADT).
Identify the ADT and state the operation carried out by procedure \texttt{Place()}
A program is being developed to implement a customer loyalty scheme for a coffee shop.
Each customer has a unique customer ID starting at 10001 with this value increasing by one each time a new customer joins the loyalty scheme.
For example, the third customer who joins the loyalty scheme is given the customer ID 10003
The loyalty scheme is limited to 1000 customers.
A customer is awarded a loyalty point every time they buy a coffee.
The programmer has decided to use a global 2D array \texttt{Loyalty} of type \texttt{INTEGER}. The array \texttt{Loyalty} is made up of 1000 rows and 2 columns. Each row relates to one customer; column 1 contains the unique customer ID and column 2 contains the number of customer loyalty points.
Rows in the array \texttt{Loyalty} that are not currently being used have the value of Column 1 set to 99999
The array is sorted in ascending order by customer ID.
The programmer has defined a program module:
\begin{tabular}{|l|l|} \hline \textbf{Module} & \textbf{Description} \ \hline \texttt{FindCustomer()} & \begin{tabular}[t]{@{}l@{}} $\bullet$ called with parameter of type \texttt{INTEGER} representing a customer ID \ $\bullet$ searches the \texttt{Loyalty} array for this customer ID \ $\bullet$ the search will stop as soon as the customer ID is found \ $\bullet$ the search should efficiently deal with the situation when the \ \phantom{$\bullet$} customer ID is \textbf{not} stored in the \texttt{Loyalty} array \ $\bullet$ if the customer ID is found, return an integer value representing the \ \phantom{$\bullet$} loyalty points, otherwise return -1 \end{tabular} \ \hline \end{tabular}
Write efficient pseudocode for module \texttt{FindCustomer()}
A customer can claim a free coffee for every 11 loyalty points.
The programmer has defined a second program module:
\begin{tabular}{|p{4cm}|p{10cm}|} \hline \multicolumn{1}{|c|}{\textbf{Module}} & \multicolumn{1}{c|}{\textbf{Description}} \ \hline \texttt{PointsReport()} & \begin{itemize} \item output the customer ID for each customer who has 11 or more loyalty points \item output the average loyalty points for all customers in the \texttt{Loyalty} array along with an appropriate message \end{itemize} \ \hline \end{tabular}
Write efficient pseudocode for module \texttt{PointsReport()}
Assume the array contains the data for at least \textbf{one} customer.
The programmer decides to amend the customer ID; it will be stored as a \texttt{STRING} instead of an \texttt{INTEGER}. This means that the 2D array \texttt{Loyalty} can no longer be used.
Explain why the 2D array \texttt{Loyalty} can no longer be used.
Explain how a 1D array could be used to store both the loyalty points and the amended customer ID.