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 | |
|---|---|---|
| 1IF Mark >= 0 AND Mark <= 100 THEN | ATests whether Age is outside the allowed range, so the value is rejected | |
| 2IF Age < 0 OR Age > 120 THEN | BIF Score >= 1 AND Score <= 10 THEN | |
| 3A range check on a date: the month number must be between 1 and 12, and 1 and 12 are valid | CIF Month >= 1 AND Month <= 12 THEN | |
| 4Both limits must be true for a number to pass, so the two tests are joined with AND | DThe limits 0 and 100 are wrongly rejected because > and < are used. It should be >= and <= so the limits are accepted. | |
| 5IF Age >= 0 OR Age <= 120 THEN | EOR is used to join the limits, so every number passes, because any number is either at least 0 or at most 120. It should be AND. | |
| 6IF Mark > 0 AND Mark < 100 THEN | FRange check: accepts a Mark from 0 to 100, including 0 and 100 themselves |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
IF Age >= 0 AND Age <= 120 — A range check tests that a value lies between the lowest and highest allowed values. The limits themselves are accepted. AND joins both limits.IF Age >= 0 AND Age <= 120 THEN
OUTPUT "Age accepted"
ENDIFIF Age >= 0 AND Age <= 120 THEN
OUTPUT "Age accepted"
ENDIFIF Age < 0 OR Age > 120 THEN
OUTPUT "Invalid age"
ENDIFIF Score >= 0 AND Score <= 100 THEN
OUTPUT "Valid score"
ENDIFIF Month >= 1 AND Month <= 12 THEN
OUTPUT "Valid month"
ENDIF