The table below shows scores from a drone obstacle course. A coach wants an algorithm that ranks the teams with the smallest time first. Fig. 1 gives incomp...

Assessment: Computer Science 4CP0 | Paper 2 Mock 01 | Written Paper 2 Subject: Computer Science - 4CP0

Question 1 Report

The table below shows scores from a drone obstacle course. A coach wants an algorithm that ranks the teams with the smallest time first. Fig. 1 gives incomplete pseudocode for a selection sort. During each pass, the algorithm finds the lowest remaining number and places it at the next free position. The data are times in seconds. The code will later display the sorted team list on a scoreboard.

TeamTime / s
Orion82
Nova76
Comet91
Vega79
Fig. 1: selection-sort pseudocode01 FOR position ← 1 TO 302 lowest ← position03 FOR check ← position + 1 TO 404 IF time[check] < time[lowest] THEN05 lowest ← check06 ENDIF07 ENDFOR08 SWAP time[position], time[lowest]

(a) Identify the team selected first as the lowest time. [1]
(b) Write the times after the first selection-sort pass. [2]
(c) State the team displayed first after the complete sort. [1]

Answer Details

(a) The lowest time is 76 s, belonging to Nova, so Nova is selected first. [1]

(b) A selection-sort pass finds the lowest remaining value and swaps it into the next free position. Starting with \(82,76,91,79\), swap 76 with 82:

\[82,76,91,79 \rightarrow 76,82,91,79\]

The times after the first pass are 76, 82, 91, 79. [2]

(c) After the complete ascending sort, the first team displayed is Nova. [1] It has the shortest time.

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning