Past-paper question · 2016 May-June · Paper 33 · Q2(e)(i)

Question 2(e)(i) 2016 · May-June · Paper 33 · 4 marks

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

Official answer for Question 2

Part (e)

(i)

Part (e)

(i)

PROCEDURE Push(NewItem : STRING) [4]

✓
IF TOS = 20
✓
THEN
✓
OUTPUT "STACK is FULL"
✓
ELSE
✓
TOS ← TOS + 1
✓
Stack[TOS] ← NewItem
✓
ENDIF
✓
ENDPROCEDURE

Mark scheme 9691_s16_ms_33.pdf →

Show text version of question

Question 2

Part (e)

(i)

It is suggested that the stack could be implemented using object-oriented programming.

A
programmer designs the following pseudocode for the class definition.

(i)

Complete the pseudocode.

CLASS StackClass

PRIVATE

TOS : INTEGER

Stack : ARRAY[1 : 20] OF STRING

PUBLIC

PROCEDURE InitialiseStack

<statements>

ENDPROCEDURE

PROCEDURE Push(NewItem : STRING)

IF .................................................................................................................

THEN

OUTPUT " ....................................................................................... "

ELSE

TOS ...........................................................................................

............................................................ NewItem

ENDIF

ENDPROCEDURE

FUNCTION Pop

<statements>

ENDFUNCTION

ENDCLASS

[4]

Question 7

Topic relevance

Why this question appears here

98% assigned-topic match · Further programming › Programming paradigms

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 9691_s16_qp_33.pdf

Keep practising this topic