Skip to topic
    ← Back to course topics

    Programming — AQA GCSE Computer Science

    Test yourself on Programming with AQA GCSE practice questions.

    Start free

    7 days Premium · Then free forever · No card, no charge

    Read the Programming study guideFull revision notes for AQA GCSE Computer Science

    Your focus

    1. Exam questions will explicitly state in what form the response needs to be provided. This will be, for example, pseudo-code, program code or a flowchart, and students must respond as instructed. Where pseudo-code is an accepted method of response, students may present their answers to questions in any suitable format and do not need to use the AQA pseudo-code.

    Programming exam tips

    Quick Revision Summary (Key Takeaway)

    Programming in AQA GCSE Computer Science assesses your ability to design, write, and trace algorithms using sequence, selection, iteration, and structured data handling. Mastering foundational constructs, data types, and subroutines is vital for securing top marks in Paper 1.

    Topic Overview

    The Programming component of AQA GCSE Computer Science develops practical and conceptual skills in translating logical solutions into functional code. It covers fundamental control structures including sequence, selection, and definite and indefinite iteration, alongside data types, data structures, and string handling.

    Understanding programming is essential because it bridges theoretical algorithmic design and tangible software implementation. It accounts for a substantial proportion of Paper 1 assessment marks, testing your ability to write, trace, debug, and refine algorithms using high-level programming languages.

    Key Concepts
    • →The three basic programming constructs: sequence (linear execution), selection (branching with IF-ELSE), and iteration (looping via FOR and WHILE).
    • →Data types and data structures: integers, reals/floats, booleans, characters, strings, and one-dimensional/two-dimensional arrays or lists.
    • →Subroutines (functions and procedures): modular code design, passing arguments by value/reference, and returning values.
    • →String manipulation: slicing, length calculation (LEN), concatenation, and conversion to uppercase or lowercase.
    • →Defensive programming: input validation, sanitisation, error handling, and robust algorithm construction.
    Examiner Tips
    • 💡Trace tables are your best friend: Always write down variable values step-by-step when tracing algorithms to avoid mental arithmetic slips.
    • 💡Use meaningful variable names: When writing freehand pseudocode or Python, descriptive identifiers such as 'totalScore' or 'userAge' reduce errors and make logic clear to the marker.
    • 💡Read the question instructions on language choice: AQA permits pseudocode or an allowed high-level language (like Python or C#). Stick rigidly to consistent syntax.
    Common Mistakes
    • Thinking arrays start at index 1: In almost all GCSE programming contexts and languages, indices are zero-based (index 0 represents the first element).
    • Mixing up functions and procedures: Both are subroutines, but a function always returns a value to the calling environment, whereas a procedure performs a task without returning a value.
    • Confusing indefinite and definite iteration: FOR loops are used when the number of iterations is known prior to execution, whereas WHILE loops run dynamically based on a boolean condition.
    Revision Plan
    1. 1Week 1 (Days 1-3): Review fundamental data types, casting, sequence, and conditional statements (IF, ELIF, ELSE) with concise coding drills.
    2. 2Week 1 (Days 4-7): Practice definite (FOR) and indefinite (WHILE) loops, dry-running each algorithm with detailed trace tables.
    3. 3Week 2 (Days 1-4): Focus on 1D/2D arrays, string operations, and writing custom subroutines (functions returning values vs procedures).
    4. 4Week 2 (Days 5-7): Solve past Paper 1 coding questions under timed exam conditions and mark them against official AQA mark schemes.
    Exam Question Types
    • 📋Code Completion / Bug Fixing: Adding missing lines to pseudocode or identifying syntax and logic errors in provided code.
    • 📋Trace Table Questions: Stepping through an unfamiliar algorithm with dry-run values to complete a grid showing variable states at each iteration.
    • 📋Free-response Algorithm Writing: Designing a complete program or subroutine from a natural language specification (typically 6-9 marks).
    Command Word Expectations (AQA)
    Write

    Produce syntactically valid code or pseudocode fulfilling all requirements in the specification, including variable declarations, correct logic, and output statements.

    State

    Provide a brief, direct fact or value without explanation (e.g. stating the output of a specific subroutine call).

    Explain

    Set out the cause and effect or reasoning behind a programming decision (e.g. why a WHILE loop is more suitable than a FOR loop in a specific context).

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Confusing assignment (=) with equality comparison (==) inside selection conditions.
    ❌ Weak Answer (Loses Marks):IF score = 10 THEN print('Well done')
    Example improved answer:IF score == 10 THEN OUTPUT 'Well done' ENDIF
    Examiner Tip: Always verify your operators in pseudocode or high-level code. In AQA pseudocode and Python, a single '=' assigns a value, while '==' or '=' in specific structured pseudocode compares values. Use double equals to prevent logic errors.
    Pitfall: Off-by-one errors in zero-indexed structures such as arrays, lists, and strings.
    ❌ Weak Answer (Loses Marks):The first character of string name is name[1] and the length is name.length + 1.
    Example improved answer:In zero-indexed languages and AQA pseudocode, the first element is at index 0, and the final element is at index length - 1. For a string of length 5, indices range from 0 to 4.
    Examiner Tip: Carefully trace loop boundary conditions. When looping through an array of size n, run from index 0 to n - 1 or use 'FOR i <- 0 TO LEN(arr) - 1'.
    Step-by-Step Worked Solutions

    Question: A program is required to ask the user to input test scores between 0 and 100 inclusive until -1 is entered. It should output the total count of valid scores entered. Write an algorithm in pseudocode or Python.

    1. 1.Step 1: Initialize a counter variable 'count' to 0 to keep track of valid inputs.
    2. 2.Step 2: Get initial user input before entering a 'WHILE' loop, or use a sentinel-controlled while loop condition.
    3. 3.Step 3: Inside the loop, check if score >= 0 AND score <= 100; if valid, increment count by 1.
    4. 4.Step 4: Prompt for the next score inside the loop until -1 is entered.
    5. 5.Step 5: Output the final value of count once the loop terminates.
    Final Answer: count = 0 score = USERINPUT WHILE score != -1 IF score >= 0 AND score <= 100 THEN count = count + 1 ENDIF score = USERINPUT ENDWHILE OUTPUT count

    Question: An array named 'temps' contains 7 floating-point values representing daily temperatures. Write an algorithm to calculate and output the average temperature.

    1. 1.Step 1: Declare a variable 'total' and initialize it to 0.0.
    2. 2.Step 2: Use a definite loop (FOR loop) iterating through indices 0 to 6 (length of array - 1).
    3. 3.Step 3: Accumulate each array element into 'total'.
    4. 4.Step 4: Divide 'total' by 7 to determine the mean.
    5. 5.Step 5: Output the calculated average.
    Final Answer: total = 0.0 FOR i <- 0 TO LEN(temps) - 1 total = total + temps[i] ENDFOR average = total / LEN(temps) OUTPUT average
    Active Recall Memory Test
    What is the key difference between a function and a procedure?
    Key Fact: A function returns a value to the calling program, whereas a procedure performs actions without returning a value.
    Which string operation extracts the length of a string in AQA pseudocode?
    Key Fact: LEN(stringName)
    What is the outcome of the arithmetic operation 17 MOD 5?
    Key Fact: 2 (MOD calculates the remainder after integer division; 17 divided by 5 is 3 remainder 2).
    What is integer division (DIV) compared to regular division?
    Key Fact: DIV returns only the whole number (quotient) part of the division, discarding any fractional remainder.
    Frequently Asked Questions
    Do I have to write valid Python in the AQA GCSE exam, or is pseudocode accepted?
    AQA accepts both standard high-level languages (such as Python, C#, or VB.NET) and clear, structured pseudocode. You will not lose marks for minor syntax slips (like missing colons or parentheses) as long as your algorithmic logic is clear and unambiguous. However, writing accurate code is recommended to avoid structural confusion.
    What is the difference between DIV and MOD in programming questions?
    DIV (or // in Python) performs integer division, returning only the whole number quotient without decimals (e.g. 7 DIV 2 = 3). MOD (or % in Python) calculates the remainder left over after integer division (e.g. 7 MOD 2 = 1). Both are frequently tested in algorithm problems involving time, units, or parity checks.
    What is meant by variable scope (local vs global)?
    Scope determines where a variable can be seen and accessed within a program. A local variable is declared inside a subroutine and exists only while that subroutine runs, preventing accidental interference from other parts of the program. A global variable is declared in the main body and is accessible throughout the entire program.
    How do 2D arrays work in AQA Computer Science?
    A two-dimensional (2D) array is an array of arrays, visualised like a table or grid with rows and columns. Elements are accessed using two indices: arrayName[rowIndex][colIndex] or arrayName[rowIndex, colIndex]. You must remember that both row and column indices start at zero.