0478/21 · Oct/Nov 2023
Download PDFFour descriptions of data and five data types are shown. Draw one line to link each description to the most appropriate data type. Not all data types will be used. Description: - a whole number - a single letter - a word or phrase - a number with two decimal places Data type: - BOOLEAN - CHAR - INTEGER - REAL - STRING
Circle the three words representing places where data may be stored. array constant dimension input output procedure variable
The first stage of the program development life cycle is analysis. Two of the tasks in analysis are abstraction and decomposition.
Describe what is meant by abstraction.
Identify three of the component parts when a problem has been decomposed at the analysis stage. 1 2 3
Identify and describe one other stage of the program development life cycle.
An algorithm has been written in pseudocode. 01 DECLARE A[1:10] : STRING 02 DECLARE T : STRING 03 DECLARE C, L : INTEGER 04 L ← 10 05 FOR C ← 1 TO L 06 OUTPUT "Please enter name " 07 INPUT A[C] 08 NEXT C 09 FOR C ← 1 TO L 10 FOR L ← 1 TO 9 11 IF A[L] > A[L + 1] 12 THEN 13 T ← A[L] 14 A[L] ← A[L + 1] 15 A[L + 1] ← T 16 ENDIF 17 NEXT L 18 NEXT C 19 FOR C ← 1 TO L 20 OUTPUT "Name ", C, " is ", A[C] 21 NEXT C

State the purpose of this pseudocode algorithm.
State four processes in this algorithm. 1 2 3 4
Meaningful identifiers have not been used in this algorithm. Suggest suitable meaningful identifiers for: The array: A The variables: T C L
State two other ways the algorithm can be made easier to understand and maintain. 1 2
Consider this logic circuit.
Write a logic expression for this logic circuit. Do not attempt to simplify this logic expression. X =
Complete the truth table from the given logic circuit.
A programmer is designing an algorithm to calculate the cost of a length of rope. The program requirements are: • input two values: the length of rope in metres Length and the cost of one metre Cost • perform a validation check on the length to ensure that the value is between 0.5 and 6.0 inclusive • calculate the price Price • output the price rounded to two decimal places. Use the variable names given.


State the name of the validation check.
Complete the flowchart for this algorithm.
Give two different sets of test data for this algorithm and state the purpose of each set. Set 1 Purpose Set 2 Purpose
Complete the headings for the trace table to show a dry-run for this algorithm. You do not need to trace the algorithm.
Describe an improvement that should be made to the requirements for this algorithm.
A model shop wants to set up a database to help with stock control of the model figures available for sale. The shop wants to store this information about the model figures: Field 1 – catalogue number, for example MD1234 Field 2 – description, for example ‘small white dog’ Field 3 – number in stock, for example 5 Field 4 – the price of each model, for example 7.40 Field 5 – if the model has already been painted, yes or no.
The shop needs five fields for each record. Give a suitable name and data type for each field. Field 1 name Data type Field 2 name Data type Field 3 name Data type Field 4 name Data type Field 5 name Data type
Give the name of the field that should be used for the primary key.
State why this field is used as the primary key.
Structured query language (SQL) is used to query data stored in this database. State what these SQL commands are used for. SELECT FROM WHERE
Drama students put on a performance of a play for one evening. Seats in a small theatre can be booked for this performance. The theatre has 10 rows of 20 seats. The status of the seat bookings for the evening is held in the two-dimensional (2D) Boolean array Evening[] Each element contains FALSE if the seat is available and TRUE if the seat is booked. Up to and including four seats can be booked at one time. Seats are allocated in order from those available. A row or seat number cannot be requested. The array Evening[] has already been set up and some data stored. Write a program that meets the following requirements: • counts and outputs the number of seats already booked for the evening • allows the user to input the number of seats required • validates the input • checks if enough seats are available: – if they are available ○ changes the status of the seats ○ outputs the row number and seat number for each seat booked – if they are not available: ○ outputs a message giving the number of seats left or ‘House full’ if the theatre is fully booked. 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; you may assume that this has already been done. You do not need to initialise the data in the array Evening[] All inputs and outputs must contain suitable messages.






