A concert venue uses a program to calculate admission prices and store information about ticket sales. A number of arrays are used to store data. The computer is switched off overnight and data has to be input again at the start of each day before any tickets can be sold. This process is very time consuming.
- (a)(i)Explain how the program could use text files to speed up the process.[2]
- (a)(ii)State the characteristic of text files that allow them to be used as explained in part (a)(i).[1]
- (a)(iii)Information about ticket sales will be stored as a booking. The booking requires the following data: • name of person booking • number of people in the group (for example a family ticket or a school party) • event type. Suggest how data relating to each booking may be stored in a text file.[2]
- (b)A procedure Preview() will: • take the name of a text file as a parameter • output a warning message if the file is empty • otherwise output the first five lines from the file (or as many lines as there are in the file if this number is less than five). Write pseudocode for the procedure Preview().[5]
Mark scheme
Marking points from the official mark scheme (May/June 2021). The mark or mark type is shown in brackets.
- [1] Data from the arrays is written to the files at the end of the day / before the program is terminated / computer is switched off
- [1] Data can then be read from the files at the start of the next day and written to / stored in the arrays
- [1] No need to (re-)enter the data manually // only need to enter data once
- [1] The data is retained when the program is terminated / after the computer is switched off // data is stored permanently // non-volatile storage
- [1] Data items are combined to form a single string / saved as a single line in the file
- [1] Data items are separated by a special character // make each data item a fixed length
- ALTERNATIVE:
- [1] Convert all data items / 'number of people' to strings
- [1] Consecutive / each line stores a separate data item
- [1] Procedure heading (including parameter) and ending
- [1] File OPEN and subsequently CLOSE
- [1] Check if file is empty and output a warning message if it is
- [1] Conditional Loop
- [1] Output line (including blank lines) and read next line in a loop
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →