Following a flowchart to predict the result

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

Following a flowchart to predict the result

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Where do you begin when you follow a flowchart?
A At the first diamond
B At the Start oval
2. How do you move from one shape to the next?
A Follow the arrows
B Jump to any shape you like
3. You reach a diamond that asks 'Is score > 10?' and score is 7. Which arrow do you follow?
A The No arrow
B The Yes arrow
4. A flowchart sets count to 0, then has a box 'Add 1 to count'. After the box runs once, what is count?
A 1
B 0
5. Why do you write down the counter each time it changes?
A So you can skip the diamonds
B So you answer each diamond with the current value

Match the Pairs

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

Left columnRight column
1Oval labelled Start AOval labelled End
2Diamond: Is count = 3? Bcount: 0 → 1 → 2 → 3
3Write down each change to the counter so you can answer later diamonds correctly CYou forgot to record the counter change, so later diamonds are answered with an old value.
4The result is found when your finger reaches the end oval DA decision. Check the current value of count, then follow the Yes arrow or the No arrow.
5Count is 2. The diamond asks 'Is count = 5?' and you follow the Yes arrow. EThis is where you put your finger first. Begin here and follow the arrow out of it.
6A loop adds 1 to count each time, but you skip writing the new value and keep using 0. FThe answer to the diamond is wrong. 2 is not 5, so you must follow the No arrow.

Definitions

trace a flowchart

Fill in the Blanks

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

1.
_____ count ← 0 IF count < 3 THEN
2.
Diamond: is count less than 5? IF count _ 5 THEN
3.
count ← 3 count ← count _ 1 Now count is 4
4.
count ← 0 ______ 3 TIMES count ← count + 1
5.
count ← count + 1 SAY count ___

Spot the Error

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

Question 1
A START
B count <- count + 1
C REPEAT 3 TIMES
D count <- count + 1
E SHOW count
Question 2
A START
B INPUT mark
C IF mark >= 50 THEN
D SHOW "Try again"
E ELSE
F SHOW "Try again"
Question 3
A END
B score <- 0
C score <- score + 2
D SHOW score
E END
Question 4
A START
B lives <- 0
C REPEAT UNTIL lives = 0
D lives <- lives - 1
E SHOW lives
Question 5
A SHOW age
B IF age >= 10 THEN
C SHOW "Big kid"
D ELSE
E SHOW "Little kid"

Answer Key

Following a flowchart to predict the result
Section A: Quick Questions
Q1
B — At the Start oval
Q2
A — Follow the arrows
Q3
A — The No arrow
Q4
A — 1
Q5
B — So you answer each diamond with the current value
Section B: Match the Pairs
Q1
Oval labelled Start → This is where you put your finger first. Begin here and follow the arrow out of it.
Q2
Diamond: Is count = 3? → A decision. Check the current value of count, then follow the Yes arrow or the No arrow.
Q3
Write down each change to the counter so you can answer later diamonds correctly → count: 0 → 1 → 2 → 3
Q4
The result is found when your finger reaches the end oval → Oval labelled End
Q5
Count is 2. The diamond asks 'Is count = 5?' and you follow the Yes arrow. → The answer to the diamond is wrong. 2 is not 5, so you must follow the No arrow.
Q6
A loop adds 1 to count each time, but you skip writing the new value and keep using 0. → You forgot to record the counter change, so later diamonds are answered with an old value.
Section C: Definitions
Q1
trace a flowchart — Start at the oval, follow each arrow with your finger, answer every diamond using the current values, write down counter changes, and stop at the end oval to find the result.
Section D: Fill in the Blanks
Q1
START count ← 0 IF count < 3 THEN
Q2
Diamond: is count less than 5? IF count < 5 THEN
Q3
count ← 3 count ← count + 1 Now count is 4
Q4
count ← 0 REPEAT 3 TIMES count ← count + 1
Q5
count ← count + 1 SAY count END
Section E: Spot the Error
Q1
B — The counter needs a starting value before the loop. count + 1 can't be worked out if count has no value yet. It should be count <- 0.
Q2
D — This is the YES arrow of the diamond. When mark >= 50 is true you follow it, so it should show "Pass". "Try again" belongs on the ELSE (NO) path.
Q3
A — A flowchart begins at the START oval, so you know where to put your finger first. Line 1 should be START. END is where you stop.
Q4
B — The starting value should be 3. If lives starts at 0, the loop condition is already true and the loop never runs. Lives needs to count down from 3 to 0.
Q5
A — The diamond needs a value for age to answer its question. The first step should be INPUT age so the value is entered, not shown.