Pearson Edexcel · GCSE · Computer Science

    Course version: Pearson-GCSE-Computer-Science · Version from Mar 2026

    Constructs

    Master the fundamental building blocks of all software: Sequence, Selection, and Iteration. This topic is the core of Computer Science and tests your ability to think like a real programmer, enabling you to read, trace, and write code confidently for the exam.

    • 4 min read
    • 3 worked examples
    • 5 practice questions
    • 6 key terms

    Study Notes

    Overview

    Programming Constructs OverviewOpen full-size image (opens in a new tab)

    Welcome to Programming Constructs! This topic is the beating heart of Computer Science. Whether you are building a simple calculator or the software that runs a Mars rover, every single program is built from just three fundamental structural components: Sequence, Selection, and Iteration.

    Understanding these constructs is crucial because examiners don't just want you to memorise definitions; they want to see you apply them to solve problems. This topic connects deeply to algorithms, data representation, and computational thinking. Typical exam questions will ask you to write code snippets, trace algorithms using trace tables, or identify logic errors where these constructs have been used incorrectly.

    Key Concepts

    Concept 1: The Three Core Constructs

    Every program relies on these three building blocks. Examiners expect you to identify them and use them appropriately.

    The Three Core ConstructsOpen full-size image (opens in a new tab)

    1. Sequence: This is the default behaviour of a program. Instructions are executed one after another, in the exact order they are written, from top to bottom. If you write print("A") before print("B"), "A" will always appear first.
    2. Selection: This allows a program to make decisions. It uses conditions (which evaluate to True or False) to determine which path of code to execute. We typically use if, elif, and else statements. Think of it like a fork in the road.
    3. Iteration: This is looping—repeating a block of code. There are two main types you must master:
      • Count-controlled iteration (for loops): Used when you know exactly how many times the code needs to repeat.
      • Condition-controlled iteration (while loops): Used when you don't know how many times the code needs to repeat; it loops until a condition becomes False.

    Concept 2: Variables and Constants

    Programs need to store data while they run.

    • A variable is a named memory location whose value can change while the program is running (e.g., playerScore = 10).
    • A constant is a named memory location whose value cannot change while the program is running (e.g., PI = 3.14159).

    Why use constants? They make code more readable and easier to maintain. If a fixed value changes in the future (like a VAT rate), you only have to update it in one place at the top of your code, rather than hunting through hundreds of lines.

    Concept 3: Subprograms (Procedures vs Functions)

    As programs get larger, they become harder to read and debug. We solve this by breaking them down into smaller, reusable blocks called subprograms.

    Procedures vs FunctionsOpen full-size image (opens in a new tab)

    There is a critical distinction examiners test every year:

    • Procedures: Perform a specific task but do not return a value to the main program. (e.g., clearing the screen).
    • Functions: Perform a specific task and return a value to the main program using a return statement. (e.g., calculating an area and returning the result).

    Both can accept parameters—values passed into the subprogram to give it the data it needs to work.

    Concept 4: Variable Scope (Global vs Local)

    Where you declare a variable determines where it can be used.

    Global vs Local Variable ScopeOpen full-size image (opens in a new tab)

    • Global Variables: Declared outside any subprogram. They can be accessed and modified from anywhere in the entire program.
    • Local Variables: Declared inside a specific subprogram. They can only be accessed within that subprogram and are destroyed when the subprogram finishes running.

    Examiner Tip: Always prefer local variables! They keep subprograms self-contained and prevent accidental changes to data from other parts of the program.

    Podcast Episode

    Listen to our 10-minute revision podcast covering all the core concepts, common exam mistakes, and a quick-fire recall quiz!

    Check what you remember

    Read the wording for your board, then hide it and explain Sequence in your own words. Rough notes are fine. This is a self-check, with no mark or grade.

    Reference: Pearson Edexcel

    The execution of statements one after another, in the order they are written.
    Pearson Edexcel

    Interactive Diagrams

    2 interactive diagrams to visualise key concepts

    Conceptual Flow Outline

    Start
    ➔Input Age
    Input Age
    ➔Is Age >= 18?
    Is Age >= 18?
    ➔"Yes"Print 'Adult'
    ➔"No"Print 'Minor'
    Print 'Adult'
    ➔End
    Print 'Minor'
    ➔End

    A flowchart demonstrating the Selection construct using a condition.

    Conceptual Flow Outline

    Start
    ➔Set count = 0
    Set count = 0
    ➔Is count < 5?
    Is count < 5?
    ➔"Yes"Print 'Hello'
    ➔"No"End
    Print 'Hello'
    ➔count = count + 1
    count = count + 1
    ➔Is count < 5?

    A flowchart demonstrating Condition-Controlled Iteration (a while loop).

    Worked Examples

    3 worked examples — open one to explore the question and available guidance.

    Practice Questions

    Try the question, then reveal an answer plan or example response

    Q1

    Identify the programming construct used in the following code: for i in range(10): print(i)

    1 mark
    foundation

    Hint: Look at the keyword 'for'. Does it make a decision, or does it repeat?

    Q2

    State two advantages of using subprograms in a large software project.

    2 marks
    standard

    Hint: Think about what happens if you find a bug, or if multiple people are working on the code.

    Q3

    A student has written a program with a variable total declared inside a function called calculate(). They try to print(total) in the main program, but get an error. Explain why.

    2 marks
    standard

    Hint: Think about the scope of the variable total.

    Q4

    Write a function called is_even that takes an integer as a parameter and returns True if the number is even, and False if it is odd.

    4 marks
    challenging

    Hint: You will need to use the modulo operator (MOD or %) to check for a remainder when divided by 2.

    Q5

    Explain the difference between count-controlled iteration and condition-controlled iteration, giving an example of when you would use each.

    4 marks
    challenging

    Hint: Compare 'for' loops with 'while' loops based on what you know *before* the loop starts.

    Ready to test yourself interactively?

    Active recall beats reading alone. Answer questions on Constructs with instant AI scoring and mark scheme guidance.

    Start interactive practice

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    Exam technique

    How to turn what you know into marks

    How to approach the question

    When asked to write code, always draft a quick flowchart or bulleted list first. Identify which constructs (SSI) you need before writing syntax. Check your loops to ensure they don't run infinitely.

    How to structure your answer

    For code writing: Declare variables -> Get inputs -> Process (SSI) -> Output. For theory questions: Define the term -> Give an example -> Explain why it is used.

    Timing

    Approximately 1 minute per mark. A 6-mark algorithm question should take about 6-7 minutes.

    Common pitfalls

    • Confusing '=' (assignment) with '==' (comparison) in IF statements.
    • Writing a function but forgetting to include the 'return' statement at the end.
    • Creating an infinite loop by forgetting to update the condition variable inside a while loop.

    What the command words want

    Compare
    Identify similarities AND differences. E.g., 'Both procedures and functions are subprograms, BUT functions return a value while procedures do not.'
    Explain
    Say HOW or WHY. Use 'because' to link your point to a reason.
    Describe
    Set out characteristics. If asked to describe a function, state what it does and that it returns a value.
    State/Give
    Provide a brief factual answer - usually 1 sentence or just the keyword.
    Write/Output
    Produce code or pseudocode. Focus on logic over perfect syntax, but ensure indentation is clear.
    Watch or listen (optional)
    🎙 Podcast Episode
    Constructs
    0:00-0:00

    Test your understanding of Constructs

    Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.

    Take topic quiz

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge