Quelpr

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

Write C code to prompt the user for an integer `key` and use linear search to find it in `number`. Print the location of `key` if found; otherwise, print 'Key Not found'.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 2(a)(i)Explain how the first node can be deleted.[3 marks]
  2. 2(a)(ii)Explain how the last node can be deleted.[3 marks]
  3. 2(a)(iii)Explain how any node between the first and last can be deleted.[4 marks]
  4. 2(b)(i)Write C code to declare an array `number` capable of storing 10 integers.[2 marks]
  5. 2(b)(ii)Write C code to populate the array `number` with integers entered by the user.[4 marks]

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