← IGCSE Computer Science Paper 2

Parameters and the values passed in a call

A name in the subroutine definition that holds the value given in the call while it runs. With PROCEDURE Show(Num : INTEGER), CALL Show(5) makes Num hold 5.

Understanding Parameters and the values passed in a call in IGCSE Computer Science Paper 2

What it does: Both calls run the same procedure. Num holds 5 in the first call and 9 in the second. The variable Score is used in the call, so the parameter Num holds 40 while Show runs. The expression Age * 2 is worked out first, giving 8. That value is passed to the parameter X. The definition should be PROCEDURE Show(Num : INTEGER) with OUTPUT Num. Then CALL Show(5) makes Num hold 5.

Common mistakes: Name is the parameter, so it must not be in quotes. With quotes the program prints the word Name instead of the value in the call. It should be OUTPUT "Hello ", Name. The parameter in the definition is called Num, not Number. Number does not exist, so the line fails. It should be OUTPUT Num * Num.

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
In PROCEDURE Show(Num : INTEGER), what is Num?
A parameter: a name that holds the value given in the callThe value 5 that is passed in the call
Matches
CALL Show(Num : INTEGER)
↓
The call includes the parameter name and data type, which belong in the definition. A call should give a value such as 5.
Applying
Meanings
Term
parameter
Meaning
A name in the subroutine definition that holds the value given in the call while it runs. With PROCEDURE Show(Num : INTEGER), CALL Show(5) makes Num hold 5.
Practice
PROCEDURE Show(Num : INTEGER)
Testing
Gaps
PROCEDURE Show( : INTEGER)
Check Answer
Spots
1PROCEDURE Greet(Name : STRING)
2 OUTPUT "Hello ", "Name"

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

The 'Meerkat' badge — Communicator, 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. In PROCEDURE Show(Num : INTEGER), what is Num?
A. A parameter: a name that holds the value given in the call ✓
B. The value 5 that is passed in the call
Num is the parameter name in the definition. The value in the call, such as 5, is what Num holds while the procedure runs.
2. Given PROCEDURE Show(Num : INTEGER), what does Num hold after CALL Show(5)?
A. Show
B. 5 ✓
The value in the call is stored in the parameter. So Num holds 5 while Show runs.
3. Which statement is true about calling the same procedure twice: CALL Greet(3) then CALL Greet(8)?
A. The parameter holds 3 in the first call and 8 in the second ✓
B. The parameter must be renamed before the second call
The same procedure can be reused with different values. The parameter name stays the same, but the value it holds changes with each call.
4. Which call correctly supplies a value from a variable called Score to PROCEDURE Show(Num : INTEGER)?
A. CALL Show(Num : Score)
B. CALL Show(Score) ✓
A variable can supply the value in a call. The value stored in Score is passed to Num. You do not write the parameter name or its data type in the call.
5. Which is a valid way to give a value to PROCEDURE Show(Num : INTEGER)?
A. CALL Show(2 + 3) ✓
B. CALL Show(Num) (when Num has not been declared in the main program)
An expression can supply the value, so Show(2 + 3) makes Num hold 5. Using the parameter name in the call does not work unless a variable of that name exists in the calling code.

Match the Pairs

PROCEDURE Greet(Name : STRING) → Name is a parameter: a name in the definition that will hold the value given in the call
CALL Greet("Ava") → The value "Ava" is given to the procedure, so the parameter Name holds "Ava" while it runs
The same procedure can be called with different values, so the parameter holds a different value each time → CALL Show(5) CALL Show(9)
A variable can supply the value in a call, and the parameter holds that variable's current value → Score ← 40 CALL Show(Score)
CALL Show(Num : INTEGER) → The call includes the parameter name and data type, which belong in the definition. A call should give a value such as 5.
PROCEDURE Show(5) OUTPUT 5 ENDPROCEDURE → A definition needs a parameter name and type, such as Num : INTEGER, not a fixed value. The value 5 belongs in the call.

Key Term

parameter
A name in the subroutine definition that holds the value given in the call while it runs. With PROCEDURE Show(Num : INTEGER), CALL Show(5) makes Num hold 5.

Fill in the Blanks

1. PROCEDURE Show(Num : INTEGER) OUTPUT Num ENDPROCEDURE
Hint: Type the parameter name that is used inside the procedure body to hold the value passed in.
2. Score ← 8 CALL Show(Score) // Num holds 8 while Show runs
Hint: Type the variable whose value is passed to the procedure in the call.
3. Count ← 4 CALL Show(Count * 2) // Num holds 8 while Show runs
Hint: Type the arithmetic operator that makes the expression give the value in the comment.
4. PROCEDURE Double(Num : INTEGER) OUTPUT Num * 2 ENDPROCEDURE
Hint: Type the parameter name that stands for the value given in the call.
5. CALL Show(2) CALL Show(7) // Same procedure, new value in the call
Hint: Type the name of the procedure being called again with a different value.

Spot the Error

Question 1
A PROCEDURE Greet(Name : STRING)
B OUTPUT "Hello ", "Name"
C ENDPROCEDURE
D CALL Greet("Sam")
Line B — Name is the parameter, so it must not be in quotes. With quotes the program prints the word Name instead of the value in the call. It should be OUTPUT "Hello ", Name.
Question 2
A PROCEDURE Show(Num : INTEGER)
B OUTPUT Number * Number
C ENDPROCEDURE
D CALL Show(4)
Line B — The parameter in the definition is called Num, not Number. Number does not exist, so the line fails. It should be OUTPUT Num * Num.
Question 3
A PROCEDURE Show(5 : INTEGER)
B OUTPUT Num
C ENDPROCEDURE
D CALL Show(5)
Line A — The definition needs a parameter name, not a value. The value 5 is given later in the CALL. It should be PROCEDURE Show(Num : INTEGER).
Question 4
A PROCEDURE Add(A, B : INTEGER)
B Total ← A + B
C OUTPUT Sum
D ENDPROCEDURE
E CALL Add(2, 3)
Line C — The sum was stored in Total, and Sum was never created. The line should be OUTPUT Total.
Question 5
A PROCEDURE Show(Num : INTEGER)
B OUTPUT Num
C ENDFUNCTION
D CALL Show(5)
Line C — A procedure must end with ENDPROCEDURE. ENDFUNCTION is only used to close a function.

Student with a class code? Join your class →