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 | |
|---|---|---|
| 1CALL ShowMenu() | AAddThree is a function, so it cannot be used with CALL. Its returned value must be used in an expression or OUTPUT. | |
| 2OUTPUT AddThree(2, 5, 8) | BThe main program calls the procedure before it has been defined. Definitions must be listed first. | |
| 3Procedures and functions are defined at the start of the program, before the main program uses them | CIn the main program, this line runs the procedure ShowMenu, then control returns to the next line | |
| 4The main program stores a function result in a variable, then uses it in a later step | DIn the main program, this calls the function AddThree with three values and outputs the value it returns | |
| 5CALL ShowMenu() PROCEDURE ShowMenu() OUTPUT "1. Play" ENDPROCEDURE | ETotal ← AddThree(A, B, C) OUTPUT Total | |
| 6CALL AddThree(2, 5, 8) | FPROCEDURE ShowMenu() OUTPUT "1. Play" ENDPROCEDURE |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
main program — The section after all procedure and function definitions. It calls them in order, using CALL for procedures and function calls inside expressions or OUTPUT.PROCEDURE ShowTitle()
OUTPUT "Area Calculator"
ENDPROCEDUREFUNCTION Square(N : INTEGER) RETURNS INTEGER
RETURN N * N
ENDFUNCTIONCALL ShowTitle()
INPUT Side
OUTPUT Square(Side)PROCEDURE ShowSum(A, B, C : INTEGER)
OUTPUT A + B + C
ENDPROCEDUREINPUT Side
Area ← Square(Side)
OUTPUT Area