AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Students should be able to use these operators within their own programs…

    Full specification wording

    Relational operations in a programming language: Students should be able to use these operators within their own programs and be able to interpret them when used within algorithms. Note that different languages may use different symbols to represent these operators.

    Relational operators compare two values and return a Boolean result, which is then used to control program flow.

    Checked against the AQA 8525 specification (opens in a new tab) on .

      Study notes

      From the checked teaching notes for this specification point.

      The idea

      Relational operators compare two values and return a Boolean result, which is then used to control program flow. The core set is equal to, not equal to, less than, greater than, less than or equal to, and greater than or equal to. You must do two things: write them into your own programs, for example an if statement that checks whether a score is greater than or equal to a pass mark, and read them inside an algorithm written by someone else, working out what branch is taken for given inputs. Symbols vary between languages: some use a single equals sign for equality and others use a double equals sign, and not-equal may appear as a different symbol. Always check the language or pseudocode convention in the question before interpreting a comparison.

      What earns the marks

      • Identifies that a relational operator compares two values and produces a Boolean (true or false) result.
      • Names the comparison operators: equal to, not equal to, less than, greater than, less than or equal to, greater than or equal to.
      • Correctly traces an algorithm by evaluating a comparison for supplied input values and stating which branch runs.
      • Writes a correct comparison in a program, for example testing a variable against a threshold inside a selection statement.
      • Recognises that the symbol used for equality or inequality can differ between programming languages and checks the convention given.

      Common mistakes and how to put them right

      • Confusing assignment with comparison.

        Put it right: A single equals sign may assign a value in some languages, so the learner must use the equality symbol the question's language requires.

      • Reversing the direction of an inequality, so a test for greater than is read as less than; the correction is to substitute sample numbers and check the result.

      • Treating a comparison as producing a number rather than a Boolean.

        Put it right: State that the outcome is true or false and drives selection.

      Exam tips

      • Underline the comparison in a given algorithm, substitute the actual values, then state the true or false result before choosing the branch.
      • When writing code, match the operator symbol to the language or pseudocode convention printed in the question.
      • For multiple-choice items, eliminate options that confuse assignment with comparison or reverse the inequality direction.

      Try the lesson

      The start of the Relational operations in a programming language: Students should be able to use these operators within their own programs and be able to interpret them when used within algorithms. Note that different languages may use different symbols to represent these operators. lesson, made from checked teaching notes for this specification point.

      Have a go first

      A program compares two variables, x and y, using the expression x > y. If x is 8 and y is 5, what is the result of this comparison?

      There is more to this lesson

      The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.

      Carry on with the full lesson

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

      Test your understanding of Relational operations in a programming language: Students should be able to use these operators within their own programs and be able to interpret them when used within algorithms. Note that different languages may use different symbols to represent these 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