Data types can be defined using pseudocode. The data type, LibraryRecord, is defined in pseudocode as: TYPE LibraryRecord DECLARE Title : STRING DECLARE Fiction : BOOLEAN DECLARE Author : STRING DECLARE NumberOfCopies : INTEGER ENDTYPE A variable, LibraryBook, is declared in pseudocode as: DECLARE LibraryBook : LibraryRecord
- (a)Write pseudocode statements to assign: : A Level Computer Science to Title of LibraryBook FALSE to Fiction of LibraryBook.[2]
- (b)(i)The value for NumberOfCopies must be between 1 and 10 inclusive. Write the updated line of pseudocode from the type definition of LibraryRecord to implement the change.[1]
- (b)(ii)Every copy of every book is now uniquely identified by an accession number, AccessionNumber, as it is added to the library. Each library record will include one or more accession numbers. Each accession number is an integer. Write the extra line of pseudocode needed in the type definition of LibraryRecord.[2]
- (c)A record is a user-defined composite data type. Explain what is meant by a user-defined composite data type. Include an example of another user-defined composite data type in your answer.[3]
Mark scheme
Marking points from the official mark scheme (May/June 2022). The mark or mark type is shown in brackets.
- [2] 1(a) LibraryBook.Title ← "A Level Computer Science" LibraryBook.Fiction ← FALSE
- [1] 1(b)(i) DECLARE NumberOfCopies : 1 .. 10
- [2] 1(b)(ii) DECLARE AccessionNumber : ARRAY[1:NumberOfCopies] OF INTEGER
- [3] 1(c) Any two from • A data type constructed by a programmer // not a primitive data type • A data type that references at least one other data type... • the data types can be primitive, or user defined One mark for an example • Class / object / set
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 →