Question 1(d) 2025 · October-November · Paper 41 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (d)
Question 1
mark each
Question 4
- Looping 40 times
- Generating random number between 0 and 1000 inclusive inside the loop
- Calling Push() with each random number and storing/using return value … … if return value is FALSE output Stack
Show text version of question
Question 1
Part (d)
Question 1
A program stores integers in a stack. The stack is represented as a 1D array of 30 elements with
the identifier Stack
The global pointer TopOfStack stores the index of the last element inserted into the stack. TopOfStack is initialised to –1
Part (d)
The main program generates 40 random integers between 0 and 1000 (inclusive) and attempts
to insert each one into the stack using the appropriate function. If the return value from the function call indicates the stack is full, no more integers are generated and "Stack full" is output.
Write program code for the main program.
Save your program.
Copy and paste the program code into part 1(d) in the evidence document.
Why this question appears here
71% 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_41.pdf
