📁 Paper 1 · 3.2 Programming
3.2.10b Parameters & Return Values
AQA 8525 · GCSE Computer Science · ~10 min read
Notes
──
Video
──
Worksheet
──
Quiz

Parameters — Passing Data In

A parameter is a named variable in a subroutine definition that receives a value when the subroutine is called. The actual value passed is called an argument.

// 'name' is the PARAMETER (in the definition) SUBROUTINE greet(name) OUTPUT "Hello, " + name ENDSUBROUTINE // "Alice" is the ARGUMENT (the actual value passed) greet("Alice") // Outputs: Hello, Alice greet("Bob") // Outputs: Hello, Bob

Multiple Parameters

A subroutine can take multiple parameters, separated by commas. Arguments must be passed in the same order as the parameters.

SUBROUTINE printScoreCard(name, score, maxScore) percentage ← (score / maxScore) * 100 OUTPUT name + " scored " + str(score) + "/" + str(maxScore) OUTPUT "Percentage: " + str(percentage) + "%" ENDSUBROUTINE printScoreCard("Alice", 85, 100) printScoreCard("Bob", 42, 60)

Passing by Value

In AQA, parameters are passed by value — a copy of the argument's value is made. Changes to the parameter inside the subroutine do NOT affect the original variable.

SUBROUTINE doubleIt(x) x ← x * 2 // Changes the LOCAL copy of x OUTPUT x // Outputs: 20 ENDSUBROUTINE num ← 10 doubleIt(num) OUTPUT num // Still 10 — the original is unchanged

Return Values

A function uses RETURN to send a computed value back to the caller. The return value can be stored in a variable, used in an expression, or used directly in OUTPUT.

SUBROUTINE power(base, exp) result ← 1 FOR i ← 1 TO exp result ← result * base ENDFOR RETURN result ENDSUBROUTINE OUTPUT power(2, 8) // 256 x ← power(3, 4) // x = 81 OUTPUT power(5, 2) + 1 // 26 — used in expression

Parameter vs Argument — Summary

TermWhere?Example
ParameterIn the subroutine definitionSUBROUTINE greet(name)
ArgumentWhen calling the subroutinegreet("Alice")

Worked Example — BMI Calculator

SUBROUTINE calcBMI(weight, height) bmi ← weight / (height * height) RETURN bmi ENDSUBROUTINE SUBROUTINE classifyBMI(bmi) IF bmi < 18.5 THEN OUTPUT "Underweight" ELSEIF bmi < 25 THEN OUTPUT "Healthy" ELSEIF bmi < 30 THEN OUTPUT "Overweight" ELSE OUTPUT "Obese" ENDIF ENDSUBROUTINE w ← float(INPUT("Weight (kg): ")) h ← float(INPUT("Height (m): ")) myBMI ← calcBMI(w, h) classifyBMI(myBMI)
Exam tip: Know the difference between parameter (in the definition — it is a placeholder) and argument (actual value passed when calling). AQA exams test whether changes inside a subroutine affect the original variable — the answer is no, because AQA uses pass by value.
⚠️ Common Mistakes
  • Passing arguments in the wrong order — first argument goes to first parameter
  • Assuming a procedure changes the original variable — pass by value makes a copy
  • Forgetting to store or use the return value — calling a function without capturing the result
  • Using the wrong number of arguments — must match the number of parameters
Video coming soon

Key points

  • Parameters are placeholders in the definition; arguments are values when calling
  • Multiple parameters separated by commas; must match in order
  • Pass by value — changes inside don't affect the original
  • Return values can be stored, used in expressions, or output directly
Click slide or press arrow keys to navigate
✍️

Worksheet — 3.2.10b Parameters

8 questions · 22 marks

Q1State the difference between a parameter and an argument.[2]
✅ Mark scheme
Mark scheme
A parameter is a variable in the subroutine definition that acts as a placeholder [1]; an argument is the actual value passed when the subroutine is called [1].
Q2Write a function 'area' with parameters length and width that returns their product.[3]
✅ Mark scheme
Mark scheme
SUBROUTINE area(length, width) [1]; RETURN length * width [1]; ENDSUBROUTINE [1].
Q3What will be output? x ← 5; SUBROUTINE addTen(n) n ← n + 10 OUTPUT n ENDSUBROUTINE; addTen(x); OUTPUT x[2]
✅ Mark scheme
Mark scheme
15 (from OUTPUT n inside the subroutine) [1]; 5 (from OUTPUT x — the original is unchanged because AQA passes by value) [1].
Q4Write a function 'fullName' that takes firstName and lastName as parameters and returns them joined with a space.[3]
✅ Mark scheme
Mark scheme
SUBROUTINE fullName(firstName, lastName) [1]; RETURN firstName & " " & lastName [1]; ENDSUBROUTINE [1].
Q5Explain what 'pass by value' means in the context of subroutine parameters.[2]
✅ Mark scheme
Mark scheme
Pass by value means a copy of the argument's value is passed to the subroutine [1]; changes to the parameter inside the subroutine do NOT affect the original variable in the calling code [1].
Q6A function 'hypotenuse' takes two sides of a right-angled triangle (a, b) and returns √(a²+b²). Write it in AQA pseudo-code.[3]
✅ Mark scheme
Mark scheme
SUBROUTINE hypotenuse(a, b) [1]; RETURN (a^2 + b^2)^0.5 (or equivalent with sqrt) [1]; ENDSUBROUTINE [1].
Q7Write code to call the function 'area' with arguments 8 and 5, store the result in 'roomArea', and output it.[2]
✅ Mark scheme
Mark scheme
roomArea ← area(8, 5) [1]; OUTPUT roomArea [1].
Q8Write a complete program with a function 'vatPrice' that adds 20% VAT to a price, then calls it for prices £100, £50, and £75, outputting each result.[5]
✅ Mark scheme
Mark scheme
SUBROUTINE vatPrice(price) RETURN price * 1.2 ENDSUBROUTINE [2]; OUTPUT vatPrice(100) [1]; OUTPUT vatPrice(50) [1]; OUTPUT vatPrice(75) [1].
Check your answers above.
Topic Quiz
Q 1 of 10
You scored
out of 10
Card 1 of 5
Click to flip
🎉
All done!
TermDefinition
🎯

Mini Test — 3.2.10b Parameters

Timed exam conditions.

  • 8 questions · 10 minutes
  • 5 MCQ + 3 short answer
← 3.2.10a Subroutines
21 of 57 · AQA 8525
3.2.11a Structured Programming →