2210/23/O/N/25 question 9: worked solution (October/November 2025, paper 23)

Show as plain text

Cambridge O Level Computer Science 2210 · 8.1 Programming concepts Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3. Q41 2210/23/O/N/25 original Q9 Structured · 10 marks Worked solution (a) Declare each variable with a suitable type: text, whole number, TRUE or FALSE. DECLARE Name : STRING DECLARE Age : INTEGER DECLARE Found : BOOLEAN DECLARE Name : STRING [1] DECLARE Age : INTEGER [1] DECLARE Found : BOOLEAN [1] (b)(i) Open the file for writing, write the name, then close the file, all inside the procedure. PROCEDURE StoreData(Name : STRING) OPENFILE People.txt FOR WRITE WRITEFILE People.txt, Name CLOSEFILE People.txt ENDPROCEDURE Uses PROCEDURE StoreData and ENDPROCEDURE [1] Parameter defined correctly (Name : STRING) [1] File opened for write [1] Name written to the file with WRITEFILE [1] File closed [1] (b)(ii) Use CALL with the name in quotes. CALL StoreData("Suella") Uses CALL [1] Correct call with the parameter "Suella" [1] KEY IDEA Declare a type for each variable; a procedure that writes to a file must open, write and close it. TOTAL 10 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.