0478/23 · Oct/Nov 2025
Download PDFGive three ways of creating a maintainable program. 1 ....................................................................................................................................................... 2 ....................................................................................................................................................... 3 .......................................................................................................................................................
Four descriptions of programming techniques and five programming techniques are given. Draw one line from each description to the relevant technique. Not all techniques will be used. Description adding up a set of numbers displaying the result of a calculation executing a set of instructions based on a condition executing the same set of instructions multiple times Programming technique output selection totalling iteration counting
Tickets for a theme park are booked online. An adult ticket costs $12.99 and a child ticket costs $7.99. A booking fee of $1.99 is added to the total cost of each booking. Write an algorithm in pseudocode to: • input the number of adult tickets for a booking • input the number of child tickets for a booking • calculate and output the total cost of the booking using an appropriate message.
Each booking must have at least one adult ticket. Explain how the algorithm could be changed to repeatedly ask for the number of adult tickets if the number input is less than 1. Any code used must be fully explained.
The theme park has rules for a person to be able to go on a ride. A person can go on a ride (X = 1) only if they: • are 1.4 metres tall or over • are 12 years old or over • do not have a medical condition. Input | Description | Binary value A | under 1.4 metres | 0 | 1.4 metres or over | 1 B | under 12 years old | 0 | 12 years old or over | 1 C | does not have a medical condition | 0 | has a medical condition | 1 Write the logic expression for this problem. X =
Complete the truth table for this problem. A | B | C | Working space | X 0 | 0 | 0 | | 0 | 0 | 1 | | 0 | 1 | 0 | | 0 | 1 | 1 | | 1 | 0 | 0 | | 1 | 0 | 1 | | 1 | 1 | 0 | | 1 | 1 | 1 | |
A program has been written in pseudocode to input five numbers between 1 and 900 inclusive and store the highest number and the lowest number entered. 01 Lowest ← 900 02 Highest ← 1 03 FOR Count ← 1 TO 5 04 INPUT Number 05 IF Number < Lowest 06 THEN 07 Lowest ← Number 08 ELSE 09 IF Number > Highest 10 THEN 11 Highest ← Number 12 ENDIF 13 ENDIF 14 NEXT Count
Complete the trace table for the algorithm using the following numbers: 563, 21, 376, 99, 400
The algorithm does not work correctly. State the reason why the algorithm does not work as expected and explain how the algorithm could be corrected. Any code used must be fully explained. Reason ..................................................................................................................................... ................................................................................................................................................... Correction ................................................................................................................................. ...................................................................................................................................................
The flowchart represents an algorithm.






The algorithm uses the one-dimensional (1D) array ClassList that contains the following data: ClassList 1 | 2 | 3 | 4 | 5 Henil | Sven | Ella | Asia | Ridwan Complete the table by writing the output from the flowchart when each of the given names are input. Name | OUTPUT Ridwan | Yan | Ella |
Identify the standard method of solution used by the flowchart.
Write the algorithm in pseudocode.
An algorithm has been written in pseudocode to: • input a whole number between 1 and 255 inclusive • convert the input to an 8-bit binary number • store each bit of the binary number in an array. For example, if the denary number 127 was input, the binary number 01111111 would be stored in the array. 01 DECLARE BinaryArray : ARRAY[1:8] OF INTEGER 02 DECLARE DenaryNumber : CHAR 03 OUTPUT "Please enter a whole number between 1 and 255 inclusive " 04 INPUT DenaryNumber 05 FOR Count ← 7 TO 1 STEP -1 06 BinaryArray[Count] ← MOD(DenaryNumber,3) 07 DenaryNumber ← DIV(DenaryNumber,2) 08 NEXT Count
Identify the line numbers of the three errors in the pseudocode and suggest a correction for each error. Error 1 line number ................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 2 line number ................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 3 line number ................................... Correction ................................................................................................................................. ...................................................................................................................................................
Identify one programming technique used in the algorithm.
The algorithm can accept a number between 1 and 255 inclusive as input. Two validation checks that could be applied to DenaryNumber are a presence check and a type check. Identify one other validation check that could be applied to DenaryNumber
Write the pseudocode to implement the validation check you identified in (c)(i). You do not need to rewrite the whole algorithm.
A school has set up a database table EquipmentLoan to record details of school equipment loaned to students. EquipmentID | Description | Name | DateLoaned | Returned Cam01 | Digital camera | James | 23/04/2025 | No Cam04 | Digital camera | Amir | 12/03/2025 | Yes Gra02 | Graphics tablet | Nikita | 27/04/2025 | No Tab01 | Tablet | Holly | 18/03/2025 | Yes Ext01 | External Hard drive | Hussein | 27/04/2025 | Yes Cam02 | Digital camera | Emily | 10/04/2025 | Yes Tri01 | Tripod | Emily | 10/04/2025 | Yes
Give the name of the field that is most appropriate to be the primary key.
State the reason for choosing this field for the primary key.
Complete the structured query language (SQL) statement to list equipment not returned. The list must contain only the descriptions and student names. SELECT ..................................................................................................................................... FROM ......................................................................................................................................... WHERE ..................................................................................................................................... ;
The variables Name, Age and Found are used in a computer program. Name holds the name of a person. Age holds the age of a person as a whole number. Found holds a flag that can be set to TRUE or FALSE
Write pseudocode statements to declare the variables Name, Age and Found
The procedure StoreData(Name) stores the name of a person in the file People.txt Write pseudocode statements to: • define the procedure with the parameter • store the name of the person in the file.
Write the pseudocode that uses the procedure StoreData() to store the name ‘Suella’ in the file People.txt
A number game has two players. Random whole numbers are generated for each player. The numbers are compared and players are given points based on the result of the comparison. The two-dimensional (2D) array NumberGenerated[] stores each number generated for each player. The first dimension stores the player number and the second dimension stores the random whole numbers generated. The game is played as follows: • 100 random whole numbers between 1 and 6 inclusive are generated for player 1 and stored in the array. • 100 random whole numbers between 1 and 6 inclusive are generated for player 2 and stored in the array. • The first number generated for each player is compared and the player with the higher number is awarded 2 points. If the two numbers are the same, both players are awarded 1 point each. • The comparisons repeat for all 100 numbers generated. • The player with the higher total number of points is output as the winner. • If the players have the same total number of points, a new random whole number is generated for each player and compared. This is repeated until one player has a higher number than the other player. 2 points are added to that player’s total number of points, making this player the winner. Write a program that meets the following requirements: • input and validate the names of the two players • generate 100 random whole numbers between 1 and 6 inclusive for each player and store them in the array NumberGenerated[] • calculate and store the total number of points for each player • output the name and total number of points for each player in descending order of total number of points. You must use pseudocode or program code and add comments to explain how your code works. You do not need to declare any arrays or variables; assume that this has already been done. All outputs must contain suitable messages.






