0478/23 · May/June 2023
Download PDFExplain the purpose of the library routines MOD and RANDOM MOD ................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... RANDOM ............................................................................................................................................ .......................................................................................................................................................... .......................................................................................................................................................... ..........................................................................................................................................................
Describe what happens when a function is called during the execution of a program.
Explain why verification checks are used when data is input.
Give two types of verification check and state how each one can be used. Verification check 1 ................................................................................................................... Use ........................................................................................................................................... ................................................................................................................................................... Verification check 2 ................................................................................................................... Use ........................................................................................................................................... ...................................................................................................................................................

Four descriptions of validation checks are shown. Draw one line to link each description to the most appropriate check. Not all checks will be used. Description to check that the data entered is an integer to check that some data has been entered to check that the data entered has an appropriate number of characters to check that an identification number contains no errors Check check digit format check length check presence check type check
Write an algorithm in pseudocode to make sure that an input for the variable Length is between 15 and 35 inclusive. The code must iterate until a valid input has been made and the code must include appropriate messages.
An algorithm has been written in pseudocode to allow 100 positive numbers to be input. The total and the average of the numbers are output. 01 Counter ← 100 02 Total ← 0 03 WHILE Counter > 100 DO 04 INPUT Number 05 IF Number > 0 06 THEN 07 Total ← Total + Counter 08 Counter ← Counter + 1 09 ENDCASE 10 ENDWHILE 11 OUTPUT "The total value of your numbers is ", Total 12 OUTPUT "The average value of your numbers is ", Total / 100
Identify the four errors in the pseudocode and suggest corrections. Error 1 ....................................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 2 ....................................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 3 ....................................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 4 ....................................................................................................................................... Correction .................................................................................................................................. ...................................................................................................................................................
Describe the changes you should make to the corrected algorithm so that a count-controlled loop is used to allow 100 positive numbers to be input. You do not need to rewrite the algorithm.
The flowchart represents an algorithm. An input of –1 will terminate the algorithm.


Complete the trace table for the input data: 5, 50, 52, 555, 57, 500, –1, 5500, 55
Describe the purpose of the algorithm.
Consider the logic expression: Z is 1 if (A = 1 AND C = NOT 1) AND (B = 1 NOR C = 1)
Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two inputs. Do not simplify this logic expression.
Complete the truth table from the given logic expression.
The variable Saying is used to store string data in a program.
Write the pseudocode statement to declare the variable Saying
Write the pseudocode statements to: • allow a string to be input to the variable Saying • store the content of the variable Saying in a text file named "Quotations.txt" • make sure the text file is closed at the end of the algorithm.
A database table called Site1 stores details of some holiday homes at a holiday park. The database shows the type of home, number of guests, whether it is privately owned and the weekly rate to hire it. Name | Type | Private | Rate$ | NumberGuest Bay Lodge | Lodge | NO | 1000 | 10 Bay View | Cabin | NO | 400 | 4 Blue Skies | Cabin | NO | 350 | 4 Cliff View | Cabin | NO | 650 | 6 Coppice Lodge | Lodge | NO | 1200 | 12 Green Lodge | Lodge | NO | 1000 | 8 Henry | Cabin | YES | 300 | 2 Hikers' Rest | Retreat | NO | 750 | 6 Poppy | Cabin | NO | 300 | 2 Summer Joy | Retreat | YES | 750 | 6 Valley View | Cabin | NO | 600 | 6 West Lodge | Lodge | YES | 1200 | 12
State the number of fields and the number of records in this database table. Fields ........................................................................................................................................ Records ....................................................................................................................................
Describe the purpose of a primary key.
The database uses the data types: • alphanumeric • character • Boolean • integer • real • date/time. Complete the table to show the most appropriate data type for each field.
Give the output that would be produced by the structured query language (SQL) statement: SELECT Name, NumberGuest, Rate$ FROM Site1 WHERE NumberGuest >= 10;
A two-dimensional (2D) array Contacts[] is used to store names and telephone numbers. All the data is stored as strings. The array must have the capacity to store 100 contacts in the form of: • column 1 – contact names as: last name, first name for example: Smith, John • column 2 – telephone numbers. The variable CurrentSize shows how many contacts are in the array. Write a program that meets the following requirements: • display a menu of choices: ○ enter new contact details ○ display all the contact details ○ delete all the contact details • validate the menu input • allow up to a maximum of five new contacts to be added to the array at any one time • do not allow more than 100 contacts in total • after new contacts have been added, sort the array by contact name, as long as there are at least two contacts in the array • output the whole of the array • delete the contents of the array. You must use pseudocode or program code and add comments to explain how your code works. You do not need to declare any arrays, variables or constants; you may assume that this has already been done. All inputs and outputs must contain suitable messages. You do not need to initialise the data in the array Contacts[] and the variable CurrentSize






