Drawing AND as two decisions in a row

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

Drawing AND as two decisions in a row

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A flowchart shows IF age >= 13 AND hasParentOK = TRUE. How many decision diamonds does it need?
A One diamond that holds both conditions side by side
B Two diamonds, one for each condition
2. In a flowchart for IF A AND B, which path from the first diamond leads to the second diamond?
A The Yes path
B The No path
3. In a flowchart for IF A AND B, when is the action reached?
A When either diamond gives Yes
B Only when the first is Yes and then the second is Yes
4. The first diamond (A) gives No. Where does the flow go in an AND flowchart?
A Straight to the No step, skipping the second diamond
B On to the second diamond to check B anyway
5. Where do the two No exits lead in a flowchart for IF A AND B?
A Both lead to the same next step
B Each leads to its own separate step

Match the Pairs

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

Left columnRight column
1IF age >= 13 AND hasPermission = TRUE AThe paths are swapped. A student who fails the first test still gets checked again, and passing the first test skips the second test.
2Diamond 1 No path and Diamond 2 No path both point to the same box BTwo decisions in a row in a flowchart: the first checks age, and only its Yes path leads to the permission check.
3Only Yes then Yes reaches the action, which matches a single AND condition in pseudocode CIF temp > 20 AND raining = FALSE THEN OUTPUT "Go to the oval" ENDIF
4The second diamond is only reached when the first answer is Yes, so the two tests sit in a row DWhichever test fails, the flow carries on to the same next step, so the action is skipped either way.
5Diamond 1 Yes goes to the action, Diamond 2 is drawn beside it with its own Yes also going to the action EIF score >= 50 AND attendance >= 80 THEN OUTPUT "Pass" ENDIF
6Diamond 1 No goes to the second diamond, and Diamond 1 Yes goes to the action FThis draws OR, not AND. Either diamond can reach the action by itself, so only one condition has to be true.

Definitions

IF A AND B

Fill in the Blanks

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

1.
IF age >= 13 ___ parent = "Yes" THEN DISPLAY "Join" ENDIF
2.
IF score >= 50 AND attendance >= 80 ____ DISPLAY "Pass" ENDIF
3.
IF raining = "No" AND temp _ 15 THEN DISPLAY "Picnic" ENDIF
4.
IF age >= 13 THEN __ parent = "Yes" THEN DISPLAY "Join"
5.
IF hasTicket = "Yes" AND seats > 0 THEN DISPLAY "Enter" _____

Spot the Error

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

Question 1
A D1: age >= 13?
B D1 Yes -> Enter
C D1 No -> Skip
D D2: hasTicket = TRUE?
E D2 Yes -> Enter
F D2 No -> Skip
Question 2
A D1: member = TRUE?
B D1 Yes -> D2
C D1 No -> Discount
D D2: spend > 50?
E D2 Yes -> Discount
F D2 No -> Full price
Question 3
A IF raining OR cold THEN
B OUTPUT "Take a coat"
C ENDIF
Question 4
A D1: score >= 50?
B D1 Yes -> D2
C D1 No -> D2
D D2: attendance >= 80?
E D2 Yes -> Pass
F D2 No -> Fail
Question 5
A D1: temp > 30?
B D1 Yes -> D2
C D1 No -> Stay home
D D2: temp > 30?
E D2 Yes -> Go swim
F D2 No -> Stay home

Answer Key

Drawing AND as two decisions in a row
Section A: Quick Questions
Q1
B — Two diamonds, one for each condition
Q2
A — The Yes path
Q3
B — Only when the first is Yes and then the second is Yes
Q4
A — Straight to the No step, skipping the second diamond
Q5
A — Both lead to the same next step
Section B: Match the Pairs
Q1
IF age >= 13 AND hasPermission = TRUE → Two decisions in a row in a flowchart: the first checks age, and only its Yes path leads to the permission check.
Q2
Diamond 1 No path and Diamond 2 No path both point to the same box → Whichever test fails, the flow carries on to the same next step, so the action is skipped either way.
Q3
Only Yes then Yes reaches the action, which matches a single AND condition in pseudocode → IF score >= 50 AND attendance >= 80 THEN OUTPUT "Pass" ENDIF
Q4
The second diamond is only reached when the first answer is Yes, so the two tests sit in a row → IF temp > 20 AND raining = FALSE THEN OUTPUT "Go to the oval" ENDIF
Q5
Diamond 1 Yes goes to the action, Diamond 2 is drawn beside it with its own Yes also going to the action → This draws OR, not AND. Either diamond can reach the action by itself, so only one condition has to be true.
Q6
Diamond 1 No goes to the second diamond, and Diamond 1 Yes goes to the action → The paths are swapped. A student who fails the first test still gets checked again, and passing the first test skips the second test.
Section C: Definitions
Q1
IF A AND B — In a flowchart, AND is two diamonds in a row: only Yes then Yes reaches the action, and a No from either diamond goes to the same next step.
Section D: Fill in the Blanks
Q1
IF age >= 13 AND parent = "Yes" THEN DISPLAY "Join" ENDIF
Q2
IF score >= 50 AND attendance >= 80 THEN DISPLAY "Pass" ENDIF
Q3
IF raining = "No" AND temp > 15 THEN DISPLAY "Picnic" ENDIF
Q4
IF age >= 13 THEN IF parent = "Yes" THEN DISPLAY "Join"
Q5
IF hasTicket = "Yes" AND seats > 0 THEN DISPLAY "Enter" ENDIF
Section E: Spot the Error
Q1
B — AND is two diamonds in a row. A Yes from D1 must lead on to D2 so the second condition is checked too. Going straight to Enter skips D2. It should be D1 Yes -> D2.
Q2
C — A No from either diamond must go to the same next step. D1 No should go to Full price, like D2 No. A No can never reach the Discount action.
Q3
A — Two diamonds in a row are drawn from IF A AND B. OR would let either condition alone reach the action. It should be IF raining AND cold THEN.
Q4
C — Only the Yes path of D1 may lead to D2. If a No also goes to D2, a student could still reach Pass after failing the first test. D1 No should go to Fail.
Q5
D — The second diamond must test the second condition (sunny = TRUE). Repeating the temp test means the sunny part of A AND B is never checked.