Data types and structures — AS & A Level Computer Science (9618) questions by topic
Data types and structures is the biggest topic on this Computer Science page, with 74 real questions from 2023 to 2025 papers covering linked-list node structures, completing pseudocode that copies and archives file data, and explaining why zero is chosen as a null-pointer value, worth 4 to 29 marks.
Write, state, complete, show and test lead the top command words, and write demands working code or pseudocode that follows the given structure exactly, not a rewritten algorithm. Examiners report specific, repeatable slips such as opening a file without closing it, so submitting written code for instant marking is a direct way to catch that class of error before it costs marks across several questions.
What examiners look for
- A recurring criticism is opening a file to read or write data but never closing it once the routine finishes.
- Examiners note array-sort answers that swap only the index used in the comparison, leaving associated fields such as score or player ID unswapped.
- Reports flag output loops that iterate over every array element regardless of a queue's actual contents, instead of stopping one element before the tail pointer.
- A common error was taking a value to search for as an input rather than as a passed parameter.
- Strong answers correctly declared arrays of the right size and type, checked both conditions before swapping, and used a valid method to know when to stop looping, including appropriate exception handling.
May–June 2025, Paper 21
Stacks and queues are both abstract data types. A stack uses a top-of-stack pointer to indicate the location of the last item added to the stack. A queue uses two pointers: - a…
Answer this question and get it marked →May–June 2025, Paper 22
An algorithm will: - input 100 integer values, one value at a time - store the first value input into the first location of the array Number - store the next input value in the…
Answer this question and get it marked →A program is being developed to implement a customer loyalty scheme for a coffee shop. Each customer has a unique customer ID starting at 10001 with this value increasing by one…
Answer this question and get it marked →May–June 2025, Paper 23
A programmer uses a number of Abstract Data Types (ADT) in the programs that she is developing. A stack using memory locations 400 to 409 is used in one program. The diagram…
Answer this question and get it marked →May–June 2025, Paper 31
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 message…
Answer this question and get it marked →May–June 2025, Paper 32
A linked list of nodes is used to store an ordered list of strings. Each node consists of the data, a left pointer and a right pointer. A node is shown as a three-cell box: [ Left…
Answer this question and get it marked →May–June 2025, Paper 33
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. A…
Answer this question and get it marked →An array is an Abstract Data Type (ADT). Identify two other ADTs. 1 ............................................ 2 ............................................
Answer this question and get it marked →May–June 2025, Paper 41
A program stores positive integers in a circular queue. The queue is stored as a global 1D array of 20 integers with the identifier Queue. Each index is initialised with the data…
Answer this question and get it marked →A program reads data from a text file, splits the data depending on its content and stores the separated data into different files. The text file TheData.txt contains 72 lines of…
Answer this question and get it marked →May–June 2025, Paper 43
A program reads data from a text file and stores it in a queue. The linear queue Queue is stored as a 1D array of up to 50 elements. The queue has the following pointers: -…
Answer this question and get it marked →A program sorts the data in the 1D array DataArray and searches DataArray for specific values. DataArray stores 14 integer values and is declared local to the main program. Write…
Answer this question and get it marked →A program stores data in a linked list that is designed using Object-Oriented Programming (OOP). The class Node stores data about the nodes: Node --- --- TheData : Integer stores…
Answer this question and get it marked →May–June 2024, Paper 21
An algorithm is developed in pseudocode before being coded in a programming language. The following table shows four valid pseudocode assignment statements. Complete the table by…
Answer this question and get it marked →The diagram shows an Abstract Data Type (ADT) representation of a linked list after data items have been added. Describe the linked list immediately after initialisation, before…
Answer this question and get it marked →May–June 2024, Paper 22
Write pseudocode to declare the record structure for type Component.
Answer this question and get it marked →May–June 2024, Paper 23
A program uses a variable ThisIndex as the array index to access a record. Write a pseudocode clause to check whether or not the weight of an individual component is within the…
Answer this question and get it marked →May–June 2024, Paper 31
The set of declarative-language clauses (numbered 01 to 22) describing car features and body styles is given in the shared source material. Sliding doors is a feature that is…
Answer this question and get it marked →May–June 2024, Paper 32
Jane is a client who would like to choose the activity surfing and she has already done sailing. Write additional clauses to represent this information. 25 ............ 26…
Answer this question and get it marked →May–June 2024, Paper 33
Sliding doors is a feature that is available on a minivan but unavailable on a hatchback. Write additional clauses to represent this information. 23…
Answer this question and get it marked →May–June 2024, Paper 41
A program needs to take integer numbers as input, sort the numbers and then search for a specific number. The integer numbers will be stored in the global 1D array, DataStored,…
Answer this question and get it marked →A program reads data from the user and stores the data that is valid in a linear queue. The queue is stored as a global 1D array, QueueData, of string values. The array needs…
Answer this question and get it marked →May–June 2024, Paper 42
The procedure ReadWords(): • takes a file name as a parameter • opens the file and reads in the data • stores the main word in the first element in WordArray • stores each answer…
Answer this question and get it marked →May–June 2024, Paper 43
The integer numbers will be stored in the global 1D array, DataStored, with space for up to 20 integers. The global variable NumberItems stores the quantity of items the array…
Answer this question and get it marked →The main program initialises all the elements in QueueData to a suitable null value, QueueHead to -1 and QueueTail to -1. Write program code for the main program. Save your…
Answer this question and get it marked →October–November 2024, Paper 21
A factory produces food items. The items must be used within a certain number of days after their production date. The number of days is known as the shelf life. It is different…
Answer this question and get it marked →An exam paper has a maximum of 75 marks. One of five pass grades (A to E) is assigned, depending on the mark obtained. The lowest mark for a given grade is known as the grade…
Answer this question and get it marked →October–November 2024, Paper 22
Give the initial values that should be assigned to the two variables. SP ............... OnStack ...............
Answer this question and get it marked →October–November 2024, Paper 23
State why the value 0 has been selected as the null pointer.
Answer this question and get it marked →October–November 2024, Paper 31
A linked list of nodes is used to store the data. Each node consists of a left pointer, the data and a right pointer. −1 is used to represent a null pointer. Complete this linked…
Answer this question and get it marked →October–November 2024, Paper 32
Describe the user-defined data type record.
Answer this question and get it marked →A linked list of nodes is used to store the data. Each node consists of a left pointer, the data and a right pointer. −1 is used to represent a null pointer. Complete this linked…
Answer this question and get it marked →October–November 2024, Paper 33
A linked list of nodes is used to store the data. Each node consists of a left pointer, the data and a right pointer. −1 is used to represent a null pointer. Complete this linked…
Answer this question and get it marked →October–November 2024, Paper 41
A program sorts string data using different sorting methods. One source file is used to answer Question 1. The file is called Data.txt The text file Data.txt stores string data…
Answer this question and get it marked →A linked list stores positive integer data in a 2D array. The first dimension of the array stores the integer data. The second dimension of the array stores the pointer to the…
Answer this question and get it marked →October–November 2024, Paper 42
(a) Write program code to declare the record structure Queue and its fields. If your programming language does not support record structures, a class can be declared instead. If…
Answer this question and get it marked →(a) The data about the players and their scores is stored in a 2D array of strings with the identifier HighScores. The first dimension of the array has seven elements: one for…
Answer this question and get it marked →October–November 2024, Paper 43
The text file Data.txt stores string data items. Each data item is on a new line in the text file. The function ReadData(): - has a local array of strings that can store 45 items…
Answer this question and get it marked →Write program code for the main program to declare and initialise LinkedList, FirstNode and FirstEmpty. Save your program as Question3N24. Copy and paste the program code into…
Answer this question and get it marked →May–June 2023, Paper 21
Customers collect points every time they make a purchase at a store. A program is used to manage the points system and the table lists some of the information stored for one…
Answer this question and get it marked →May–June 2023, Paper 22
A program stores data in a text file. When data is read from the file, it is placed in a queue. The diagram below represents an Abstract Data Type (ADT) implementation of the…
Answer this question and get it marked →May–June 2023, Paper 23
The following pseudocode represents part of the algorithm for a program. Line numbers are for reference only. 10 DECLARE Sheet4 : ARRAY[1:2, 1:50] OF INTEGER ... 100 FOR PCount <-…
Answer this question and get it marked →A program processes data using a stack. The data is copied to a text file before the program ends. The following diagram shows the current state of the stack. The operation of…
Answer this question and get it marked →May–June 2023, Paper 31
The pseudocode algorithm shown copies an active accounts text file ActiveFile.txt to an archive accounts text file ArchiveFile.txt, one line at a time. Any blank lines found in…
Answer this question and get it marked →May–June 2023, Paper 32
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…
Answer this question and get it marked →The pseudocode shown represents a queue Abstract Data Type (ADT) with procedures for initialisation and to add new items. It is incomplete. CONSTANT MaxLength = 50 DECLARE…
Answer this question and get it marked →May–June 2023, Paper 33
The pseudocode algorithm shown copies an active accounts text file ActiveFile.txt to an archive accounts text file ArchiveFile.txt, one line at a time. Any blank lines found in…
Answer this question and get it marked →Write the pseudocode to declare MaxSize, FrontPointer, RearPointer, Length and Queue.
Answer this question and get it marked →May–June 2023, Paper 41
A program reads data from a file and searches for specific data. The main program needs to read 25 integer data items from the text file Data.txt into a local 1D array, DataArray…
Answer this question and get it marked →A program implements two stacks using 1D arrays. One stack stores the names of colours. One stack stores the names of animals. The program contains the following global arrays and…
Answer this question and get it marked →May–June 2023, Paper 42
A business sells a single product. Customers can purchase one or more of this product. Each sale has an ID and a quantity, for example "ABC" and 2 The business needs a program to…
Answer this question and get it marked →May–June 2023, Paper 43
A program reads data from a file and searches for specific data. The main program needs to read 25 integer data items from the text file Data.txt into a local 1D array, DataArray…
Answer this question and get it marked →A program implements two stacks using 1D arrays. One stack stores the names of colours. One stack stores the names of animals. The program contains the following global arrays and…
Answer this question and get it marked →October–November 2023, Paper 21
The stack is implemented using two variables and a 1D array of 8 elements as shown. The variables are used to reference individual elements of the array, in such a way that: - the…
Answer this question and get it marked →October–November 2023, Paper 22
The following identifier table shows some of the data that will be stored for each order. Complete the identifier table by adding meaningful variable names and appropriate data…
Answer this question and get it marked →The linked list is implemented using two variables and two 1D arrays as shown. The pointer variables and the elements of the Pointer array store the indices (index numbers) of…
Answer this question and get it marked →October–November 2023, Paper 23
The following table shows four valid pseudocode assignment statements. Complete the table by giving the data type that should be used to declare the variable underlined in each…
Answer this question and get it marked →Complete the diagram to represent the state of the queue as shown above. (A blank table is provided with Array elements at indices 1 to 8 for the candidate to fill in, together…
Answer this question and get it marked →October–November 2023, Paper 31
A pseudocode algorithm finds a customer account record in a random file and outputs it. The records are stored using the user-defined data type TAccount. TYPE TAccount DECLARE…
Answer this question and get it marked →Write the infix expression for this Reverse Polish Notation (RPN) expression: 5 2 – 5 4 + 9 /
Answer this question and get it marked →Write the pseudocode for the required declarations.
Answer this question and get it marked →Anthony is a student who would like to study history and geography. Write additional clauses to represent this information. 22 .... 23 .... 24 ....
Answer this question and get it marked →October–November 2023, Paper 32
Describe what is meant by composite and non-composite data types. Composite ............ Non-composite ............
Answer this question and get it marked →The Reverse Polish Notation (RPN) expression: a b 2 / c d / is to be evaluated where a = 20, b = 3, c = 10 and d = 5. Show the changing contents of the following stack as the RPN…
Answer this question and get it marked →A stack Abstract Data Type (ADT) is to be implemented using pseudocode, with procedures to initialise it and to push new items onto the stack. A 1D array Stack stores the contents…
Answer this question and get it marked →Carlos is a person who enjoys the hobby of cycling but does not like music. Write additional clauses to represent this information. 20 ............ 21 ............ 22 ............…
Answer this question and get it marked →October–November 2023, Paper 33
Describe sequential and random methods of file organisation.
Answer this question and get it marked →Complete the file handling pseudocode. DECLARE Customer : TAccount DECLARE Location : INTEGER DECLARE AccountFile : STRING ................................................ ←…
Answer this question and get it marked →Write the infix expression for this Reverse Polish Notation (RPN) expression: 5 2 – 5 4 + 9 /
Answer this question and get it marked →Write the pseudocode for the required declarations.
Answer this question and get it marked →Anthony is a student who would like to study history and geography. Write additional clauses to represent this information. 22 ................................................ 23…
Answer this question and get it marked →October–November 2023, Paper 41
Write program code to declare: - Queue — a global array with space to store 50 IDs of type string - HeadPointer — a global variable to point to the first element in the queue,…
Answer this question and get it marked →October–November 2023, Paper 42
One source file is used to answer this question. The file is called StackData.txt. A program stores lower-case letters in two stacks. One stack stores vowels (a, e, i, o, u) and…
Answer this question and get it marked →October–November 2023, Paper 43
Write program code to declare: - Queue — a global array with space to store 50 IDs of type string - HeadPointer — a global variable to point to the first element in the queue,…
Answer this question and get it marked →Other AS & A Level Computer Science topics
- Programming (79)
- Algorithm design and problem-solving (36)
- Information representation (31)
- Communication and internet technologies (29)
- Boolean algebra and logic circuits (29)
- Processor fundamentals (27)
- Software development (27)
- Hardware (18)
- System software (17)
- Security, privacy and integrity of data (13)
- Databases (13)
- Artificial intelligence (13)