Data types and structures
223 questions. Open a question to solve it and check the official answer.
Data types and records · 5 marks · official answer ready
(b) Write the pseudocode to define the module headers: Sub_Part1A .................................................................................................................…
Data types and records · 3 marks · official answer ready
(c) The structure chart uses the two symbols shown. Complete the table to explain what each symbol means and how the relevant modules in the structure chart are affected. Symbol E…
Data types and records · 5 marks · official answer ready
11 (a) A medical centre uses objects of the class Appointment to record treatments given and medication prescribed during each doctor’s appointment. Some of the attributes require…
Data types and records · 5 marks · official answer ready
12 The pseudocode algorithm checks whether a location in a stock file StockList.dat is empty or not. The location is given by the user. If the location is empty, a suitable messag…
Data types and records · 2 marks · official answer ready
(i) Write a pseudocode statement to declare GateID to hold the identity codes for the airport gates: ..............................................................................…
Data types and records · 1 mark · official answer ready
(ii) Write the new pseudocode statement required to replace the declaration of Gate in Departure. .................................................................................…
Data types and records · 5 marks · official answer ready
12 (a) A medical clinic uses objects of the class Patient to assign a priority and a doctor to a patient. Some of the attributes required in the class are listed in the table. Att…
Data types and records · 5 marks · official answer ready
13 The pseudocode algorithm below uses random file access to copy 50 records from a live file CurrentResults.dat to a stored file StoredResults.dat one record at a time. It uses t…
Data types and records · 5 marks · official answer ready
11 The pseudocode algorithm below allows a user to input a new stock item. The random file is searched for the next empty location in the file and the new item is inserted there. …
Introduction to abstract data types · 1 mark · official answer ready
12 (a) An array is an Abstract Data Type (ADT). Identify two other ADTs. 1 ........................................................................................................…
Arrays · 4 marks · official answer ready
(b) A 1D array DataArray holds up to 1000 elements of type integer and needs to be sorted in ascending order. Write the pseudocode for an insertion sort to sort the array into asc…
Files · 7 marks · official answer ready
(a) The function ReadData(): • prompts the user to enter a filename and reads this filename from the user • opens the file and reads each line of data into a 1D array • returns th…
Arrays · 6 marks · official answer ready
(b) The procedure SplitData() takes a 1D string array as a parameter with the identifier DataArray The procedure declares six 1D arrays: one array for each colour that appears in …
Arrays · 2 marks · official answer ready
(d) Each of the six colours has a blank text file where the numbers will be stored. The names of these six text files are: • Blue.txt • Green.txt • Orange.txt • Pink.txt • Red.txt…
Files · 3 marks · official answer ready
(i) Write program code for the main program. Save your program. Copy and paste the program code into part 2(e)(i) in the evidence document. [3]
Arrays · 12 marks · official answer ready
(i) Write program code to declare the global arrays HashTable and Spare Save your program. Copy and paste the program code into part 2(b)(i) in the evidence document. [1]
Data types and records · 13 marks · official answer ready
(ii) An empty record has the integer –1 stored in each field. The procedure Initialise() stores an empty record in each element in HashTable and Spare Write program code for Initi…
Data types and records · 16 marks · official answer ready
(e) The text file HashData.txt stores up to 200 rows of data to be stored into the hash table. Each row contains three integer numbers separated by commas. The first number is the…
Arrays · 12 marks · official answer ready
(ii) The main program should call the procedure to initialise the arrays, call the procedure to create the hash table and then call the procedure to output the contents of the arr…
Arrays · 1 mark · official answer ready
(ii) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into part 1(e)(ii) in the evidence document. [1] 4
