8.3

Procedures and functions

Cambridge IGCSE Computer Science (0478)  · Unit 8: Programming  · 10 flashcards

Procedures and functions is topic 8.3 in the Cambridge IGCSE Computer Science (0478) syllabus , positioned in Unit 8 — Programming , alongside Programming concepts and Data structures.  In one line: A procedure (or subroutine) is a block of code that performs a specific task. Its primary purpose is to modularize code, making it reusable and easier to manage by breaking down larger programs into smaller, self-contained units.

This topic is examined in Paper 1 (computer systems theory) and Paper 2 (algorithms, programming and logic).

The deck below contains 10 flashcards — 9 definitions and 1 key concept — covering the precise wording mark schemes reward.  Use the 9 definition cards to lock down command-word answers (define, state), then move on to the concept and application cards to handle explain, describe and compare questions.

Key definition

The term 'procedure' in programming, and state its primary purpose

A procedure (or subroutine) is a block of code that performs a specific task. Its primary purpose is to modularize code, making it reusable and easier to manage by breaking down larger programs into smaller, self-contained units.

What the Cambridge 0478 syllabus says

Official 2026-2028 spec

These are the exact learning objectives Cambridge sets for this topic. Match the command word (Describe, Explain, State, etc.) in your answer to score full marks.

  1. Understand Understand the purpose of storing data in a file to be used by a program
  2. Open Open, close and use a file for reading and writing including read and write single items of data and read and write a line of text
Definition Flip

Define the term 'procedure' in programming, and state its primary purpose.

Answer Flip

A procedure (or subroutine) is a block of code that performs a specific task. Its primary purpose is to modularize code, making it reusable and easier to manage by breaking down larger programs into smaller, self-contained units.

Key Concept Flip

Explain the difference between a 'function' and a 'procedure'.

Answer Flip

Both functions and procedures are reusable blocks of code. A function, unlike a procedure, *must* return a value after execution. Procedures may or may not return values.

Definition Flip

What is a 'parameter' in the context of procedures and functions? Give an example.

Answer Flip

A parameter is a variable that is passed into a procedure or function when it is called.

Example: In `procedure calculateArea(length, width)`, `length` and `width` are parameters.
Definition Flip

What is an 'argument' in the context of procedures and functions? How does it relate to a parameter?

Answer Flip

An argument is the actual value that is passed to a procedure or function when it is called, corresponding to a parameter in the function definition. For

Example: If calling `calculateArea(5, 10)`, 5 and 10 are the arguments.
Definition Flip

Explain what is meant by 'returning a value' from a function. Provide a simple example.

Answer Flip

Returning a value means that a function sends a result back to the part of the code that called the function.

Example: a function `add(x,y)` could `return x + y;`, with the sum then used elsewhere.
Definition Flip

What is a 'local variable' and what is its 'scope'?

Answer Flip

A local variable is declared inside a procedure or function. Its scope is limited to that procedure or function, meaning it can only be accessed within that block of code.

Example: if a function calculates the area of a circle, the variable 'radius' declared inside that function is local and inaccessible outside of it.
Definition Flip

Describe a 'global variable' and its primary advantage and disadvantage.

Answer Flip

A global variable is declared outside any procedure or function, accessible throughout the program. Advantage: facilitates data sharing between different parts of the code. Disadvantage: increased debugging complexity due to potential unintended modifications from anywhere in the program.

Example: if `score = 100` globally, any function can change it, making it hard to track down errors.
Definition Flip

Define the term 'scope' in the context of variables.

Answer Flip

Scope refers to the region of a program where a variable can be accessed. It determines the visibility and lifetime of a variable.

Example: a variable declared inside a function (local scope) cannot be directly accessed outside that function, while a variable declared outside all functions (global scope) can be accessed throughout the program.
Definition Flip

Explain the process of 'calling' a procedure or function.

Answer Flip

Calling a procedure or function means executing the code within that block. This is done by using the procedure/function name followed by parentheses (containing arguments, if any).

Example: `calculateArea(5,10);`
Definition Flip

What is a 'library' in programming, and how do procedures and functions relate to it?

Answer Flip

A library is a collection of pre-written, reusable procedures and functions. It saves time by allowing programmers to use existing code for common tasks instead of writing it themselves.

Example: in Python, `math.sqrt(25)` uses the `sqrt` function from the `math` library to calculate the square root of 25.

Review the material

Read revision notes with definitions, equations, and exam tips.

Read Notes

Test yourself

Practice with MCQ questions to check your understanding.

Take Computer Science Quiz
8.2 Data structures 9.1 Database concepts

Key Questions: Procedures and functions

Define the term 'procedure' in programming, and state its primary purpose.

A procedure (or subroutine) is a block of code that performs a specific task. Its primary purpose is to modularize code, making it reusable and easier to manage by breaking down larger programs into smaller, self-contained units.

What is a 'parameter' in the context of procedures and functions? Give an example.

A parameter is a variable that is passed into a procedure or function when it is called.

Example: In `procedure calculateArea(length, width)`, `length` and `width` are parameters.
What is an 'argument' in the context of procedures and functions? How does it relate to a parameter?

An argument is the actual value that is passed to a procedure or function when it is called, corresponding to a parameter in the function definition. For

Example: If calling `calculateArea(5, 10)`, 5 and 10 are the arguments.
Explain what is meant by 'returning a value' from a function. Provide a simple example.

Returning a value means that a function sends a result back to the part of the code that called the function.

Example: a function `add(x,y)` could `return x + y;`, with the sum then used elsewhere.
What is a 'local variable' and what is its 'scope'?

A local variable is declared inside a procedure or function. Its scope is limited to that procedure or function, meaning it can only be accessed within that block of code.

Example: if a function calculates the area of a circle, the variable 'radius' declared inside that function is local and inaccessible outside of it.

More topics in Unit 8 — Programming

Procedures and functions sits alongside these Computer Science decks in the same syllabus unit. Each uses the same spaced-repetition system, so progress in one informs the next.

Cambridge syllabus keywords to use in your answers

These are the official Cambridge 0478 terms tagged to this section. Mark schemes credit responses that use the exact term — weave them into your answers verbatim rather than paraphrasing.

procedure function subroutine parameter argument return local variable global variable scope call library

Key terms covered in this Procedures and functions deck

Every term below is defined in the flashcards above. Use the list as a quick recall test before your exam — if you can't define one of these in your own words, flip back to that card.

The term 'procedure' in programming, and state its primary purpose
'parameter' in the context of procedures and functions? Give an example
'argument' in the context of procedures and functions? How does it relate to a parameter
Explain what is meant by 'returning a value' from a function. Provide a simple example
'local variable' and what is its 'scope'
Describe a 'global variable' and its primary advantage and disadvantage
The term 'scope' in the context of variables
Explain the process of 'calling' a procedure or function
'library' in programming, and how do procedures and functions relate to it

How to study this Procedures and functions deck

Start in Study Mode, attempt each card before flipping, then rate Hard, Okay or Easy. Cards you rate Hard come back within a day; cards you rate Easy push out to weeks. Your progress is saved in your browser, so come back daily for 5–10 minute reviews until every card reads Mastered.