Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Selection Sort algorithm in pseudocode worksheet is part of the VCE Pseudo Code journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1min ← 1 | AWrong - array elements use square brackets, not round brackets | |
| 2IF arr[j] < arr[min] THEN | BChecks whether the current element is smaller than the tracked minimum | |
| 3Records the position of the smaller element found | CSets the starting minimum index to the first position | |
| 4Swaps the minimum element into its sorted position | Dmin ← j | |
| 5IF arr(j) < arr[min] THEN | EWrong - assignment uses ←, not =, in pseudocode | |
| 6min = j | Farr[1] ← arr[min] |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Selection Sort — An algorithm that repeatedly finds the smallest remaining element and swaps it into its correct position.FOR i FROM 1 TO 4IF arr[j] < arr[min] THENIF arr[j] < arr[min] THENmin ← jmin ← 1