A program contains a 1D array DataItem with 100 elements. State the one additional piece of information required before the array can be declared.
- (a)A program contains a 1D array DataItem with 100 elements. State the one additional piece of information required before the array can be declared.[1]
- (b)(i)A programmer decides to implement a queue Abstract Data Type (ADT) in order to store characters received from the keyboard. The queue will need to store at least 10 characters and will be implemented using an array. Describe two operations that are typically required when implementing a queue. State the check that must be carried out before each operation can be completed. Operation 1 Check 1 Operation 2 Check 2[4]
- (b)(ii)Describe the declaration and initialisation of the variables and data structures used to implement the queue.[5]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2022). The mark or mark type is shown in brackets.
- [1] The data type (of the item to be stored)
- [4] Operation: Add an item / Enqueue Check: There are unused elements in the array // The queue is not full Operation: Remove an item / Dequeue Check: There are items in the array // The queue is not empty One mark for reason and one mark for reason it could not be completed.
- [5] One mark per point (Max 5): 1 Declare a (1D) array of size >= 10 2 ...of data type CHAR 3 Declare integer variable for FrontOfQueuePointer 4 Declare integer variable for EndOfQueuePointer 5 Initialise FrontOfQueuePointer and EndOfQueuePointer to represent an empty queue 6 Declare integer variable or NumberInQueue 7 Declare integer variable for SizeOfQueue to count / limit the max number of items allowed // Reference to mechanism for defining 'wrap' of circular queue 8 Initialise SizeOfQueue // Initialise NumberInQueue
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 →