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 SumSquare(Number1:INTEGER, Number2:INTEGER) RETURNS INTEGER | AThe header is missing RETURNS and the return data type after the brackets, for example RETURNS REAL. | |
| 2RETURN Number1 * Number1 + Number2 * Number2 | BThe parameters have no data types. Each one must be written as name:TYPE, for example Number1:INTEGER. | |
| 3A function with one parameter: name, colon, data type in brackets, then RETURNS and the return type | CFUNCTION Double(Num:INTEGER) RETURNS INTEGER | |
| 4A function definition with parameters always finishes with ENDFUNCTION after the RETURN statement | DUses both parameters in the RETURN expression to calculate the value sent back | |
| 5FUNCTION SumSquare(Number1, Number2) RETURNS INTEGER | EHeader of a function with two INTEGER parameters that sends back an INTEGER result | |
| 6FUNCTION Average(A:INTEGER, B:INTEGER) RETURN (A + B) / 2 ENDFUNCTION | FFUNCTION AddThree(A:INTEGER, B:INTEGER, C:INTEGER) RETURNS INTEGER RETURN A + B + C ENDFUNCTION |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
FUNCTION SumSquare(Number1:INTEGER, Number2:INTEGER) RETURNS INTEGER — A function header lists each parameter in brackets as name:TYPE, then RETURNS and the return type. The body uses the parameters in a RETURN expression and ends with ENDFUNCTION.FUNCTION Double(N:INTEGER) RETURNS INTEGER
RETURN N * 2
ENDFUNCTIONFUNCTION Double(N:INTEGER) RETURNS INTEGER
RETURN N * 2
ENDFUNCTIONFUNCTION Cube(N:INTEGER) RETURNS INTEGER
RETURN N * N * N
ENDFUNCTIONFUNCTION Add(A:REAL, B:REAL) RETURNS REAL
RETURN A + B
ENDFUNCTIONFUNCTION IsOld(Age:INTEGER) RETURNS BOOLEAN
RETURN Age >= 18
ENDFUNCTION