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 | |
|---|---|---|
| 1FUNCTION Double(n : INTEGER) RETURNS INTEGER | AThe header of a function: RETURNS gives the data type of the value sent back to the caller | |
| 2ENDPROCEDURE | BCALL ShowMenu() | |
| 3A procedure is run with the CALL keyword, and it does not return a value | Ctotal ← AddTax(price) | |
| 4A function sends a value back with RETURN, so its call is used inside an expression, not with CALL | DThe header is missing RETURNS REAL, so the data type of the returned value is not stated. | |
| 5CALL Area(5.0) | EThe keyword that closes a procedure; a function is closed with ENDFUNCTION instead | |
| 6FUNCTION Area(r : REAL) RETURN r * r * 3.14 ENDFUNCTION | FCALL is used with a function. Functions return a value, so the call should be used in an expression such as result ← Area(5.0). |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
RETURNS — Keyword in a FUNCTION header giving the data type of the value sent back, e.g. FUNCTION Area(r : REAL) RETURNS REAL. End with ENDFUNCTION. Never use CALL for a function.FUNCTION Area(r : REAL) RETURNS REALFUNCTION IsEven(n : INTEGER) RETURNS BOOLEAN
RETURN n MOD 2 = 0
ENDFUNCTIONPROCEDURE ShowScore(s : INTEGER)
OUTPUT s
ENDPROCEDUREFUNCTION Square(n : INTEGER) RETURNS INTEGER
RETURN n * n
ENDFUNCTIONCALL ShowScore(85)