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 | |
|---|---|---|
| 1for each student in students | AThe counter is reset to 0 inside the loop, so it restarts on every record. It should be set to 0 once before the loop starts. | |
| 2total ← total + order.price | BVisits every record in the students array once, giving the loop variable one record at a time | |
| 3Count only the records that match a condition by testing a field inside the loop | Cfor each student in students if student.house = "Red" then count ← count + 1 end if next student | |
| 4Loop over an array of records by index and read a field from the current record | DThe points field is read without naming the record. It should be student.points so the loop reads the field from the current record. | |
| 5for each student in students total ← total + points | EReads the price field of the current record and adds it to a running total | |
| 6for each order in orders count ← 0 if order.quantity > 2 then count ← count + 1 | Ffor i from 1 to length(products) print products[i].name next i |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
for each record in records — A loop that visits every record in an array once, so you can read, test or change each record's fields, such as counting or totalling the records that match.for each student in students
print student.namefor each student in students
print student.namefor each student in students
print student.markfor each s in students
if s.mark >= 50 then
count ← count + 1total ← 0
for each s in students
total ← total + s.mark