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 AddUp(X : INTEGER) RETURNS INTEGER | ATotal is a function, and CALL is only for procedures. The returned value is lost. Write Answer ← Total(3, 4) or OUTPUT Total(3, 4). | |
| 2PROCEDURE DrawLine() | BA function header: RETURNS gives the data type of the value the function sends back. | |
| 3A function's returned value is used where it is called, for example stored in a variable | CDrawLine is a procedure and returns nothing, so there is no value to store. It should be run with CALL DrawLine(). | |
| 4A procedure is called as its own statement using CALL | DA procedure header with no RETURNS part, because a procedure gives nothing back. | |
| 5CALL Total(3, 4) | ECALL DrawLine() | |
| 6Result ← DrawLine() | FCost ← Total(3, 4) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
RETURNS — Only a function has RETURNS: it gives back a value used where it is called. A procedure returns nothing and is run on its own with CALL.FUNCTION Twice(N : INTEGER) RETURNS INTEGERCALL DrawLine(5)FUNCTION Twice(N : INTEGER) RETURNS INTEGER
RETURN N * 2
ENDFUNCTIONPROCEDURE DrawLine(Size : INTEGER)
OUTPUT "-----"
ENDPROCEDUREAnswer ← Twice(4)
OUTPUT Answer