Past-paper question · 2021 May-June · Paper 43 · Q7(b)

Question 7(b) 2021 · May-June · Paper 43 · 3 marks

Original past-paper question for 7(B)
Original past-paper question for 7(B)
Original past-paper question for 7(B)
Reveal official mark-scheme answer Official mark-scheme answer for 7(B)

Official answer for Question 7

Part (b)

Question 1

mark per bullet point

Question 3

  • Function header (and end taking array and pointer by reference) and checking stack empty …
  • … if empty, return −1
  • … if not empty, return topOfStack data item from stack and decrement pointer
✓
FUNCTION pop(ByRef stackArray, ByRef topOfStack: INTEGER) RETURNS INTEGER
✓
IF topOfStack < 0
✓
THEN
✓
RETURN -1
✓
ELSE
✓
dataToReturn ← stackArray[topOfStack]
✓
topOfStack ← topOfStack - 1
✓
RETURN dataToReturn
✓
ENDIF
✓
ENDFUNCTION

Mark scheme 9608_s21_ms_43.pdf →

Show text version of question

Question 7

Part (b)

Question 7

Giles is writing a program that uses a stack.

The stack stores up to 1000 integers in the 1D array, stackArray.

Part (b)

The function pop() pops and returns the item from the top of the stack. If the stack is empty,

it returns −1.

Write pseudocode for the function pop().

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................

[3]

Question 19

Question 20

reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.

To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cambridgeinternational.org after the live examination series.

Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.

Topic relevance

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 9608_s21_qp_43.pdf

Keep practising this topic