AS Level Computer Science chapter 10: Data types and structures MCQs with answers
By Team Megalecture · Updated 4 Nov 2026
40 exam-style questions on Data types and structures, each with the answer and a short explanation. Ten of them are below to try. The chapter test draws ten fresh questions each time and is marked the moment you finish, with your score by topic.
Introduction to Abstract Data Types (ADT)11 questions
Ten Data types and structures questions with answers
Try each one, then open the answer. These ten stay the same; the test draws new ones every time.
1. Stock is an array of 3 records. Stock[1] has Price 2.0 and Qty 4; Stock[2] has Price 3.5 and Qty 2; Stock[3] has Price 1.0 and Qty 10. What is Value after this code? Value ← 0 FOR i ← 1 TO 3 Value ← Value + Stock[i].Price * Stock[i].Qty NEXT i
A
6.5
B
16
C
15
D
25
Show answer
Answer: D. i = 1: 2.0 × 4 = 8. i = 2: 3.5 × 2 = 7, total 15. i = 3: 1.0 × 10 = 10, total 25. Stopping at 15 misses the last record.
2. Which statement should replace ??? to complete the swap in this bubble sort? FOR Pass ← 1 TO N - 1 FOR i ← 1 TO N - Pass IF List[i] > List[i + 1] THEN Temp ← List[i] List[i] ← List[i + 1] ??? ENDIF NEXT i NEXT Pass
A
List[i] ← Temp
B
Temp ← List[i + 1]
C
List[i + 1] ← List[i]
D
List[i + 1] ← Temp
Show answer
Answer: D. Temp holds the old List[i]; List[i] now has the smaller value, so the old value must go into List[i + 1]. Copying List[i] would duplicate the smaller value.
3. Which statement declares a 2D array for a 3 by 4 grid of characters?
A
DECLARE Grid : ARRAY[1:3][1:4] OF CHAR
B
DECLARE Grid : ARRAY[3, 4] OF CHAR
C
DECLARE Grid[1:3, 1:4] : CHAR
D
DECLARE Grid : ARRAY[1:3, 1:4] OF CHAR
Show answer
Answer: D. Cambridge pseudocode gives both dimensions inside one pair of brackets, each as lower:upper, followed by OF and the type.
4. An empty queue has these operations applied in order: add A, add B, add C, remove, add D, remove. Which item is now at the front?
A
B
B
D
C
A
D
C
Show answer
Answer: D. A, B, C join; A leaves; D joins at the rear (B, C, D); B leaves. C is at the front.
5. A linked list holds names in alphabetical order: Ali → Farah → Zain. How is "Maria" inserted in the correct place?
A
Zain is moved one place along in memory to make space
B
the start pointer is changed so it points to Maria first
C
Ali is set to point to Maria and Maria points to Farah
D
Maria points to Zain, then Farah is set to point to Maria
Show answer
Answer: D. Maria belongs between Farah and Zain. The new node points to Zain, then Farah's pointer is changed to Maria; no data is moved.
6. A linked list is stored in 1D arrays Data[1:20] and Pointer[1:20] with a variable StartPointer. Pointer[i] holds 0 (the null pointer). What does this mean?
A
node i is the first node in the list
B
node i is the last node in the list
C
node i contains the data value 0
D
the list does not contain any nodes
Show answer
Answer: B. Each Pointer entry gives the index of the next node; a null pointer means there is no next node. An empty list is shown by StartPointer being null.
7. An empty stack has these operations applied in order: push 5, push 8, pop, push 3, push 6, pop. Which items are left, from bottom to top?
A
5, 8
B
5, 3
C
3, 6
D
8, 6
Show answer
Answer: B. [5] → [5, 8] → pop 8 → [5] → [5, 3] → [5, 3, 6] → pop 6 → [5, 3]. The answer 3, 6 is what a queue would give.
8. An array holds 5, 1, 4, 2, 8. What is the order after the first pass of a bubble sort into ascending order?
A
1, 2, 4, 5, 8
B
1, 5, 4, 2, 8
C
1, 4, 2, 5, 8
D
1, 4, 5, 2, 8
Show answer
Answer: C. Compare neighbours left to right: 5 and 1 swap, 5 and 4 swap, 5 and 2 swap, 5 and 8 stay. Result 1, 4, 2, 5, 8: the largest value has moved to the end.
9. A stack is stored in an array Stack[1:10] with a variable TopPointer, which is 0 when the stack is empty. Which condition must be checked before pushing an item?
A
TopPointer > 0
B
TopPointer = 1
C
TopPointer < 10
D
Stack[TopPointer] = 0
Show answer
Answer: C. A push is only possible if the stack is not full, that is TopPointer < 10. TopPointer > 0 is the check that the stack is not empty, needed before a pop.
10. Which data type is most suitable for a variable holding a student's date of birth?
A
STRING
B
INTEGER
C
DATE
D
REAL
Show answer
Answer: C. The DATE type stores a calendar date, so dates can be compared and used in calculations such as working out an age.
How many Data types and structures MCQs are there?
40, each with the answer and a short explanation, across 4 topics: Data types and records, Arrays, Files, Introduction to Abstract Data Types (ADT). Every chapter test draws ten of them, so you can take it many times.
Is the AS Level Computer Science chapter 10 test free?
Yes. The test, the answers and the explanations are free and need no sign-up. Sign in only if you want your scores kept across devices.
How is the chapter test marked?
The moment you press Finish: your score, the right answer and an explanation for every question, and the ones you got wrong saved in My mistakes to retry.