← IGCSE Computer Science Paper 2

Parameter

An identifier in a subroutine definition that receives a value when the subroutine is called. It is used like a variable inside the subroutine and has a data type.

Understanding Parameter in IGCSE Computer Science Paper 2

What it does: Num is a parameter, and the body uses it in a calculation just like a normal variable. The value 20 in the call is passed to the parameter Price in the definition, replacing it for that call. Each parameter needs a data type, so Score : INTEGER is correct. Cambridge 0478 questions use subroutines with up to three parameters. The definition lists parameter names with their data types. It never contains values like 5. The value "Sam" is substituted for the parameter Name, so inside the procedure Name holds "Sam". A subroutine can have more than one parameter (up to three in this course), and each one receives its own value.

Common mistakes: The parameter is called Name, so the body must use Name. Person was never declared, so it holds no value. It should be OUTPUT "Hi ", Name. Every parameter in a subroutine definition needs a data type. It should be PROCEDURE Sq(Num : INTEGER).

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 describes a parameter?
The value written in brackets after the subroutine name in a CALLAn identifier in the subroutine definition that receives a value
Matches
PROCEDURE Greet(Name)
↓
The parameter has no data type. It should be written as Name : STRING.
Applying
Meanings
Term
parameter
Meaning
An identifier in a subroutine definition that receives a value when the subroutine is called. It is used like a variable inside the subroutine and has a data type.
Practice
PROCEDURE Greet(Name : STRING, Times : INTEGER)
Testing
Gaps
PROCEDURE ShowDouble( : INTEGER)
Check Answer
Spots
1PROCEDURE Greet(Name : STRING)
2 OUTPUT "Hi ", Person

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

The 'Hermit Crab' badge — Definition Collector, 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 describes a parameter?
A. An identifier in the subroutine definition that receives a value ✓
B. The value written in brackets after the subroutine name in a CALL
A parameter is the named identifier in the definition. The value passed in at the call is the argument.
2. Which line defines a procedure with a parameter?
A. PROCEDURE ShowScore(Score : INTEGER) ✓
B. PROCEDURE ShowScore(Score)
Each parameter needs a data type, so Score : INTEGER is correct.
3. Inside the subroutine, how is a parameter used?
A. Only as a constant that can never be read
B. Like a variable, for example OUTPUT Score ✓
A parameter is used like a variable inside the subroutine. Its value is the one passed in at the call.
4. When does a parameter get its value?
A. Each time the subroutine is called ✓
B. Only once, when the program starts
A new value is substituted for the parameter at each call, so CALL ShowScore(10) and CALL ShowScore(20) give different values.
5. In FUNCTION Double(Num : INTEGER) RETURNS INTEGER, what is Num?
A. The value returned by the function
B. A parameter with the data type INTEGER ✓
Num is the parameter. The data type after RETURNS is what the function gives back.

Match the Pairs

PROCEDURE Greet(Name : STRING) → Name is a parameter: an identifier in the definition that receives a value and has the data type STRING
FUNCTION Area(Length : INTEGER, Width : INTEGER) RETURNS INTEGER → Length and Width are two parameters, each receiving a value when Area is called
A parameter is used like a variable inside the subroutine body → PROCEDURE ShowDouble(Num : INTEGER) OUTPUT Num * 2 ENDPROCEDURE
At each call a value is substituted for the parameter, so Price takes the value 20 here → CALL ShowPrice(20)
PROCEDURE Greet(Name) → The parameter has no data type. It should be written as Name : STRING.
FUNCTION Total(A : INTEGER, B : INTEGER, C : INTEGER, D : INTEGER) RETURNS INTEGER → Four parameters are used, but this course allows up to three parameters.

Key Term

parameter
An identifier in a subroutine definition that receives a value when the subroutine is called. It is used like a variable inside the subroutine and has a data type.

Fill in the Blanks

1. PROCEDURE ShowDouble(Num : INTEGER) OUTPUT Num * 2 ENDPROCEDURE
Hint: Type the parameter name that the body of the procedure uses like a variable.
2. PROCEDURE ShowName(Name : STRING) OUTPUT "Hello, " & Name ENDPROCEDURE
Hint: Type the data type that suits a parameter holding text.
3. PROCEDURE Area(Length : REAL, Width : REAL) OUTPUT Length * Width ENDPROCEDURE
Hint: Type the name of the second parameter, which is used in the calculation below.
4. FUNCTION Half(Num : INTEGER) RETURNS REAL RETURN Num / 2 ENDFUNCTION
Hint: Type the parameter name whose value is divided and returned.
5. PROCEDURE Check(Passed : BOOLEAN) OUTPUT NOT Passed ENDPROCEDURE
Hint: Type the data type of a parameter that can only be TRUE or FALSE.

Spot the Error

Question 1
A PROCEDURE Greet(Name : STRING)
B OUTPUT "Hi ", Person
C ENDPROCEDURE
D CALL Greet("Sam")
Line B — The parameter is called Name, so the body must use Name. Person was never declared, so it holds no value. It should be OUTPUT "Hi ", Name.
Question 2
A PROCEDURE Sq(Num)
B OUTPUT Num * Num
C ENDPROCEDURE
D CALL Sq(5)
Line A — Every parameter in a subroutine definition needs a data type. It should be PROCEDURE Sq(Num : INTEGER).
Question 3
A PROCEDURE Show(INTEGER : N)
B OUTPUT "Value: ", N
C ENDPROCEDURE
D CALL Show(7)
Line A — The parameter name comes first, then a colon, then the data type. It should be PROCEDURE Show(N : INTEGER).
Question 4
A PROCEDURE Show(Age : INTEGER)
B OUTPUT "Age: ", "Age"
C ENDPROCEDURE
D CALL Show(15)
Line B — Quotes around Age make it plain text, so the word Age is printed. The parameter must be written without quotes to output the value received. It should be OUTPUT "Age: ", Age.
Question 5
A PROCEDURE Greet(Name : STRING)
B OUTPUT "Hello ", Name
C ENDPROCEDURE
D CALL Greet(42)
Line D — The parameter Name has data type STRING, so the value passed in must be a STRING. 42 is an INTEGER. It should be CALL Greet("Sam").

Student with a class code? Join your class →