Quelpr

CAPE Computer Science Unit 2 · 2006 · Paper 2 · Question 3(a)(ii)

An array arr is filled to capacity with 100 integers.

Write a segment of code that prompts the user for key, calls the search function in 3(a)(i), and displays an error message if not found or the location if found.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 3(a)(i)Write a recursive function in pseudocode to search arr for a value named key. Return the index where it was found, or return -1 if key is not present.[11 marks]
  2. 3(b)Identify and describe FOUR steps (or stages) of the object-oriented process.[8 marks]
  3. 3(c)Explain why it is advisable to always write programs that are portable and maintainable.[6 marks]

More practice: the rest of this paper · more Searching and Sorting Algorithms questions · all CAPE Computer Science Unit 2 past papers