Skip to main content
A-LevelComputer ScienceData types and structures9618/32 · Oct/Nov 2023 · Q913 Marks

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 of the stack.

  1. (a)(i)Study the pseudocode in part (a)(ii) and complete the table of identifiers by writing the missing data types and descriptions. [Figure X.X][2]
  2. (a)(ii)Complete the pseudocode. CONSTANT MaxSize = 40 DECLARE BasePointer : INTEGER DECLARE TopPointer : INTEGER DECLARE Stack : ARRAY[1:40] OF REAL // initialisation of stack PROCEDURE Initialise() ENDPROCEDURE 1 0 // push an item onto the stack PROCEDURE Push(NewItem : REAL) MaxSize THEN Stack [TopPointer] ENDIF ENDPROCEDURE[5]
  3. (b)Justify the use of a linked list instead of an array to implement a stack.[2]
  4. (c)Explain how a compiler makes use of a stack when translating recursive programming code.[4]

This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.

  1. [1] BasePointer: INTEGER, Points to the bottom of the stack
  2. [1] TopPointer: INTEGER, Points to the top of the stack
  3. [1] Stack: REAL, List of decimal numbers stored in the stack
  4. [1] BasePointer ← 1
  5. [1] TopPointer ← 0
  6. [1] IF TopPointer < MaxSize THEN
  7. [1] TopPointer ← TopPointer + 1
  8. [1] Stack[TopPointer] ← NewItem
  9. [1] A linked list is a dynamic data structure / not restricted in size
  10. [1] Has greater freedom to expand or contract by adding or removing nodes as necessary
  11. [1] Allows more efficient editing using pointers (instead of moving the data).
  12. [1] An array is a static data structure1 generally fixed in size
  13. [1] When the array is full, the stack cannot be extended any further.
  14. [1] The compiler must produce object code to
  15. [1] ...push return addresses / values of local variables onto a stack
  16. [1] ...with each recursive call // ... to set up winding
  17. [1] ...pop return addresses / values of local variables off the stack ...
  18. [1] ...after the base case is reached // ... to implement unwinding.

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 →

About this question

Topic
Data types and structures, A-Level Computer Science (syllabus 9618). Structured question, 13 marks.
Source
A-Level Computer Science, Oct/Nov 2023 Paper 3 Variant 2, question 9.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep