0478/21 · Oct/Nov 2025
Download PDFFour descriptions of structured query language (SQL) keywords and five SQL keywords are given. Draw one line from each description to its matching keyword. Not all SQL keywords will be used.
Identify three different types of test data that can be used to test a program.
A restaurant offers a fixed priced menu. A meal for an adult costs $9.99 and a meal for a child costs $6.99. If there are 6 or more people at a table, a 15% discount is applied to the total cost of the order. Write an algorithm in pseudocode to: • input the number of adults and the number of children at a table • calculate the total cost of the order with the discount, if this applies • output the final cost of the order.
The final cost of the order after the discount may have more than 2 decimal places. Write a pseudocode statement to set the final cost of the order to 2 decimal places. You do not need to rewrite the whole algorithm.
The restaurant offers a discount on a meal if the person ordering is either a student or is 65 years or older. The discount (X = 1) can only be given if the amount of the order is $20.00 or over. Write the logic expression for this problem.
Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two inputs. Do not simplify this logic expression.
Draw the NAND logic gate symbol and complete the truth table for it. NAND logic gate symbol: Truth table:
A hotel booking system is an example of a computer system that is made up of sub-systems. The booking system: • allows the user to select the room type and the number of nights required • displays the types of rooms available to the user as pictures or as a list. Complete the structure diagram for the given parts of the hotel booking system.

A check digit is one method to validate a 5-digit number. The check digit for a 5-digit number is calculated as follows: • Each digit is multiplied by its position (the first digit on the left is in position 1). • The result of each multiplication is totalled. • MOD(Total, 11) is used to calculate the check digit. • If the result of the MOD function is 10, the check digit is ‘X’. For example: The calculation of the check digit for the 5-digit number 30475 is as follows: Multiply each digit by its position and total the results: (3 * 1) + (0 * 2) + (4 * 3) + (7 * 4) + (5 * 5) = 68 Calculate the check digit with MOD(Total, 11) MOD(68, 11) = 2 The check digit for 30475 is 2 This pseudocode algorithm should calculate and output the check digit of a 5-digit number: 01 DECLARE Total : INTEGER 02 DECLARE Digit : INTEGER 03 DECLARE CheckDigit : CHAR 04 Total 0 05 FOR Count 1 TO 10 06 OUTPUT "Please enter digit ", Count 07 INPUT Digit 08 Total Total + (Digit / Count) 09 NEXT Count 10 CheckDigit MOD(Total, 11) 11 IF CheckDigit = 10 12 THEN 13 OUTPUT "The check digit is X" 14 ELSE 15 OUTPUT "The check digit is ", Count 16 ENDIF
Identify the line numbers of the four errors in the pseudocode and suggest a correction for each error.
Explain how you could modify the pseudocode to validate that each input is a single digit. Any code must be fully explained.
The 5-digit number needs to be entered as a single input. Describe one verification method that could be applied to the input of the 5-digit number.
The flowchart represents an algorithm.












Complete the tables, using the flowchart, for the given data: Input data: 20 Input data: 110
State the purpose of the algorithm on page 8. A copy of the algorithm is provided for you on page 11.
State a suitable data type for the variable Count
Write the algorithm in pseudocode. A copy of the algorithm is provided for you on page 11.
A school has set up a database table SchoolTrip to record details of students that will go on a school trip.
State the reason why ParentName is not appropriate as the primary key.
Give the name of the field that should be the primary key.
The database only uses these data types: • text • character • Boolean • integer • real • date/time. Complete the table to show the most appropriate data type for each field. Each data type must be different.
Complete the structured query language (SQL) statement to display only the names of the students who do not have permission to go on the trip. SELECT ..................................................................................................................................... FROM ......................................................................................................................................... WHERE .......................................................................................................................................
A school stores all the students’ attendance data in a file called Attendance.txt Write an algorithm in pseudocode to read a line of text from the file and store this line in the variable StudentAttendance
The variables Seconds and Minutes are used in a program. Seconds holds the number of seconds as a whole number and Minutes holds the number of minutes as a whole number.
Write pseudocode statements to declare the variables Seconds and Minutes
The procedure Time(TotalSeconds) takes the number of seconds as a parameter. The procedure converts the value held in the parameter into minutes and seconds and outputs the result. Write this procedure in pseudocode.
The scores for each competitor in an archery competition are recorded. The one-dimensional (1D) array CompetitorName[] is used to store the names of the competitors. The maximum number of competitors is 30. There are 10 rounds in the competition with a maximum score of 30 per round. The two-dimensional (2D) array CompetitorScore[] stores the score in each of the 10 rounds for each competitor. The first index of the array CompetitorScore[] is the same as the index of the competitor in CompetitorName[] After the 10 rounds have been completed, the highest score and the lowest score for each competitor are discarded. The overall score for each competitor is the total of the remaining 8 scores (after discarding the highest and lowest scores) . A competitor with an overall score of 210 or more moves onto the next competition. A competitor with an overall score between 180 and 209 inclusive becomes a reserve competitor. A competitor with an overall score below 180 does not qualify. Write a program that meets the following requirements: • inputs the total score (out of 30) for each competitor in each round • validates each input is between 0 and 30 inclusive • calculates the overall score for each competitor discarding the highest and lowest scores • outputs the name of each competitor and if they move onto the next competition, are a reserve or do not qualify • calculates and outputs the number of competitors who: ◦ have qualified for the next competition ◦ are reserve competitors ◦ do not qualify. 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 inputs and outputs must contain suitable messages.






