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 | |
|---|---|---|
| 1Mark >= 0 AND Mark <= 100 | AOR is used instead of AND, so every number passes, even -5 or 500. It should be Mark >= 0 AND Mark <= 100. | |
| 2Mark < 0 OR Mark > 100 | BValid range check: true only when Mark is from 0 to 100 inclusive, because both comparisons must be true. | |
| 3Two separate comparisons joined by AND are used to check a value is within a range, never a chained comparison | CAge >= 11 AND Age <= 16 | |
| 4Use > and < instead of >= and <= when the limits themselves are not allowed (exclusive limits) | DTemp > 0 AND Temp < 100 | |
| 5IF 0 <= Mark <= 100 THEN | EThe comparison is chained. Pseudocode needs two comparisons joined by AND: Mark >= 0 AND Mark <= 100. | |
| 6IF Mark >= 0 OR Mark <= 100 THEN | FInvalid range check: true when Mark is outside 0 to 100, because only one comparison needs to be true. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Mark >= 0 AND Mark <= 100 — A range check joins two comparisons with AND, so a value is valid only if both are true. Never chain them like 0 <= Mark <= 100. Use OR to test for values outside the range.IF Mark >= 0 AND Mark <= 100 THEN
OUTPUT "Valid mark"
ENDIFIF Mark < 0 OR Mark > 100 THEN
OUTPUT "Invalid mark"
ENDIFIF Age >= 11 AND Age <= 16 THENIF Mark >= 0 AND Mark <= 100 THENIF Temp > 0 AND Temp < 100 THEN