Past-paper question · 2025 October-November · Paper 41 · Q1(e)

Question 1(e) 2025 · October-November · Paper 41 · 4 marks

Original past-paper question for 1(E)
Original past-paper question for 1(E)
Original past-paper question for 1(E)
Reveal official mark-scheme answer Official mark-scheme answer for 1(E)

Official answer for Question 1

Part (e)

Question 1

mark each

Question 4

  • Procedure header (and end) and output of highest and lowest include appropriate messages
  • Calls Pop() until there are no items left in stack (return value = –999 // TopOfStack = -1) and
✓
storing/using return values
  • Finds and outputs highest value from returned values
  • Finds and outputs lowest value from returned values
✓
Example program code
✓
Java
✓
public static void FindValues(){
✓
Integer Highest;
✓
Integer Lowest;
✓
Highest = Pop();
✓
Lowest = Highest;
✓
Integer ReturnValue = Highest;
✓
while(ReturnValue != -999){
✓
if(ReturnValue > Highest){
✓
Highest = ReturnValue;
✓
}
✓
if(ReturnValue < Lowest){
✓
Lowest = ReturnValue;
✓
}
✓
ReturnValue = Pop();
✓
}
✓
System.out.println("The highest value is " + Highest + " and the lowest value is " +
✓
Lowest);
✓
}
✓
9618/41
✓
Cambridge International AS & A Level – Mark Scheme
✓
October/November 2025
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_w25_ms_41.pdf →

Show text version of question

Question 1

Part (e)

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 (e)

The procedure FindValues():

  • pops each integer from the stack until the stack is empty
  • finds and outputs the largest number that was in the stack in an appropriate message
  • finds and outputs the smallest number that was in the stack in an appropriate message.

Write program code for FindValues()

Save your program.

Copy and paste the program code into part 1(e) in the evidence document.

[4]
Topic relevance

Why this question appears here

82% 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

Keep practising this topic