Skip to main content
A-LevelComputer ScienceProgramming9618/33 · May/June 2025 · Q115 Marks

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 suitable message is displayed if the file is full. Complete this pseudocode. DECLARE Location : INTEGER DECLARE NewStock : STRING DECLARE CurrentStock : STRING DECLARE Stored : BOOLEAN DECLARE Max : INTEGER Max ← 100000 Stored ← FALSE Location ← 1 OUTPUT "Enter the new item you wish to store: " INPUT NewStock WHILE NOT Stored AND Location <= Max GETRECORD "StockList.dat", IF CurrentStock = "" THEN ENDIF ENDWHILE THEN OUTPUT "The new item has not been stored as the file was full." ENDIF CLOSEFILE "StockList.dat"

  1. DECLARE Location : INTEGER DECLARE NewStock : STRING DECLARE CurrentStock : STRING DECLARE Stored : BOOLEAN DECLARE Max : INTEGER Max ← 100000 Stored ← FALSE Location ← 1 OUTPUT "Enter the new item you wish to store: " INPUT NewStock WHILE NOT Stored AND Location <= Max GETRECORD "StockList.dat", IF CurrentStock = "" THEN ENDIF ENDWHILE THEN OUTPUT "The new item has not been stored as the file was full." ENDIF CLOSEFILE "StockList.dat"[5]

Mark scheme

Marking points from the official mark scheme (May/June 2025). The mark or mark type is shown in brackets.

  1. [5] One mark for each correctly completed line
  2. DECLARE Location : INTEGER
  3. DECLARE NewStock : STRING
  4. DECLARE CurrentStock : STRING
  5. DECLARE Stored : BOOLEAN
  6. DECLARE Max : INTEGER
  7. Max ← 100000
  8. Stored ← FALSE
  9. Location ← 1
  10. OPENFILE "StockList.dat" FOR RANDOM
  11. OUTPUT "Enter the new item you wish to store"
  12. INPUT NewStock
  13. WHILE NOT Stored AND Location <= Max
  14. SEEK "StockList.dat", Location
  15. GETRECORD "StockList.dat", CurrentStock
  16. IF CurrentStock = "" THEN
  17. PUTRECORD "StockList.dat", NewStock
  18. Stored ← TRUE
  19. ELSE
  20. Location ← Location + 1
  21. ENDIF
  22. ENDWHILE
  23. IF Stored = FALSE THEN
  24. OUTPUT "The new stock item has not been stored as the file was full"
  25. ENDIF
  26. CLOSEFILE "StockList.dat"

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
Programming, A-Level Computer Science (syllabus 9618). Structured question, 5 marks.
Source
A-Level Computer Science, May/June 2025 Paper 3 Variant 3, question 11.

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