Quelpr

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

A Stack ADT is implemented in C with variables and functions.

Declare the variables needed for implementing the stack in C and describe the purpose of each, assuming it stores at most 100 integer elements.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 1(a)(i)Explain the difference between the Stack ADT and the C implementation of the stack.[3 marks]
  2. 1(a)(iii)Write C code for push(element) and pop() operations, accounting for overflow and underflow conditions.[8 marks]
  3. 1(b)Given an initially empty linked list with an insert operation at the beginning, draw the linked list after inserting 43, 38, 25 in order, clearly indicating…[4 marks]
  4. 1(c)Given a queue q with an unknown number of elements and a stack stk, write an algorithm using only Stack and Queue ADT operations to reverse the order of…[6 marks]

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