Question 2(d) 2025 · October-November · Paper 43 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (d)
Question 1
mark each to max 5
Question 5
- Procedure header (and end where appropriate)
- Opening the file and closing the file (in appropriate place)
- Looping until EOF // looping through each line …
- … read in each value …
- … calling Enqueue() with read in value and store/use return value
- Exception handling with try except and appropriate output with all file access within try
Show text version of question
Question 2
Part (d)
Question 2
The queue is created using the global 1D array Queue. The queue can store up to 100 elements. Each element is initialised to the empty string "" The queue has two pointers that are global to the program: • QueueHead that points to the index of the first element in the queue, initialised to –1 • QueueTail that points to the index of the last element in the queue, initialised to –1 The global variable NumberItems stores the number of elements stored in the queue, initialised to 0
Part (d)
The text file BinaryData.txt stores individual binary digits, '1' and '0'. Each digit is on
a new line. For example, the first line in the text file stores '1', the second line stores '1' The procedure ReadData() reads in each line from the text file BinaryData.txt and inserts it into the queue using the appropriate method. The procedure needs to work for a text file with any number of lines up to a maximum of 100. Write program code for ReadData() Save your program. Copy and paste the program code into part 2(d) in the evidence document.
Why this question appears here
72% assigned-topic match · Programming › Constructs
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9618_w25_qp_43.pdf
