Teachers' Portal  /  IGCSE Computer Science 0478  /  Programming  /  Arithmetic, relational and logical operators
Lesson pack · IGCSE Computer Science 0478 · 8.1 · IGCSE

Arithmetic, relational and logical operators

Calculate, compare, combine. Operators are the working parts of every expression.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Programming
Syllabus reference
Cambridge IGCSE Computer Science 0478, 8.1
Level
IGCSE
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 5 of 11 in Programming; follows String handling; leads into Procedures, functions, parameters and scope
Central model
Fig. 1: the three groups of operators in 0478 pseudocode
Cooperative structure
Assessment
Stage 1 check and the exam-style plenary from the student lesson, plus the worksheet as the exit task
Learning objectives

By the end of the lesson, learners can

Section by section
  • Arithmetic operators: Work out each expression using the normal mathematical order: brackets, then powers, then multiplication and division, then addition and subtraction.
  • Relational operators: A relational operator compares two values.
  • Logical: AND, OR, NOT: The lab's Range check program accepts an age from 11 to 18.
Key points to leave on the board
  • Order: brackets, powers (^), then * and /, then + and -.
  • / versus DIV: 7 / 2 = 3.5; DIV(7, 2) = 3; MOD(7, 2) = 1.
  • Relational: = < <= > >= <>, always TRUE or FALSE.
  • Logical: AND needs both, OR needs either, NOT reverses; each side a full comparison.
The core visual model

One picture every idea returns to

Arithmetic operators: + - * / ^ (raised to the power of), plus MOD and DIV. Relational operators: = < <= > >= and <> (not equal to); they compare two values and always give a BOOLEAN result. Logical operators: AND (TRUE only if both sides are TRUE), OR (TRUE if either side is TRUE) and NOT (reverses TRUE and FALSE). Powers are worked out first, then * and /, then + and -; brackets make the order explicit.

ArithmeticRelationalLogical calculatecomparecombine conditions + - * /^ (power)MOD (remainder)DIV (wholequotient) =<<=>>=<> ANDORNOT equal toless thanless or equalgreater thangreater or equalnot equal to botheitherreverses relational and logical operators always give a BOOLEAN: TRUE or FALSE
Fig. 1: the three groups of operators in 0478 pseudocode
Lesson sequence

Forty-five minutes, phase by phase

TimePhaseWhat happens in the roomGrouping
0 to 5 minHook: predictOpen with the question in the title, Calculate, compare, combine.. Operators are the working parts of every expression. Put the figure on the board: it is the one picture every idea in the lesson returns to.Whole class, then pairs
5 to 13 minTeach and check: Arithmetic operatorsWork out each expression using the normal mathematical order: brackets, then powers, then multiplication and division, then addition and subtraction. Model the worked example Area of a circle on the board, one line at a time.Whole class, then pairs
13 to 21 minTeach and check: Relational operatorsA relational operator compares two values. Model the worked example Evaluate the conditions on the board, one line at a time. Your turn: Lives is 0. What is Lives <= 0?Pairs
21 to 30 minTeach and check: Logical: AND, OR, NOTThe lab's Range check program accepts an age from 11 to 18. Project tab 3 of the lab (Range check with AND and OR) and let a student drive it while the class predicts. Model the worked example A discount rule on the board, one line at a time. Your turn: Same rule: Age = 40 and Member = TRUE?Frayer Model
30 to 36 minCheckThe four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong.Individual, then whole class
36 to 43 minPlenaryThe exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording.Individual, random call
43 to 45 minExit and homeworkSet the worksheet below (6 questions, 17 marks). Learners self-assess against the objectives before they leave.Individual
Timing and contingency

Protect the parts that carry the learning

The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.

Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.

Cut first if the build overruns: the last check in Logical: AND, OR, NOT, never the check or the plenary.

In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.

Running the cooperative task

Frayer Model

Pairs fill a four-box grid for the key term: definition, characteristics, examples and non-examples. The non-examples box is where the misconceptions surface, so give it the most time.

The full structure, with its variations and the other twelve, is on the cooperative-learning page.

Examiner traps to pre-empt

What to head off, and how

Trap learners fall intoTeaching move that pre-empts it
/ gives the full answer, including any fractional part: 7 / 2 is 3.5.Use DIV only when you want the whole-number quotient, 3.
In a condition, = compares; it does not store anything.Assignment always uses the arrow ←. (Python uses == to compare and!= for not equal.)
Each side of AND or OR must be a complete comparison.Age > 11 AND < 18 is wrong; write Age > 11 AND Age < 18.
Worksheet

Arithmetic, relational and logical operators: worksheet

6 questions, 17 marks. Written in the style of the papers; no past paper question is reproduced.

NameClassDate
Q1 · recall[3 marks]

Name the three types of operator used in pseudocode and give one example of each.

Q2 · calculate[3 marks]

Evaluate: (a) 4 + 6 / 2 (b) (4 + 6) / 2 (c) 3 ^ 2 * 2

Q3 · apply[3 marks]

X is 7 and Y is 12. State whether each condition is TRUE or FALSE: (a) X > 5 AND Y < 10 (b) X > 5 OR Y < 10 (c) NOT (X = Y)

Q4 · write[3 marks]

Write pseudocode that inputs an exam mark and outputs "Valid" if it is from 0 to 100 inclusive, or "Invalid" otherwise.

Q5 · write[3 marks]

A zoo lets in children under 5 and adults over 80 free. Write an IF statement that outputs "Free" or "Pay" for the variable Age.

Q6 · analysis[2 marks]

A student writes IF Mark > 40 AND < 60 to test for marks from 41 to 59. Explain the error and correct it.

Answer key and marking notes
Q1 · 3 marks
  • Arithmetic, e.g. + or * or MOD.
  • Relational, e.g. < or <>.
  • Logical, e.g. AND, OR or NOT.
Q2 · 3 marks
  • (a) 6 / 2 = 3, then 4 + 3 = 7
  • (b) 10 / 2 = 5
  • (c) 3 ^ 2 = 9, then 9 * 2 = 18
Q3 · 3 marks
  • (a) TRUE AND FALSE = FALSE
  • (b) TRUE OR FALSE = TRUE
  • (c) X = Y is FALSE, so NOT gives TRUE
Q4 · 3 marks
  • INPUT Mark
  • IF Mark >= 0 AND Mark <= 100
  • THEN OUTPUT "Valid" ELSE OUTPUT "Invalid" with ENDIF
Q5 · 3 marks
  • IF Age < 5 OR Age > 80
  • THEN OUTPUT "Free"
  • ELSE OUTPUT "Pay" and ENDIF
Q6 · 2 marks
  • The second part is not a complete comparison: it has no variable to compare with 60.
  • Correct: IF Mark > 40 AND Mark < 60.
Quiz

6 multiple-choice questions on this lesson

From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.

Q11 mark

What value is stored by Result ← 7 + 3 * 2 ^ 2?

  • A19
  • B43
  • C40
  • D13
Q21 mark

Which relational operator means not equal to in pseudocode?

  • A<>
  • B!=
  • C><
  • D<=
Q31 mark

A program must accept an age from 11 to 18 inclusive. Which condition is TRUE exactly for those ages?

  • AAge >= 11 AND Age <= 18
  • BAge >= 11 OR Age <= 18
  • CAge > 11 AND Age < 18
  • DAge >= 11 AND <= 18
Q41 mark

Score holds 50. Which condition is TRUE?

  • AScore >= 50 AND Score <> 49
  • BScore > 50 OR Score < 50
  • CNOT (Score = 50)
  • DScore <> 50 AND Score >= 50
Q51 mark

A cinema gives a discount when (Age < 12 OR Age > 65) AND Member = TRUE. Which customer gets the discount?

  • AAge 70, Member TRUE
  • BAge 70, Member FALSE
  • CAge 30, Member TRUE
  • DAge 12, Member TRUE
Q61 mark

What value is stored by X ← 17 / 4 + MOD(17, 4) * 2?

  • A6.25
  • B6
  • C10.5
  • D4.75
Quiz key
Q1: A

2 ^ 2 = 4 first, then 3 * 4 = 12, then 7 + 12 = 19. 43 squares 3 * 2 instead of just 2. 40 adds 7 + 3 first, working left to right. 13 ignores the power and works out 7 + 3 * 2.

Q2: A

Pseudocode writes not equal to as <>. != is used by Python and some other languages but not in the exam pseudocode. >< is not an operator. <= means less than or equal to.

Q3: A

The age must be at least 11 AND at most 18, and >= and <= include the end values. With OR every age is accepted, since any number is either at least 11 or at most 18. > and < reject 11 and 18 themselves. The last option is not valid: each side of AND must be a complete comparison.

Q4: A

50 >= 50 is TRUE and 50 <> 49 is TRUE, so TRUE AND TRUE gives TRUE. 50 > 50 and 50 < 50 are both FALSE, so the OR is FALSE. Score = 50 is TRUE, so NOT makes it FALSE. 50 <> 50 is FALSE, so the AND is FALSE.

Q5: A

For 70 and TRUE: 70 > 65 makes the bracket TRUE, and Member = TRUE, so TRUE AND TRUE is TRUE. A 70-year-old who is not a member fails the AND. A 30-year-old makes the bracket FALSE. Age 12 is not less than 12, so the bracket is FALSE at that boundary.

Q6: A

17 / 4 = 4.25 and MOD(17, 4) = 1, so 4.25 + 1 * 2 = 6.25. 6 treats / as DIV, giving 4 + 2. 10.5 adds before multiplying: (4.25 + 1) * 2. 4.75 treats MOD as the decimal part 0.25, giving 4.25 + 0.5.

Lab and demo

What to project

The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.

Slides

Slides for this lesson

A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.

Also for this topic

Everything else you can use

Original work by the TheLucidSTEM team. The worksheet items are written in the style of the papers; no past paper question is reproduced.
Previous lessonString handling