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 | |
|---|---|---|
| 1OTHERWISE : OUTPUT "Invalid choice" | ARuns and displays an error message when the CASE variable matches none of the listed values | |
| 2CASE OF Choice 1 : OUTPUT "Start" 2 : OUTPUT "Quit" ENDCASE | BOTHERWISE is placed before the listed value. It must be the last clause, so move it below 1 : OUTPUT "Start". | |
| 3OTHERWISE must be the last clause, placed after all the listed values and just before ENDCASE | CThe colon is missing after OTHERWISE. It should be OTHERWISE : OUTPUT "Invalid choice". | |
| 4Use OTHERWISE to catch invalid menu choices and tell the user | DCASE OF Grade 'A' : OUTPUT "Top" 'B' : OUTPUT "Good" OTHERWISE : OUTPUT "Try again" ENDCASE | |
| 5CASE OF Choice OTHERWISE : OUTPUT "Invalid choice" 1 : OUTPUT "Start" ENDCASE | EA CASE with no OTHERWISE, so nothing happens if Choice is 3 | |
| 6OTHERWISE OUTPUT "Invalid choice" | FOTHERWISE : OUTPUT "Invalid choice" |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
OTHERWISE — The last clause of a CASE statement. It runs when the variable matches none of the listed values, e.g. OTHERWISE : OUTPUT "Invalid choice". Without it, nothing happens if no value matches.CASE OF Choice
1 : OUTPUT "Play"
OTHERWISE : OUTPUT "Invalid choice" 1 : OUTPUT "Play"
OTHERWISE : OUTPUT "Invalid choice"
ENDCASE 2 : OUTPUT "Quit"
OTHERWISE : OUTPUT "Invalid choice"
ENDCASECASE OF Menu
OTHERWISE : OUTPUT "Invalid choice"
ENDCASE 3 : OUTPUT "Exit"
OTHERWISE : OUTPUT "Invalid choice"
ENDCASE