Condition

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Condition

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which one is a condition?
A Is it raining?
B Tell me about the weather
2. Which one is a condition?
A What is your score?
B Is the score above 10?
3. The score is 7. Is the condition 'Is the score above 10?' true or false?
A False
B True
4. The score is 15. Is the condition 'Is the score above 10?' true or false?
A False
B True
5. What are the only two answers a condition can have?
A True or false
B Any number or word

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1IF it is raining THEN AIs the score above 10? true
2score > 10 B'it is raining' is the condition: a yes/no question that is either true or false
3A condition is a yes/no question about the situation CA condition with numbers that is true when the score is above 10, and false if it is not
4A condition can only ever have the answer true or false DThis is not a condition. It cannot be answered with true or false. Fix it with a yes/no question like 'Is your favourite colour blue?'
5IF what is your favourite colour THEN EA number on its own is not a question. Fix it by asking a true/false question such as 'score > 10'.
6IF score THEN FIs the door open?

Definitions

condition

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
__ raining = true THEN SAY "Take an umbrella"
2.
IF score _ 10 THEN SAY "You win!"
3.
IF raining = ____ THEN SAY "Take an umbrella"
4.
score ← 4 score > 10 is _____
5.
score ← 12 IF _____ > 10 THEN SAY "Great job!"

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A SET score ← 12
B SET target ← 10
C IF score + target THEN
D SAY 'You win!'
E END IF
Question 2
A ASK 'Is it raining?'
B SET raining ← answer
C IF raining = 7 THEN
D SAY 'Take an umbrella'
E END IF
Question 3
A SET score ← 12
B SAY 'Checking the score'
C SET limit ← 10
D IF score is a big number THEN
E SAY 'High score!'
F END IF
Question 4
A SET light ← 'green'
B SET walk ← FALSE
C IF light ← 'green' THEN
D SET walk ← TRUE
E END IF
Question 5
A SET age ← 11
B IF age <= 10 THEN
C SAY 'You are 10 or older'
D END IF

Answer Key

Condition
Section A: Quick Questions
Q1
A — Is it raining?
Q2
B — Is the score above 10?
Q3
A — False
Q4
B — True
Q5
A — True or false
Section B: Match the Pairs
Q1
IF it is raining THEN → 'it is raining' is the condition: a yes/no question that is either true or false
Q2
score > 10 → A condition with numbers that is true when the score is above 10, and false if it is not
Q3
A condition is a yes/no question about the situation → Is the door open?
Q4
A condition can only ever have the answer true or false → Is the score above 10? true
Q5
IF what is your favourite colour THEN → This is not a condition. It cannot be answered with true or false. Fix it with a yes/no question like 'Is your favourite colour blue?'
Q6
IF score THEN → A number on its own is not a question. Fix it by asking a true/false question such as 'score > 10'.
Section C: Definitions
Q1
condition — A question about the situation that can only be answered true or false (yes or no), like 'Is it raining?' or 'Is the score above 10?'. It helps an algorithm decide what to do.
Section D: Fill in the Blanks
Q1
IF raining = true THEN SAY "Take an umbrella"
Q2
IF score > 10 THEN SAY "You win!"
Q3
IF raining = true THEN SAY "Take an umbrella"
Q4
score ← 4 score > 10 is false
Q5
score ← 12 IF score > 10 THEN SAY "Great job!"
Section E: Spot the Error
Q1
C — A condition must be a question that is true or false. score + target gives a number, not true or false. It should compare them, like score > target.
Q2
C — The answer to 'Is it raining?' can only be TRUE or FALSE, so it can't be checked against 7. The condition should be raining = TRUE.
Q3
D — 'A big number' is vague, so the computer can't answer it with true or false. A condition needs a clear test, like score > limit.
Q4
C — ← stores a value; it does not ask a question. The condition should use = to ask 'Is the light green?', so IF light = 'green' THEN.
Q5
B — The message is for people aged 10 or older. The condition 'Is age 10 or less?' asks the wrong question. It should be age >= 10.