Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Linear Search 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 | |
|---|---|---|
| 1FOR i FROM 1 TO 5 | Afound ← TRUE | |
| 2IF numbers[i] = target THEN | BDISPLAY found | |
| 3Records that a match has been found | CLoops through each index of the array | |
| 4Outputs a message or value to the user | DWrong - pseudocode array loops start from 1, not 0 | |
| 5IF numbers(i) = target THEN | EWrong - array elements use square brackets, not round | |
| 6FOR i FROM 0 TO 5 | FChecks whether the current element matches the target |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Linear Search — An algorithm that checks each element in an array one at a time, from the start, until the target is found or the end is reached.FOR i FROM 1 TO 5IF numbers[i] = target THENIF numbers[i] = target THENDISPLAY "Found at position", iIF numbers[i] = target THEN