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(age >= 13) AND (score > 50) | ACheck each part separately and record TRUE or FALSE in its own trace table column, then combine with OR. Only one part needs to be TRUE for the whole condition to be TRUE. | |
| 2x < 3 OR done = TRUE | BThe trace table records only the final result, so you cannot tell which part made the loop stop. Add a column for n < 10 and a column for found = FALSE. | |
| 3Add an extra trace table column for each part of the condition so both TRUE/FALSE results are recorded before combining | CWork out each bracketed part as TRUE or FALSE first, then combine the two results with AND. Both parts must be TRUE for the whole condition to be TRUE. | |
| 4Brackets are worked out first, then the NOT or the AND/OR that uses their results | D| count | count < 5 | lives > 0 | both | | |
| 5WHILE n < 10 AND found = FALSE Trace: only one column for the whole condition | ENOT (a > 2 AND b < 4) | |
| 6NOT (x > 5 AND y > 5) with x = 8, y = 2: NOT x > 5 = FALSE, so the answer is FALSE | FThe brackets were not worked out first. The bracket (8 > 5 AND 2 > 5) is TRUE AND FALSE = FALSE, so NOT FALSE = TRUE. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
trace a compound condition — Work out each part as TRUE or FALSE for the current values, record both in the trace table, then combine them with AND, OR or NOT. Do brackets first.WHILE score < 50 AND lives > 0 DO
score < 50 is TRUE, lives > 0 is FALSE
TRUE AND FALSE is FALSEtemp ← 35, rain ← 0
temp > 30 is TRUE, rain > 5 is FALSE
TRUE OR FALSE is TRUEa ← 5, b ← 1, c ← 0
(a > 3 OR b > 3) AND c > 3
(TRUE OR FALSE) AND FALSE: TRUE AND FALSEUNTIL found = TRUE OR tries = 3
found = TRUE is FALSE, tries = 3 is TRUE
Loop stopped because tries = 3 was TRUEIF NOT (n > 5) AND n > 2 THEN
n ← 4: n > 5 is FALSE, NOT FALSE is TRUE
n > 2 is TRUE, so the whole condition is TRUE