Quelpr

CAPE Computer Science Unit 2 · 2015 · Paper 2 · Question 1(c)(ii)

Write C code implementations for stack and queue operations without calling other functions.

Write a C function to add an integer to a queue, taking the queue and the integer to be added as arguments.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 1(a)Explain why stacks and queues are classified as ADTs.[2 marks]
  2. 1(b)Describe the primary differences between stacks and queues, providing a real-life example to illustrate how each ADT can be used.[6 marks]
  3. 1(c)(i)Write a C function to add an integer to a stack, with the stack and the integer value as arguments.[7 marks]
  4. 1(d)Letters A, C, X, and E have been added to a stack in that order. Draw a diagram showing how letter C can be removed from the stack, showing the stack's…[3 marks]

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