Software Design & Development · Implementation

SDD8 — Parameter Passing

📅 Tue 23 Jun 2026 · P3 (single)
~60 minutes
Learning intentions
Success criteria
Warm up — recap from SDD7
Answer all three questions, then check your answers.
Question 1
What is the term for a sub-program that returns a value and can be used inside an expression?
Question 2
What is the term for a sub-program that performs an action but does not return a value?
Question 3
In Python, what value does a function implicitly produce if it has no return statement anywhere inside it?

Key vocabulary

Formal parameter
The name written inside a sub-program's own definition to represent one of its inputs.
Actual parameter
The real value or variable supplied when a sub-program is called, matched to a formal parameter.
Parameter list
The full set of formal parameters written inside the brackets of a sub-program's definition, in order.
Positional matching
Matching each actual parameter to a formal parameter based on its position in the list, not its name.
Argument
A general term (used in SDD7) covering both formal and actual parameters — this lesson uses the more precise pair of terms instead.

Matching values to a sub-program's inputs

What is a formal parameter?

A formal parameter is the name written inside a sub-program's own definition to represent one of its inputs. In def isAffordable(price, budget):, both price and budget are formal parameters — they are placeholders, existing only to describe what kind of input the function expects and how that input will be referred to inside the function's own code. A formal parameter has no value of its own until the sub-program is actually called.

What is an actual parameter?

An actual parameter is the real value or variable supplied at the point where a sub-program is called. In the call isAffordable(75, 100), 75 and 100 are actual parameters — real data being handed into the function for this particular call. An actual parameter does not have to be a literal value like 75; it can equally be a variable, such as isAffordable(itemPrice, budgetLimit), or even an expression, such as an element of a record like itemRecords[2]. Whatever form it takes, its role is the same: supplying one real input for this specific call.

How actual parameters are matched to formal parameters

Actual parameters are matched to formal parameters by position, not by name. The first actual parameter in a call is matched to the first formal parameter in the definition, the second actual parameter to the second formal parameter, and so on. This is exactly why calling isAffordable(75, 100) sets price to 75 and budget to 100 — not because the names "match" in any way, but purely because of the order in which the values appear. The formal parameter's name and the actual parameter's name (if it has one, as with a variable) never need to be the same, and usually are not.

Why this matters when tracing code

Because matching is entirely positional, swapping the order of two actual parameters in a call silently changes what each formal parameter receives, without causing any error — the code still runs, it just runs on the wrong data. This makes parameter order a genuine source of quietly incorrect programs, and a common focus for exam questions that ask you to trace through a call and state what a sub-program actually receives and returns.

This links back directly to SDD7's idea of modular design. A function or procedure is only reliable as a reusable building block if every call site supplies its actual parameters in the correct order — the sub-program itself has no way of checking whether the values it receives make sense for the names it was given, since by the time it runs, the formal parameters are simply bound to whatever values arrived in whatever order they arrived. Careful, consistent ordering at every call site is therefore part of writing dependable modular code, not a minor detail.

Formal and actual parameters, side by side

Call (actual)
75 100
Definition (formal)
price budget

In isAffordable(75, 100) calling def isAffordable(price, budget): — the first actual parameter (75) is matched to the first formal parameter (price), and the second actual parameter (100) to the second formal parameter (budget), purely by position.

Worked examples

Example 1 — Formal and actual parameters with literal values
1
def isAffordable(price, budget):
    return price <= budget

isAffordable(75, 100)
2
The def line declares two formal parameters: price and budget. The call supplies two actual parameters: 75 and 100.
By position, price receives 75 and budget receives 100. 75 <= 100 is True, so the call returns True.
Example 2 — Actual parameters can be variables, not just literals
1
itemPrice = 90
budgetLimit = 80
isAffordable(itemPrice, budgetLimit)
2
Here, the actual parameters are the variables itemPrice and budgetLimit, not literal numbers. Positional matching still applies exactly the same way: whatever value itemPrice holds is matched to the formal parameter price, and whatever value budgetLimit holds is matched to budget.
price receives 90, budget receives 80. 90 <= 80 is False, so the call returns False — notice the variable names itemPrice/budgetLimit never need to match the formal parameter names price/budget.
Example 3 — An actual parameter can be a record accessed from an array
1
Using SDD6/SDD7's tuck shop records:
def isInStock(record):
    return record.stock > 0

isInStock(itemRecords[2])
where itemRecords[2] = Item("Chocolate", 75, 30).
2
The single formal parameter is record. The single actual parameter is the expression itemRecords[2], which evaluates to the whole Chocolate record before being passed in.
Inside the function, record.stock is 30, and 30 > 0 is True — the call returns True.
Now you try
def calculateChange(amountPaid, price):
    return amountPaid - price

calculateChange(100, 75)
Identify: the formal parameters, the actual parameters, and the value this call returns.
⚠️ Common mistakes — examiner feedback
📝 Exam tip

When asked to identify a formal or actual parameter in a piece of code, point to the exact line: formal parameters are named in the def line; actual parameters appear in the call. Naming the correct term without locating it in the right line rarely earns full marks — examiners expect the distinction to be tied to specific code, not just defined in the abstract.

Task Set A — Core questions

Task Set A — Core questions
Work through all questions, then check your answers.
Question 1
What term describes the name used for a parameter inside a sub-program's own definition?
Question 2
What term describes the real value or variable supplied when a sub-program is called?
Question 3
def isAffordable(price, budget):
    return price <= budget

isAffordable(75, 100)
Which of these is a formal parameter in this code?
Question 4
Using the same code as Question 3, which of these is an actual parameter in the call isAffordable(75, 100)?
Question 5
Using def isAffordable(price, budget):, calling isAffordable(90, 80) matches the actual parameter 90 to which formal parameter?
Question 6
How are actual parameters matched to formal parameters, in the way used throughout this course?
Question 7
Using def isInStock(record): return record.stock > 0, and calling isInStock(itemRecords[2]) where itemRecords[2] = Item("Chocolate", 75, 30), what does the call return?
Question 8
Write a Python function called calculateChange with two formal parameters, amountPaid and price, that returns the change due (amountPaid minus price). Then write a call to this function using the actual parameters 100 and 75.
def calculateChange(amountPaid, price):
    return amountPaid - price

calculateChange(100, 75)
Question 9
Explain the difference between a formal parameter and an actual parameter, using calculateChange as your example. (3 marks)
Question 10
Describe what would happen if a pupil accidentally called calculateChange(75, 100) instead of calculateChange(100, 75), and explain why this is a risk specific to positional matching. (3 marks)

Task Set B — Extension

Task Set B — Extension · Beyond the specification
Longer written answers — no auto-check. Discuss your answers with your teacher.
Extension 1
SDD9 will introduce local and global scope. Suggest why a formal parameter's name, such as price inside isAffordable, is not accessible anywhere outside that function.
Extension 2
Python also allows calling a function using keyword arguments, e.g. isAffordable(budget=100, price=75), where the order no longer matters. Suggest one advantage of this over strictly positional matching, and one reason it isn't the primary method emphasised at this level.
Extension 3
A sub-program is defined with three formal parameters, but a pupil's call only supplies two actual parameters. Predict what happens when this code runs in Python, and suggest why this might be marked differently in an exam context.
📁 File this in OneNote under:
Higher Computing Science → Software Design & Development → SDD8
📌 Teacher notes — not for pupils

Single period — this is a focused, narrower topic than SDD5–7, building directly on SDD7's functions/procedures rather than introducing a new scenario.

Suggested timing: 5 min warm-up + vocab · 15 min notes + param-map visual (live-code example 1 and print() the values inside the function to prove the matching) · 10 min examples 2–3 · 5 min "now you try" · 25 min Task Set A · Task Set B as homework.

Key misconception: pupils often think the formal and actual parameter must share the same name to "work" — deliberately demonstrate example 2 (itemPrice/budgetLimit matching price/budget) live to break this assumption early.

SQA command words covered: describe, explain, identify, trace, predict.

Extension suggestion: Extension 1 sets up SDD9 directly — if time is tight, this can be skipped from class discussion and picked up again as the SDD9 warm-up instead.

Implementation note (5 Jul 2026): Example 3 and Task Set A Question 7 were switched from dictionary-based records to @dataclass-based records after the fact, to match SDD6/SDD7's updated implementation (see SDD6 teacher notes for the full rationale). isInStock now reads record.stock rather than record["stock"].