Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Flowchart for IF ... THEN ... ELSE worksheet is part of the IGCSE Computer Science 0478 — 7c Pseudocode and Flowcharts journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1Diamond: Score >= 50 ? | AThe Yes and No paths each end separately instead of rejoining, so the next step after ENDIF is never reached | |
| 2IF Age >= 13 THEN OUTPUT "Teen" ENDIF | BA decision diamond that asks the IF condition and has one Yes path and one No path leaving it | |
| 3In IF ... THEN ... ELSE, the Yes path runs the THEN statements and the No path runs the ELSE statements | CAn IF without ELSE: the Yes path runs OUTPUT, and the No path is empty and goes straight to the rejoin point | |
| 4After the Yes and No paths finish, both flow lines join again so the next statement runs whichever path was taken | DThe two flow lines are not labelled, so the reader cannot tell which path is taken when the condition is true or false | |
| 5Diamond: Mark >= 50 ? Two arrows leave the diamond with no labels | EIF Mark >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF | |
| 6Yes path: OUTPUT "Pass" then END No path: OUTPUT "Fail" then END | FIF Mark >= 50 THEN Result ← "Pass" ELSE Result ← "Fail" ENDIF OUTPUT Result |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
decision diamond — The flowchart shape for an IF. It asks a question, then the Yes path and the No path each run their own statements and rejoin before the next step.IF Mark >= 50 THEN
OUTPUT "Pass"
ENDIFELSE
OUTPUT "Fail"
ENDIFIF Score >= 50 THEN
OUTPUT "Pass"
ENDIFDiamond: Age >= 18 ?
Yes: OUTPUT "Adult"
No: OUTPUT "Child"IF Age >= 18 THEN
OUTPUT "Adult"
ELSE