← IGCSE Computer Science Paper 2

Procedures with two or three parameters

Several parameters are separated by commas, each with its own data type. A call gives one value for each, in the same order, such as CALL Show("Sam", 14).

Understanding Procedures with two or three parameters in IGCSE Computer Science Paper 2

What it does: Three parameters are listed with a comma between each one and each has its own type. "Mia" matches Name : STRING and 15 matches Age : INTEGER, in the same order as the header. A call gives one value for every parameter in the header. The first value is given to the first parameter and the second value to the second parameter. There are three parameters, so the call must supply three values in the same order. Age is an INTEGER, so the second value must be a whole number, not a STRING. Several parameters must be separated by commas in the procedure header.

Common mistakes: Parameters must be separated by commas, not a semicolon. The header should be PROCEDURE Pay(N:STRING,P:REAL). H is not a parameter of Area. The procedure only has L and W, so the body must use L * W.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 399–408) and word search (Modules 399–418).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which procedure header is written correctly for two parameters?
PROCEDURE Show(Name : STRING Age : INTEGER)PROCEDURE Show(Name : STRING, Age : INTEGER)
Matches
CALL Show(14, "Sam")
↓
The values are in the wrong order. 14 is passed to Name (a STRING) and "Sam" to Age (an INTEGER), so the types do not match. It should be CALL Show("Sam", 14).
Applying
Meanings
Term
PROCEDURE Show(Name : STRING, Age : INTEGER)
Meaning
Several parameters are separated by commas, each with its own data type. A call gives one value for each, in the same order, such as CALL Show("Sam", 14).
Practice
PROCEDURE Show(Name : STRING, Age : INTEGER)
Testing
Gaps
Show(Name : STRING, Age : INTEGER)
Check Answer
Spots
1PROCEDURE Pay(N:STRING;P:REAL)
2 OUTPUT N, " owes ", P

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Penguin' badge — List Waddler, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which procedure header is written correctly for two parameters?
A. PROCEDURE Show(Name : STRING Age : INTEGER)
B. PROCEDURE Show(Name : STRING, Age : INTEGER) ✓
Parameters are separated by commas, and each one has its own name and data type.
2. Which call correctly matches PROCEDURE Show(Name : STRING, Age : INTEGER)?
A. CALL Show(14, "Sam")
B. CALL Show("Sam", 14) ✓
Values are matched by position. The first value goes to Name (STRING) and the second to Age (INTEGER).
3. How many values must a call supply for PROCEDURE Show(Name : STRING, Age : INTEGER)?
A. Two: one for each parameter ✓
B. One: just the first parameter
A call gives one value for every parameter in the header.
4. Which is correct for a procedure with three parameters?
A. PROCEDURE Score(Name : STRING, Maths : INTEGER, English : INTEGER) ✓
B. PROCEDURE Score(Name, Maths, English : STRING, INTEGER, INTEGER)
Each parameter is written with its own data type after its name, e.g. Maths : INTEGER.
5. Given PROCEDURE Show(Name : STRING, Age : INTEGER), what does the call CALL Show("Sam", 14) do?
A. Name is "Sam" and Age is 14 inside the procedure ✓
B. Name is 14 and Age is "Sam" inside the procedure
The first value is given to the first parameter and the second value to the second parameter.

Match the Pairs

PROCEDURE Show(Name : STRING, Age : INTEGER) → Defines a procedure with two parameters separated by a comma, each with its own data type
CALL Show("Sam", 14) → Calls the procedure with two values: "Sam" goes to Name and 14 goes to Age, matched by position
A procedure can have three parameters, each with its own data type, separated by commas → PROCEDURE Report(Name : STRING, Age : INTEGER, Score : REAL)
The call must give one value for each parameter in the same order as the header, so the first value is a STRING and the second is an INTEGER → CALL Show("Mia", 15)
CALL Show(14, "Sam") → The values are in the wrong order. 14 is passed to Name (a STRING) and "Sam" to Age (an INTEGER), so the types do not match. It should be CALL Show("Sam", 14).
PROCEDURE Show(Name : STRING Age : INTEGER) → The comma between the parameters is missing. It should be PROCEDURE Show(Name : STRING, Age : INTEGER).

Key Term

PROCEDURE Show(Name : STRING, Age : INTEGER)
Several parameters are separated by commas, each with its own data type. A call gives one value for each, in the same order, such as CALL Show("Sam", 14).

Fill in the Blanks

1. PROCEDURE Show(Name : STRING, Age : INTEGER)
Hint: Type the keyword that starts the definition of a procedure.
2. PROCEDURE Show(Name : STRING, Age : INTEGER)
Hint: Type the data type that suits a whole-number age.
3. PROCEDURE Show(Name : STRING, Age : INTEGER) CALL Show("Sam", 14)
Hint: Type the keyword used to run a procedure with its two values.
4. PROCEDURE Box(W : REAL, H : REAL, D : REAL)
Hint: Type the data type of the third parameter, matching the other two measurements.
5. PROCEDURE Show(Name : STRING, Age : INTEGER) Years ← 14 CALL Show("Sam", Years)
Hint: Type the variable that supplies the value for the second parameter.

Spot the Error

Question 1
A PROCEDURE Pay(N:STRING;P:REAL)
B OUTPUT N, " owes ", P
C ENDPROCEDURE
D CALL Pay("Sam", 4.5)
Line A — Parameters must be separated by commas, not a semicolon. The header should be PROCEDURE Pay(N:STRING,P:REAL).
Question 2
A PROCEDURE Area(L:REAL,W:REAL)
B OUTPUT L * H
C ENDPROCEDURE
D CALL Area(2.5, 4)
Line B — H is not a parameter of Area. The procedure only has L and W, so the body must use L * W.
Question 3
A PROCEDURE Diff(A:REAL,B)
B OUTPUT A - B
C ENDPROCEDURE
D CALL Diff(9, 2.5)
Line A — Each parameter needs its own data type. B has no type, so it should be B:REAL.
Question 4
A PROCEDURE Id(I:CHAR,A:INTEGER)
B OUTPUT "Initial: ", I
C OUTPUT "Next age: ", I + 1
D ENDPROCEDURE
E CALL Id('S', 14)
Line C — I is a CHAR, so you cannot add 1 to it. The age is in the INTEGER parameter A, so it should be A + 1.
Question 5
A PROCEDURE Sum(A:REAL,B:REAL)
B OUTPUT A + B
C ENDFUNCTION
D CALL Sum(1.5, 4.5)
Line C — A procedure with several parameters is still a procedure. It must end with ENDPROCEDURE, not ENDFUNCTION.

Student with a class code? Join your class →