Logical operators in a flowchart decision

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

Logical operators in a flowchart decision

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A flowchart must check that a student has a ticket AND has paid. Which design works?
A One diamond: has_ticket = Yes AND paid = Yes
B One diamond: has_ticket = Yes OR paid = Yes
2. Which flowchart gives the same result as one diamond with: score >= 50 AND attendance >= 80?
A Two diamonds side by side, where either one can lead to the pass outcome
B Two diamonds in a row, where the Yes path of the first leads into the second
3. True or false: A single decision diamond can contain a combined condition like temp > 30 OR is_sunny = Yes.
A False
B True
4. A diamond uses OR: is_member = Yes OR has_coupon = Yes. When does the flow take the Yes path?
A When at least one part is true
B Only when both parts are true
5. How can you draw OR using two simple diamonds instead of one?
A Both diamonds have a Yes path that joins the same outcome
B The Yes path of the first diamond leads into the second diamond

Match the Pairs

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

Left columnRight column
1age >= 13 AND has_permission = Yes AOR was used when both conditions must be true. It should be AND, because OR lets someone through with only one part true.
2is_weekend = Yes OR is_holiday = Yes BOne diamond that sends the flow down Yes when at least one part is true
3Two diamonds in a row, where both answers must be Yes to reach the action, can be replaced by one AND diamond COne diamond that sends the flow down Yes only when both parts are true
4NOT reverses a question so the Yes path is taken when the original answer would have been No Dscore >= 50 AND attendance >= 80
5Diamond: age >= 13 OR has_permission = Yes (meant to need both) EAND was used when only one condition needs to be true. It should be OR, because AND needs both to be true at once.
6Diamond: is_raining = Yes AND is_snowing = Yes (meant to need either) FNOT (is_logged_in = Yes)

Definitions

age >= 13 AND has_permission = Yes

Fill in the Blanks

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

1.
Decision: age >= 13 ___ permission = Yes
2.
Diamond A: member = Yes? Yes -> Discount Diamond B: coupon = Yes? Yes -> Discount One: member = Yes __ coupon = Yes
3.
Decision: ___ is_raining
4.
Diamond 1: age >= 13? Yes -> Diamond 2 Diamond 2: permission = Yes? Yes -> Enter One diamond: age >= 13 ___ permission = Yes
5.
Decision: temp < 10 __ temp > 35

Spot the Error

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

Question 1
A Diamond: age>=13 AND perm=Yes
B Diamond: age>=13 OR perm=Yes
C No -> Print Entry denied
D Rule: needs BOTH conditions
Question 2
A Diamond A: age >= 13?
B A Yes -> Diamond B: perm=Yes?
C B No -> Print Allowed
D Any No -> Print Denied
Question 3
A Diamond A: student=Yes?
B A Yes -> Print Discount
C A Yes -> Diamond B: age>=65?
D B Yes -> Print Discount
E B No -> Print Full price
Question 4
A Input is_raining
B Diamond: is_raining = Yes?
C Yes -> Print Go outside
D No -> Print Take umbrella
Question 5
A Input temp
B Diamond: temp>=18 AND temp<=25
C Yes -> Print Too hot or cold
D No -> Print Too hot or cold

Answer Key

Logical operators in a flowchart decision
Section A: Quick Questions
Q1
A — One diamond: has_ticket = Yes AND paid = Yes
Q2
B — Two diamonds in a row, where the Yes path of the first leads into the second
Q3
B — True
Q4
A — When at least one part is true
Q5
A — Both diamonds have a Yes path that joins the same outcome
Section B: Match the Pairs
Q1
age >= 13 AND has_permission = Yes → One diamond that sends the flow down Yes only when both parts are true
Q2
is_weekend = Yes OR is_holiday = Yes → One diamond that sends the flow down Yes when at least one part is true
Q3
Two diamonds in a row, where both answers must be Yes to reach the action, can be replaced by one AND diamond → score >= 50 AND attendance >= 80
Q4
NOT reverses a question so the Yes path is taken when the original answer would have been No → NOT (is_logged_in = Yes)
Q5
Diamond: age >= 13 OR has_permission = Yes (meant to need both) → OR was used when both conditions must be true. It should be AND, because OR lets someone through with only one part true.
Q6
Diamond: is_raining = Yes AND is_snowing = Yes (meant to need either) → AND was used when only one condition needs to be true. It should be OR, because AND needs both to be true at once.
Section C: Definitions
Q1
age >= 13 AND has_permission = Yes — A combined condition in one decision diamond. AND needs both parts true, OR needs just one, NOT reverses it. One diamond with AND matches two diamonds in a row.
Section D: Fill in the Blanks
Q1
Decision: age >= 13 AND permission = Yes
Q2
Diamond A: member = Yes? Yes -> Discount Diamond B: coupon = Yes? Yes -> Discount One: member = Yes OR coupon = Yes
Q3
Decision: NOT is_raining
Q4
Diamond 1: age >= 13? Yes -> Diamond 2 Diamond 2: permission = Yes? Yes -> Enter One diamond: age >= 13 AND permission = Yes
Q5
Decision: temp < 10 OR temp > 35
Section E: Spot the Error
Q1
B — The rule says both conditions are needed, so the diamond must use AND. With OR, someone aged 13 or over with no permission would still be allowed in.
Q2
C — Two diamonds in a row work like AND. You are only allowed if both answers are Yes, so the Yes path of diamond B leads to Allowed. It should be 'B Yes -> Print Allowed'.
Q3
C — Line 2 already sends A Yes to Discount. Diamond B should only be reached from the A No path, so this line should be 'A No -> Diamond B: age>=65?'. Together the two Yes paths work like 'student=Yes OR age>=65'.
Q4
B — The Yes path prints 'Go outside', so the question must be reversed with NOT. It should be 'Diamond: NOT is_raining = Yes?'. Without NOT, Yes would mean it is raining.
Q5
C — When temp is between 18 and 25 both parts of the AND are true, so the Yes path should print 'Comfortable'. Both paths printing the same message means Comfortable would never appear.