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 | |
|---|---|---|
| 1DECLARE TotalToPay : REAL | AA meaningful identifier: the name tells the reader the variable holds the total amount a customer has to pay | |
| 2CONSTANT HourlyRate ← 12.50 | BT is a poor identifier because it does not say what it holds. Rename it to something like TotalToPay so the purpose is clear. | |
| 3A single letter name is acceptable when it is conventional, such as i as an index counting through an array | CX ← X + 1 | |
| 4Single letters are also conventional for coordinates, such as X and Y for a position on a grid | DA meaningful constant name that says the fixed value is the pay for each hour worked | |
| 5T ← Price * Quantity | EFOR i ← 1 TO 10 | |
| 6X ← Hours * Rate | FX is used for a pay amount, but X normally means a coordinate. Rename it to something like TotalPay to show what it holds. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
meaningful identifier — A name that describes what a variable or constant holds, such as TotalToPay instead of T, so the program is easy to read and maintain.CONSTANT VatRate ← 0.2
Price ← 50
TotalToPay ← Price + Price * VatRateHourlyRate ← 15
HoursWorked ← 40
TotalToPay ← HourlyRate * HoursWorkedX ← 4 // horizontal position
Y ← 7 // vertical position
OUTPUT X, YHours ← 8
HourlyRate ← 12.5
Pay ← Hours * HourlyRateCONSTANT PassMark ← 50
INPUT Mark
IF Mark >= PassMark THEN