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 | |
|---|---|---|
| 1PROCEDURE ShowMenu() OUTPUT "1. Play" ENDPROCEDURE | AFUNCTION Double(n : INTEGER) RETURNS INTEGER RETURN n * 2 ENDFUNCTION | |
| 2CALL ShowMenu() | BThe same statements are copied out each time instead of being written once in a subroutine and called. | |
| 3The two kinds of subroutine are procedures and functions, and a function gives back a value | CCALL ShowMenu() CALL ShowMenu() CALL ShowMenu() | |
| 4A subroutine is defined once and can be called many times | DA named block of statements that is defined once and does a job when it is called | |
| 5PROCEDURE ShowMenu() OUTPUT "1. Play" CALL ShowMenu() | EThe procedure has no ENDPROCEDURE, so the block of statements is never closed and the subroutine is not properly defined. | |
| 6OUTPUT "1. Play" OUTPUT "1. Play" OUTPUT "1. Play" | FRuns the subroutine named ShowMenu, then control returns to the next line |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
subroutine — A named block of code, written once, that runs whenever it is called. Procedures and functions are the two kinds, and they break a program into parts.PROCEDURE ShowMenu()
OUTPUT "Welcome"
ENDPROCEDURECALL ShowMenu()
OUTPUT "Pick an option"
CALL ShowMenu()FUNCTION Double(N : INTEGER) RETURNS INTEGER
RETURN N * 2
ENDFUNCTIONPROCEDURE DrawLine()
OUTPUT "----------"
ENDPROCEDUREFUNCTION Five() RETURNS INTEGER
RETURN 5
ENDFUNCTION