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 | |
|---|---|---|
| 1// Calculate the average mark | AA short comment at the end of a line, explaining only that line of code | |
| 2Total ← Total + Mark // add to total | B// Check if the password is long enough // Passwords must have 8 or more characters | |
| 3A comment that explains the purpose of the code is written on its own line above it | CThe comment starts with only one slash. A comment needs two forward slashes //, so the first line is not a valid comment. | |
| 4A multi-line comment needs // at the start of every line | D// Ask the user for their age INPUT Age | |
| 5/ Total of all the marks Total ← 0 | EOnly the first two lines are comments, but a long comment that runs over several lines needs // on every line. A comment line without // would be treated as code. | |
| 6// Read the number // of students INPUT Students OUTPUT Students | FA comment on its own line above the code, explaining what the next lines do |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
// — Two forward slashes start a comment. Everything after // to the end of the line is ignored by the computer and only explains the code to the reader.// Ask the user for their age
INPUT AgeTotal ← 0 // Start the total at zero// Calculate the area of the rectangle
// Width and Length must be positive
Area ← Width * LengthFOR Count ← 1 TO 5 // Repeat five times
OUTPUT Count
NEXT Count// Check if the student has passed
IF Mark >= 50 THEN
OUTPUT "Pass"