Quelpr

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

Write C code that takes two integers, lower and upper (where lower < upper), and counts and prints the number of marks in an unsorted array of 100 student marks between lower and upper inclusive, printing an error message if none are found.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 2(b)(i)Describe how a binary search algorithm will search arr for key 16, showing the portion of the array searched each iteration.[6 marks]
  2. 2(b)(ii)Describe how a binary search algorithm will search arr for key 63, showing the portion of the array searched each iteration.[6 marks]
  3. 2(c)Draw the array after the first, second, and third passes of the selection sort algorithm (three diagrams in all).[3 marks]

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