Pearson Edexcel · GCSE · Computer Science

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

    Operators

    Mastering operators is essential for GCSE Computer Science, as they are the fundamental building blocks of all programming logic. This guide covers arithmetic, relational, and logical operators, ensuring you can write flawless code and secure maximum marks in programming questions.

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

    Study Notes

    Overview

    Operators are the 'verbs' of programming—they tell the computer what action to perform on data. Whether you are calculating a score, checking if a user has enough lives left, or combining complex conditions in an if statement, operators are at the heart of the process.

    In GCSE Computer Science, operators are tested heavily. Examiners look for your ability to apply the correct operator to solve a problem, understand operator precedence (the order of evaluation), and differentiate between assignment and comparison. A solid grasp of operators is crucial because they connect directly to almost every other programming topic, including iteration, selection, and data representation.

    Key Concepts

    Concept 1: Arithmetic Operators

    Arithmetic operators perform mathematical calculations. In Python (the standard language for GCSE Computer Science), there are seven primary arithmetic operators you must know. While addition (+), subtraction (-), multiplication (*), and standard division (/) work exactly as they do in maths, the others require special attention.

    Integer Division (//): Also known as floor division, this operator divides two numbers and returns only the whole number part, discarding any remainder. Crucially, it always rounds down to the nearest integer.

    Example: 10 // 3 evaluates to 3. However, -10 // 3 evaluates to -4 (because -3.33 rounds down to -4).

    Modulus (%): The modulus operator returns the remainder after integer division. It is incredibly useful for determining if a number is even or odd (e.g., num % 2 == 0 means the number is even).

    Example: 10 % 3 evaluates to 1, because 3 goes into 10 three times, leaving a remainder of 1.

    Exponentiation (**): This operator raises a number to the power of another.

    Example: 2 ** 3 means 2 cubed (2 × 2 × 2), which evaluates to 8.

    Arithmetic Operators ReferenceOpen full-size image (opens in a new tab)

    Concept 2: Relational Operators

    Relational operators compare two values and always evaluate to a Boolean result: True or False. They are the foundation of decision-making in code (selection).

    • Equal to (==): Checks if two values are identical.
    • Not equal to (!=): Checks if two values are different.
    • Less than (<) and Greater than (>): Standard mathematical inequalities.
    • Less than or equal to (<=) and Greater than or equal to (>=): Inclusive inequalities.

    Example: If score = 85, the expression score >= 50 evaluates to True.

    Examiner Tip: The most common error is confusing the assignment operator (=) with the relational equality operator (==). Remember: one equals sign sets a value; two equals signs check a value.

    Concept 3: Logical Operators

    Logical operators combine multiple Boolean expressions or invert them. Python uses the keywords and, or, and not.

    • and: Evaluates to True only if both conditions are True.
    • or: Evaluates to True if at least one condition is True.
    • not: Inverts the Boolean value (turns True to False, and vice versa).

    Example: (age >= 18) and (has_ticket == True) will only allow entry if the person is an adult and holds a ticket.

    Relational and Logical OperatorsOpen full-size image (opens in a new tab)

    Concept 4: Operator Precedence

    Just like BODMAS in mathematics, programming languages have a strict order of operations, known as operator precedence. If you mix different operators in a single expression, the computer evaluates them in a specific sequence.

    1. Parentheses () (Highest priority)
    2. Exponentiation **
    3. Multiplication *, Division /, Integer Division //, Modulus % (Evaluated left-to-right)
    4. Addition +, Subtraction -
    5. Relational operators (==, <, >, etc.)
    6. Logical not
    7. Logical and
    8. Logical or (Lowest priority)

    Example: In the expression 3 + 4 * 2, the multiplication happens first. 4 * 2 is 8, plus 3 is 11. If you wanted the addition to happen first, you must use parentheses: (3 + 4) * 2 equals 14.

    Operator Precedence HierarchyOpen full-size image (opens in a new tab)

    Listen to our 10-minute podcast revision session for a complete walkthrough of these concepts:

    Check what you remember

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

    Reference: Pearson Edexcel

    A character or set of characters that represents an action or process to be performed on one or more values.
    Pearson Edexcel

    Interactive Diagrams

    2 interactive diagrams to visualise key concepts

    Conceptual Flow Outline

    Start: Evaluate Expression
    ➔Are there parentheses?
    Are there parentheses?
    ➔"Yes"Evaluate inside parentheses first
    ➔"No"Check Precedence
    Evaluate inside parentheses first
    ➔Check Precedence
    Check Precedence
    ➔Evaluate Exponentiation (**)
    Evaluate Exponentiation (**)
    ➔Evaluate *, /, //, % (Left to Right)
    Evaluate *, /, //, % (Left to Right)
    ➔Evaluate +, - (Left to Right)
    Evaluate +, - (Left to Right)
    ➔Evaluate Relational (==, <, >)
    Evaluate Relational (==, <, >)
    ➔Evaluate Logical (not, and, or)
    Evaluate Logical (not, and, or)
    ➔Final Result

    Flowchart showing the step-by-step process of operator precedence evaluation.

    Conceptual Flow Outline

    num = 17
    ➔num % 2
    num % 2
    ➔Result == 0?
    Result == 0?
    ➔"True"Number is Even
    ➔"False (Result is 1)"Number is Odd

    Using the modulus operator to determine if a number is even or odd.

    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

    Calculate the result of the expression: 20 // 3 + 20 % 3

    3 marks
    standard

    Hint: Evaluate the integer division and the modulus separately before adding them together.

    Q2

    Write a Python if statement that checks if a variable temperature is between 15 and 25 inclusive.

    2 marks
    foundation

    Hint: You need to check two conditions and combine them. 'Inclusive' means you should use the 'or equal to' operators.

    Q3

    Evaluate the following Boolean expression where x = 5 and y = 10: not (x == 5 and y < 5)

    3 marks
    challenging

    Hint: Work from the inside of the parentheses outward. Evaluate the and condition first, then apply the not.

    Q4

    Explain why the expression -5 // 2 results in -3 rather than -2.

    2 marks
    challenging

    Hint: Think about the mathematical definition of floor division and which direction it rounds on a number line.

    Q5

    A program contains the following line of code: is_valid = (score >= 50). State the data type of the variable is_valid.

    1 mark
    foundation

    Hint: What kind of value does a relational operator (>=) produce?

    Ready to test yourself interactively?

    Active recall beats reading alone. Answer questions on Operators 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

    Always trace complex expressions step-by-step. Write down the intermediate values above the expression just like you would in a maths exam. Never try to calculate it all in your head.

    How to structure your answer

    For code-writing questions, define your variables first, construct your relational comparisons, and then link them with logical operators. Use parentheses to ensure the order of evaluation is exactly what you intend.

    Timing

    Approximately 1 minute per mark, so a 4-mark question should take about 4 minutes.

    Common pitfalls

    • Using = instead of == in an if statement condition.
    • Forgetting that // rounds down toward negative infinity, causing errors with negative numbers.
    • Assuming mathematical operations evaluate left-to-right without checking precedence (e.g., doing addition before multiplication).

    What the command words want

    Compare
    Identify the functional differences between two operators (e.g., standard division vs integer division).
    Explain
    Detail HOW the operator works and WHY it produces a specific result, often contrasting it with a similar operator.
    Describe
    Outline the function of the operator (e.g., 'It divides the numbers and returns only the remainder').
    Evaluate
    Analyze a given code snippet, determine its output, and judge whether it meets the intended logical requirements.
    Calculate
    Show your step-by-step working based on operator precedence.
    State/Give
    Provide the final evaluated value. No working is strictly necessary, but it's safer to show it.
    Watch or listen (optional)
    🎙 Podcast Episode
    Operators
    0:00-0:00

    Test your understanding of Operators

    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

    More Computer Science Study Guides

    View all

    Algorithms

    Pearson Edexcel
    GCSE

    Master the logic behind every computer program. This topic covers how to design, trace, and evaluate algorithms using sequence, selection, and iteration, plus the essential searching and sorting techniques you'll need for your exam.

    Binary

    Pearson Edexcel
    GCSE

    Mastering binary is essential for understanding how computers store and process all data. This topic covers converting between number bases, performing binary arithmetic, understanding shifts, and recognizing overflow — key skills that frequently appear in exams and form the foundation of computer science.

    Constructs

    Pearson Edexcel
    GCSE

    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.

    Cybersecurity

    Pearson Edexcel
    GCSE

    Master the critical threats to digital systems and the methods used to protect them. This high-yield GCSE Computer Science topic explores malware, social engineering, and the technical defences essential for earning top marks.

    Data

    Pearson Edexcel
    GCSE

    Master the language of computers. This topic covers how binary underpins everything from text and images to sound and data compression, ensuring you can secure crucial calculation marks in your exam.

    Data storage and compression

    Pearson Edexcel
    GCSE

    Master the fundamentals of binary data storage and the critical importance of compression. This topic is calculation-heavy and frequently tested, requiring you to confidently convert between binary units and understand the trade-offs between lossless and lossy compression methods.