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 | |
|---|---|---|
| 1print "Enter your age:" input age | AThe input comes before the print prompt, so the user is asked for a choice after the program has already tried to read it. The prompt must be printed first. | |
| 2while choice != 3 | BShows a prompt to the user, then reads their reply into the variable age. | |
| 3A menu uses if / else if to run the action that matches the user's choice. | Cif choice = 1 then print "Adding item" else if choice = 2 then print "Showing list" end if | |
| 4A menu loop prints the options, reads a choice and repeats until the exit option is picked. | Drepeat print "1 Add 2 View 3 Exit" input choice until choice = 3 | |
| 5input choice print "Pick an option (1-3):" | EThe exit condition uses 3, but the menu only offers options 1 and 2, so the user can never exit and the loop runs forever. The condition should be choice = 2. | |
| 6repeat print "1 Play 2 Quit" input choice until choice = 3 | FKeeps the menu repeating until the user picks option 3, the exit option. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
menu loop — A loop that prints the options, uses a print prompt then input to read a choice, runs the matching action with if / else if, and repeats until the user picks the exit option.print "Enter your name:"
input nameprint "Enter a number from 1 to 3:"
input numwhile choice ≠ 3
print "1 Play 2 Help 3 Exit"
input choiceif choice = 1 then
print "Starting game"
else if choice = 2 thenprint "Choose 1, 2 or 3:"
input choice
if choice = 1 then