Knowledge Organiser: Subprograms (Functions & Procedures)

Part of Bubble Sort · Section 9 of 9

Topic SummaryUnit: 3.1 Fundamentals of AlgorithmsGCSE

This topic summary covers Knowledge Organiser: Subprograms (Functions & Procedures) within Bubble Sort for GCSE Computer Science. Revise Bubble Sort in 3.1 Fundamentals of Algorithms for GCSE Computer Science with 16 exam-style questions and 10 flashcards. This topic appears regularly enough that it should still be part of a steady revision cycle. It is section 9 of 9 in this topic. Use this topic summary to connect the idea to the wider topic before moving on to questions and flashcards.

Knowledge Organiser: Subprograms (Functions & Procedures)

Key Terms
  • Subprogram: A named block of code that can be called multiple times
  • Function: A subprogram that performs a task AND returns a value
  • Procedure: A subprogram that performs a task but does NOT return a value
  • Parameter: A variable in the subprogram definition that receives an input value
  • Argument: The actual value passed to a subprogram when calling it
  • Return value: The output sent back from a function using the return keyword
Must-Know Facts
  • Functions ALWAYS return a value; procedures NEVER return a value
  • Subprograms improve reusability — write once, call many times
  • Each subprogram can be tested independently
  • Subprograms make code easier to read and maintain
  • Bugs fixed inside a subprogram are fixed everywhere it is used
Key Concepts
  • Declare a function: function name(param) ... return value ... endfunction
  • Declare a procedure: procedure name(param) ... endprocedure
  • Call a function: result = calculateArea(5, 3)
  • Parameters are placeholders; arguments are the real values passed in
  • Functions can be used in expressions; procedures cannot
Common Mistakes
  • Confusing functions and procedures: A function RETURNS a value; a procedure does NOT — this distinction is frequently tested and often answered incorrectly
  • Confusing parameters and arguments: Parameters are the placeholders in the function definition; arguments are the actual values passed when calling the function
  • Saying subprograms run faster: Subprograms do not make code faster — they improve readability, reusability, and maintainability, not execution speed
  • Forgetting to use the return value from a function: A function's return value must be stored or used — calling a function without capturing its return is wasted output
  • Not indenting subprogram bodies in pseudocode: The body of a function or procedure must be indented — examiners expect correct pseudocode structure

Practice questions for Bubble Sort

Which of the following best describes bubble sort?

  • A. It selects the smallest element and moves it to the front each pass
  • B. It compares adjacent elements and swaps them if they are in the wrong order
  • C. It divides the list in half repeatedly until each half is sorted
  • D. It inserts each element into its correct position one at a time
1 markfoundation

Describe how bubble sort works. You should refer to what happens during each pass through the list. [3 marks]

3 marksstandard

Quick recall flashcards

How does bubble sort work?
Compare adjacent pairs, swap if wrong order, repeat passes
Why is it called bubble sort?
Largest values bubble up to the end like bubbles rising in water

16 questions on Bubble Sort — practise free

Instant marking, adaptive difficulty and spaced-repetition flashcards — all aligned to your exam board.

Start revising free →