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 area | AThe second line of the comment is missing //, so it would be treated as code and cause an error. | |
| 2Total ← Price * Qty // cost of items | BA statement followed by an end-of-line comment: the assignment runs but the comment is ignored | |
| 3A comment that spans several lines needs // at the start of every line | CA comment on its own line that explains the code below it and is ignored when the program runs | |
| 4Adding a comment does not change what the program does, so the program still outputs 10 | DA single slash does not start a comment. It must be two slashes //, otherwise the text is treated as code and causes an error. | |
| 5Score ← 0 / set score to zero | E// Program to find the average // Input three marks and output the mean | |
| 6// Ask the user for a name and store it in Name INPUT Name | FX ← 10 // set X to ten OUTPUT X |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
// — Starts a comment. Everything after // on that line explains the code to people and is ignored when the program runs, so it never changes what the program does.// Set the starting score
Score ← 0Total ← Price * Quantity // cost of items// Calculate the area of a rectangle
// Width and Height are in cm
Area ← Width * HeightOUTPUT Total // show the final totalLives ← 3 // player starts with 3 lives