Drawing OR as two decisions sharing one outcome

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

Drawing OR as two decisions sharing one outcome

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A flowchart draws IF age < 12 OR age > 65 as two diamonds. Where does the second diamond go?
A On the Yes arrow of the first diamond
B On the No arrow of the first diamond
2. In an OR flowchart with two diamonds, which arrows lead to the same action box?
A Both Yes arrows
B Both No arrows
3. When is the action skipped in a flowchart for IF A OR B?
A When either diamond answers No
B Only when both diamonds answer No
4. Which flowchart shows AND and which shows OR? Two diamonds in a row, where the second is on the first's Yes path, show:
A AND
B OR
5. The first diamond asks: Is the day Saturday? It answers Yes. In an OR flowchart, what happens next?
A Go straight to the action without asking the second diamond
B Still ask the second diamond before the action

Match the Pairs

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

Left columnRight column
1Diamond 1: age < 12? Yes goes to 'Child price'. No goes to Diamond 2: age > 65? Yes goes to 'Child price'. AThe two Yes arrows go to different actions. For OR, both Yes arrows must reach the same action box.
2Diamond 1: day = 'Sat'? No goes to Diamond 2: day = 'Sun'? No goes past the action to the next step. BThe action is skipped only when both answers are No, because neither condition was true.
3The second diamond sits only on the No path of the first diamond, because it is only needed if the first test failed. CDiamond 1 No arrow → Diamond 2
4The flowchart for IF A OR B THEN is drawn with two diamonds, and the Yes arrows from both diamonds go to the same action box. DThe second diamond is on the Yes path, which is how AND is drawn. For OR, it must be on the No path of the first diamond.
5Diamond 1: temp > 35? Yes goes to 'Stay inside'. Diamond 2: rain = 'yes'? Yes goes to a different box 'Take umbrella'. EThis draws IF age < 12 OR age > 65. Both Yes arrows reach the same action box.
6Diamond 1: score > 90? Yes goes to 'Award'. Yes from Diamond 1 also leads to Diamond 2: attendance = 100? Yes goes to 'Award'. FIF A OR B THEN action ENDIF

Definitions

IF A OR B THEN

Fill in the Blanks

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

1.
IF age < 12 __ age > 64 THEN OUTPUT "Discount" ENDIF
2.
D1: Is age < 12? Yes -> Discount D1: No -> D2: Is age > 64? D2: ___ -> Discount, No -> Skip
3.
D1: Is score < 0? Yes -> Error D1: __ -> D2: Is score > 100? D2: Yes -> Error, No -> Continue
4.
IF temp > 35 OR ____ < 5 THEN OUTPUT "Stay inside" ENDIF
5.
D1: Is temp > 35? Yes -> Warn D1: No -> D2: Is temp < 5? D2: Yes -> ____, No -> End

Spot the Error

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

Question 1
A D1: temp > 35?
B Yes -> Cancel sport
C Yes -> D2: storm = Yes?
D Yes -> Cancel sport
E No -> Play sport
Question 2
A IF score >= 90 AND att = 100
B D1: score >= 90?
C Yes -> Award prize
D No -> D2: att = 100?
E Yes -> Award prize
F No -> No prize
Question 3
A D1: late = Yes?
B Yes -> Send note home
C No -> D2: late = Yes?
D Yes -> Send note home
E No -> Send nothing
Question 4
A D1: coins >= 5?
B Yes -> Skip snack
C No -> D2: voucher = Yes?
D Yes -> Buy snack
E No -> Skip snack
Question 5
A D1: smoke = Yes?
B Yes -> Sound alarm
C No -> D2: heat > 50?
D Yes -> Stay quiet
E No -> Stay quiet

Answer Key

Drawing OR as two decisions sharing one outcome
Section A: Quick Questions
Q1
B — On the No arrow of the first diamond
Q2
A — Both Yes arrows
Q3
B — Only when both diamonds answer No
Q4
A — AND
Q5
A — Go straight to the action without asking the second diamond
Section B: Match the Pairs
Q1
Diamond 1: age < 12? Yes goes to 'Child price'. No goes to Diamond 2: age > 65? Yes goes to 'Child price'. → This draws IF age < 12 OR age > 65. Both Yes arrows reach the same action box.
Q2
Diamond 1: day = 'Sat'? No goes to Diamond 2: day = 'Sun'? No goes past the action to the next step. → The action is skipped only when both answers are No, because neither condition was true.
Q3
The second diamond sits only on the No path of the first diamond, because it is only needed if the first test failed. → Diamond 1 No arrow → Diamond 2
Q4
The flowchart for IF A OR B THEN is drawn with two diamonds, and the Yes arrows from both diamonds go to the same action box. → IF A OR B THEN action ENDIF
Q5
Diamond 1: temp > 35? Yes goes to 'Stay inside'. Diamond 2: rain = 'yes'? Yes goes to a different box 'Take umbrella'. → The two Yes arrows go to different actions. For OR, both Yes arrows must reach the same action box.
Q6
Diamond 1: score > 90? Yes goes to 'Award'. Yes from Diamond 1 also leads to Diamond 2: attendance = 100? Yes goes to 'Award'. → The second diamond is on the Yes path, which is how AND is drawn. For OR, it must be on the No path of the first diamond.
Section C: Definitions
Q1
IF A OR B THEN — In a flowchart, OR is two diamonds whose Yes arrows both reach the same action. The second diamond sits on the first's No path. The action is skipped only if both are No.
Section D: Fill in the Blanks
Q1
IF age < 12 OR age > 64 THEN OUTPUT "Discount" ENDIF
Q2
D1: Is age < 12? Yes -> Discount D1: No -> D2: Is age > 64? D2: Yes -> Discount, No -> Skip
Q3
D1: Is score < 0? Yes -> Error D1: No -> D2: Is score > 100? D2: Yes -> Error, No -> Continue
Q4
IF temp > 35 OR temp < 5 THEN OUTPUT "Stay inside" ENDIF
Q5
D1: Is temp > 35? Yes -> Warn D1: No -> D2: Is temp < 5? D2: Yes -> Warn, No -> End
Section E: Spot the Error
Q1
C — The second diamond belongs on the No path of the first diamond. If it sits on the Yes path, both tests must be true, which is AND, not OR. It should read: No -> D2: storm = Yes?
Q2
A — The two diamonds with both Yes arrows reaching the same action draw OR. The rule must say OR, not AND. It should be: IF score >= 90 OR att = 100
Q3
C — The second diamond must test the second condition (B). Repeating the first test on the No path is pointless, because late is already known to be No. It should be: No -> D2: absent = Yes?
Q4
B — In OR, a Yes from the first diamond must reach the same action as a Yes from the second. Sending it to Skip snack means a true condition would skip the action. It should be: Yes -> Buy snack
Q5
D — The Yes arrow from the second diamond must lead to the same action as the first Yes arrow. If heat > 50 is true, the alarm must sound. It should be: Yes -> Sound alarm