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 | |
|---|---|---|
| 1x = 5 x = x + 2 print(x) | ACauses an error because total is used before it is given a value | |
| 2print(total) total = 10 | BThe output statement is placed before the calculation, so area has no value when it is printed. Move the calculation above print. | |
| 3Swapping two statements can change the output, because each line runs in order | CRuns top to bottom and prints 7, because x is changed before it is printed | |
| 4A simple input-process-output program follows sequence: input first, then process, then output | Da = 3 a = a * 2 print(a) # prints 6 | |
| 5print(area) area = width * height | EThe update comes after print, so the output shows 10 instead of 15. Put the update before print. | |
| 6score = 10 print(score) score = score + 5 | Fn = int(input()) double = n * 2 print(double) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
sequence — A control structure where statements run one after another, top to bottom, so changing their order can change the result.name = input("Name: ")
print("Hi " + name)total = 10
total = total + 5
print(total)age = int(input("Age: "))
print(age + 1)count = 1
count = count + 1
print(count)print("Start")
print("Middle")
print("End")