Question 6
OCR Computer Science November 2020 Paper 2GCSE15 marks
On the specification
- (a)
- 2.1 Algorithms
- (b)
- 2.1 Algorithms
- (c)
- 2.1 Algorithms2.2 Programming techniques
Question text
6 The following names of students are stored in an array with the identifier studentnames. studentnames = ["Rob", "Anna", "Huw", "Emma", "Patrice", "Iqbal"] (a) Describe the steps that a linear search would take to find Anna in studentnames [4] (b) The names of students are sorted into ascending alphabetical order using an insertion sort. Complete the following diagram to show the stages an insertion sort would take to complete this task. Each row represents one pass of the insertion sort algorithm. You may not need to use all empty rows. Rob Anna Huw Emma Patrice Iqbal [5] (c) A school uses the array to call an attendance register every morning. Write an algorithm using iteration to: • display the name of each student one at a time from studentnames • take as input whether that student is present or absent • display the total number of present students and number of absent students in a suitable message, after all student names have been displayed. [6]