9618/22 · Oct/Nov 2025
Download PDFRefer to the insert for the list of pseudocode functions and operators.
The table contains pseudocode examples. Each example may contain statements that relate to one or more of: • selection • iteration (repetition) • subroutines (procedures or functions). Complete the table by placing one or more ticks (‘✓’) in each row. Pseudocode example | Selection | Iteration | Subroutine IF Status = FALSE THEN FOR Count ← 1 TO 20 CALL Reset(Count) NEXT Count ENDIF OTHERWISE : Status ← TRUE WHILE AllDone() = TRUE 30 : NextChar ← 'X'
Complete the table by giving the appropriate data type. Variable | Example data value | Data type Result | 5.42 | MonthLetter | "JFMAMJJASOND" | Birthday | 15/11/2009 |
Evaluate each expression in the table by using the data values shown in (b). Write ‘ERROR’ if the expression contains an error. Expression | Evaluates to INT(Result) + 1 > 6 | NUM_TO_STR(LENGTH(MonthLetter)) | NUM_TO_STR(Result + "3.2") | MID(MonthLetter, MONTH(Birthday) - 2, 1) |
Data is a global 1D array containing 20 elements of type REAL An algorithm will: • input a sequence of real values, one at a time • assign each value to consecutive array elements, starting from index 1 • end when the value 99.9 is input, or all 20 elements have been assigned (the value 99.9 must not be stored in the array). Complete the program flowchart to represent the algorithm:


A text file OldFile.txt contains IDs, names and email addresses for members of a club. Three information items are stored for each member and each item is stored on a separate line. The example shows the information for the first two members in the first six lines of the file: Line in file | Information item | Example data 1 | member 1 ID | "AB1234" 2 | member 1 name | "Freddie Jones" 3 | member 1 email address | "FreddieJ909@Cambridge.org" 4 | member 2 ID | "BC2345" 5 | member 2 name | "Sue Smith" 6 | member 2 email address | "Sue1024@Cambridge.org" The member ID string is always two letters followed by four digits. The file design is to be changed so that information for each user is stored as a single line of the file, with the character '\' used as a separator between data items. For example, the single line for member 1 will be: "AB1234\Freddie Jones\FreddieJ909@Cambridge.org" An algorithm will produce a new file NewFile.txt from the contents of OldFile.txt Assume: • LineX, LineY and LineZ are of type STRING and are used to store the three items of information for each member • NewString is a temporary variable of type STRING • OldFile.txt exists and contains valid data.
The algorithm to create the new file is expressed in steps. Complete the following numbered steps: Step 1 : open the file ..................................... in ..................................... Step 2 : open the file ..................................... in ..................................... Step 3 : read a line from ..................................... and store in ..................................... Step 4 : read a line from ..................................... and store in ..................................... Step 5 : read a line from ..................................... and store in ..................................... Step 6 : set NewString to ........................................................................................... Step 7 : write NewString to ..................................... Step 8 : repeat from step ..................................... until ..................................... Step 9 : close both files.
The character '\' has been chosen as a separator. Explain why this is a suitable character.
Two new information items are to be stored for each member. Both new items are encrypted; they can each contain any character (including '\') and can be of any length up to a maximum of 99 characters. For example: Information item | Example data member 1 ID | "AB1234" member 1 name | "Freddie Jones" member 1 email address | "FreddieJ909@Cambridge.org" member 1 new information 1 | "En/98&*(|?\/D7iP" member 1 new information 2 | "23\CoboL" Explain the additional file design changes needed so that: • all the information items for each member are stored on a single line of NewFile.txt • it is possible to extract each information item after the line is read. Assume the '\' character is not used in any email address.
A quiz has nine questions. There are: • five easy questions each worth 3 points • four hard questions each worth 5 points. At the end of the quiz the points for each correctly answered question are added to give a total score. A check is made to test that the total score is valid using a 1D array CheckTotal of type BOOLEAN. Each index value of the array represents a possible total score. The corresponding element value is TRUE if the index value represents a valid total score and FALSE otherwise. The first nine rows of the array are: Index value | Element value | Comment 0 | TRUE | valid total score (no correct answers) 1 | FALSE | invalid total score 2 | FALSE | invalid total score 3 | TRUE | valid total score (one 3-point question correct) 4 | FALSE | invalid total score 5 | TRUE | valid total score (one 5-point question correct) 6 | TRUE | valid total score (two 3-point questions correct) 7 | FALSE | invalid total score 8 | TRUE | valid total score (one 3-point question and one 5-point question correct) For example, a total score of 6 points is valid; the value of the array element at index value 6 is TRUE
Write pseudocode to declare CheckTotal and to set all elements of the array to FALSE All variables used must be declared.
The pseudocode represents an algorithm to set the appropriate elements of the array to TRUE Complete the pseudocode: DECLARE EasyQ, HardQ : INTEGER FOR EasyQ ← ............................ TO 15 STEP ............................ FOR HardQ ← 0 TO ............................ STEP ............................ CheckTotal[.......................................................] ← TRUE NEXT HardQ NEXT EasyQ
The array elements have been assigned the required values. A module ValidateScore() will take an integer value representing a total score as a parameter. It will return TRUE if the total score is valid, or FALSE if it is not valid. Describe the algorithm for ValidateScore() using four steps. Do not use pseudocode in your answer. Step 1 ....................................................................................................................................... ................................................................................................................................................... Step 2 ....................................................................................................................................... ................................................................................................................................................... Step 3 ....................................................................................................................................... ................................................................................................................................................... Step 4 ....................................................................................................................................... ...................................................................................................................................................
A program is developed to satisfy a specific customer requirement. The project follows a program development life cycle model. This model divides the development process into several different stages.
The table lists some of the development activities. Complete the table by writing the name of the life cycle stage for each activity: Activity | Name of life cycle stage a structure chart is produced | a program is modified to allow it to run on new hardware | the programmer identifies the customer’s requirements | an Integrated Development Environment (IDE) provides context-sensitive help such as ‘auto-complete’ |
Alpha and beta testing has been completed. The final testing stage is carried out by the customer. Identify this final testing stage.
A string function Compare() will compare two strings. The function will: • take four parameters: ○ two strings, String1 and String2 ○ a character, Position, to indicate whether String1 will be compared with the start ('s'), or the end ('e') of String2 ○ a Boolean, CaseMatters, to indicate whether an upper case character and lower case character (for example, 'A' and 'a') are regarded as different (TRUE), or as the same (FALSE) • return FALSE if String2 has fewer characters than String1 • return TRUE if the comparison is true, otherwise return FALSE For example: Parameter | Return value String1 | String2 | CaseMatters | Position | "Cat" | "Catalogue" | TRUE | 's' | TRUE "CAT" | "Catalogue" | TRUE | 's' | FALSE "CAT" | "Catalogue" | FALSE | 's' | TRUE "Cat" | "Catalogue" | TRUE | 'e' | FALSE "GUE" | "Catalogue" | FALSE | 'e' | TRUE "Catalogue" | "Cat" | TRUE | 's' | FALSE Write pseudocode for the function Compare()
The structure chart shows part of a program design:

Explain the meaning of the curved arrow symbol in this structure chart.
The program designer has noted that: • Count is the number of elements in an array • T1 is a value representing the number of elements in an array that have been modified • Key is of type STRING Write the pseudocode module headers for analyse, update and sort. Analyse: Update: Sort:
A program is being developed to manage student book loans from a college library. The programmer has defined a record type to define each loan. The data items are: Data item | Data type | Comment StudentID | STRING | the unique ID of the student who has borrowed the book BookID | STRING | the unique ID of the book being borrowed OnLoan | BOOLEAN | TRUE if the book has not been returned The programmer has defined a global array Loan to store 7000 loan records. There are more elements in the array than books in the library. Unused elements have the StudentID set to an empty string. These may occur anywhere in the array. The programmer has defined a program module: Module | Description CountLoans() | • called with a parameter of type STRING representing a StudentID • counts the number of books currently on loan to the specified student • counts the number of books that the student has already returned • output both counts together with a suitable message
Write pseudocode for module CountLoans()
As a reminder, a global array Loan stores 7000 loan records with data items for each loan record: Data item | Data type | Comment StudentID | STRING | the unique ID of the student who has borrowed the book BookID | STRING | the unique ID of the book being borrowed OnLoan | BOOLEAN | TRUE if the book has not been returned A new module is defined: Module | Description NewLoan() | • called with two parameters of type STRING representing a StudentID and a BookID • searches the array for an unused loan record • if found, updates the loan record and returns TRUE, otherwise returns FALSE Write efficient pseudocode for NewLoan()
When a book is returned, the loan record will have its OnLoan data set to FALSE A new procedure Archive() will mark these records as unused after first saving them for future reference. Explain how these records can be saved for future reference.
It is decided to extend the program so that a new module Reminder() will send an email to the student three days before the book is due to be returned. Outline the changes that will need to be made to the data stored and how this data will be used to generate the reminder email. Data Use






