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 | |
|---|---|---|
| 1age >= 13 and age <= 19 | AA range condition that is only True when both parts are True, so test 12, 13, 19 and 20 to check each boundary | |
| 2day == "Sat" or day == "Sun" | BTrue and False | |
| 3A truth table row tests one combination of the parts. For A=True and B=False, the and result should be False. | CUsing or instead of and makes the condition True for every number, so even 5 or 50 pass. A test with age 5 would expose the error. It should use and. | |
| 4Using not flips a result, so a test must check that True becomes False and False becomes True | DThe boundary values 13 and 19 are wrongly rejected because > and < were used. It should be >= and <=. Testing 13 and 19 finds the error. | |
| 5if age >= 13 or age <= 19: | Enot (score > 50) | |
| 6if age > 13 and age < 19: | FA compound condition that is True when at least one part is True, so it is False only when both parts are False |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
truth table — A table listing every True/False combination of the parts in an and/or/not condition. Use it to pick test inputs that make each part True and False, then check each result.print(True and False) # Falseage = 17
if age >= 13 and age <= 17:
print("Teen")raining = True
if not raining:
print("Walk")age = 13
ok = age >= 13 and age <= 17
print(ok)score = 120
if score < 0 or score > 100:
print("Invalid")