Write pseudocode statements to declare the composite data type, TAppointments, to hold data about patients for a dental clinic. It will include for each patient: • name (first name and last name) • date of birth • telephone number • date of last appointment • date of next appointment • all treatments are complete (yes or no).
- (a)Write pseudocode statements to declare the composite data type, TAppointments, to hold data about patients for a dental clinic. It will include for each patient: • name (first name and last name) • date of birth • telephone number • date of last appointment • date of next appointment • all treatments are complete (yes or no).[4]
- (b)This pseudocode algorithm reads dental records stored in a random file using the user-defined data type TAppointments and prints the contents of the file, one record at a time. Complete this file handling pseudocode: DECLARE DentalRecord : ARRAY[1:250] OF TAppointments DECLARE DentalFile : STRING DECLARE Count : INTEGER DentalFile ← "DentalFile.dat" OUTPUT "The file ", DentalFile, " contains these records:" OPENFILE REPEAT SEEK DentalFile, Count OUTPUT DentalRecord [Count] Count← Count + 1 (DentalFile)[5]
Mark scheme
Marking points from the official mark scheme (May/June 2023). The mark or mark type is shown in brackets.
- [4] One mark for TYPE TAppointments and ENDTYPE correct One mark for every two correct declarations (Max 3) Example answer TYPE TAppointments DECLARE Name : STRING DECLARE DateOfBirth : DATE DECLARE Telephone : STRING DECLARE LastAppointment : DATE DECLARE NextAppointment : DATE DECLARE TreatmentsComplete : BOOLEAN ENDTYPE
- [5] One mark for each correctly completed line (Max 5) DECLARE DentalRecord : ARRAY[1:250] OF TAppointments DECLARE DentalFile : STRING DECLARE Count : INTEGER DentalFile ← "DentalFile.dat" OUTPUT "The file ", DentalFile, " contains these records:" OPENFILE DentalFile FOR RANDOM Count ← 1 REPEAT SEEK DentalFile, Count GETRECORD DentalFile, DentalRecord [Count] OUTPUT DentalRecord [Count] Count ← Count + 1 UNTIL EOF(DentalFile) CLOSEFILE DentalFile
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 →