Quelpr

CAPE Computer Science Unit 2 · 2009 · Paper 2 · Question 1(a)(ii)

A Stack Abstract Data Type (ADT) provides pop(Stack), push(Stack, data), and isEmpty(Stack) operations.

Write C code for a function implementing the push(Stack, data) operation for integer data, properly handling stack overflow conditions.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 1(a)(i)Describe how to implement the pop, push, and isEmpty stack operations for storing integers using static computer storage.[4 marks]
  2. 1(b)Assuming stk is initially empty, determine the output of the provided algorithm when n is 9 and expr is '923*-82/+', and draw the stack on each iteration of…[10 marks]
  3. 1(c)Explain how a stack can be used to determine if a string is a palindrome (e.g. 'madam').[6 marks]

More practice: the rest of this paper · more Abstract Data Types (ADTs) questions · all CAPE Computer Science Unit 2 past papers