Quelpr

CAPE Computer Science Unit 2 · 2016 · Paper 2 · Question 1(a)(iii)

Appropriate data structures for various programming scenarios.

Identify which data structure would be most appropriate to store an unknown number of data items and subsequently search for different keys.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 1(a)(i)Identify which data structure would be most appropriate for a call centre to ensure calls are answered in first-in, first-out order.[1 mark]
  2. 1(a)(ii)Identify which data structure would be most appropriate to allow the 'Undo' button to operate correctly in a word processing application.[1 mark]
  3. 1(b)Write code to implement the function `public void insertToFront(String s)` which accepts a string `s`, stores it in a new node, and inserts it at the front of…[3 marks]
  4. 1(c)Draw diagrams showing the contents of the queue Q after executing Line 3, Line 4, and Line 5, showing all elements in the queue for each illustration.[3 marks]
  5. 1(d)Describe three operations that can be executed on a stack.[6 marks]
  6. 1(e)Write C code to reverse the order of items in a queue (e.g. from x1, x2, x3 ... xN to xN ... x3, x2, x1 where xN is at the front).[10 marks]

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