Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
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 | |
|---|---|---|
| 1Count ← 0 | AIF Names[Index] = Target THEN Count ← Count + 1 ENDIF | |
| 2IF Marks[Index] >= 50 THEN Count ← Count + 1 ENDIF | BTotal ← Total + Marks[Index] | |
| 3To count how many names in an array equal a given name, compare each element with that name and add 1 when they match | CTests the current element and adds 1 to Count only when the mark is 50 or more | |
| 4A counter adds 1 each time the test is true, but a total adds the element values themselves | DCount adds the mark itself instead of 1, so it totals the passing marks rather than counting them. It should be Count ← Count + 1. | |
| 5FOR Index ← 1 TO 10 Count ← 0 IF Marks[Index] >= 50 THEN Count ← Count + 1 ENDIF NEXT Index | ESets the counter to zero before the loop starts, so counting begins from nothing | |
| 6IF Marks[Index] >= 50 THEN Count ← Count + Marks[Index] ENDIF | FCount ← 0 is inside the loop, so the counter is reset to zero on every repeat and the final count is wrong. Set it to 0 once before the loop. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
IF Marks[Index] >= 50 THEN Count ← Count + 1 — An IF inside the loop tests each element and adds 1 to Count when true. Set Count to 0 before the loop. A counter counts matches; a total adds up values.Count ← 0
FOR Index ← 1 TO 10
IF Marks[Index] >= 50 THENFOR Index ← 1 TO 10
IF Marks[Index] >= 50 THEN
Count ← Count + 1 Count ← Count + 1
ENDIF
NEXT IndexIF Names[Index] = SearchName THEN
Count ← Count + 1
ENDIFIF Marks[Index] >= 50 THEN
Count ← Count + 1
ENDIF