3.1 Fundamentals of AlgorithmsIntroduction

Reusable Code Blocks

Part of Bubble Sort · GCSE GCSE Computer Science revision

This introduction covers Reusable Code Blocks 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 2 of 9 in this topic. Use this introduction to connect the idea to the wider topic before moving on to questions and flashcards.

Topic position

Section 2 of 9

Practice

16 questions

Recall

10 flashcards

Reusable Code Blocks

Imagine writing instructions for making tea. Instead of writing "boil water" every time, you could say "see 'boiling water' instructions on page 5". Subprograms (functions and procedures) work the same way - write code once, use it many times by "calling" it. Functions return a value (like a vending machine giving you a drink). Procedures just do something (like pressing a button that turns on a light).

Keep building this topic

Read this section alongside the surrounding pages in Bubble Sort. That gives you the full topic sequence instead of a single isolated revision point.

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

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

16 questions on Bubble Sort — practise free

Instant marking, adaptive difficulty, and 10 spaced repetition flashcards. Free until your GCSEs.

Try PrepWise Free