Year 8 · Y8.2 Computational Thinking · Lesson 2
Stretch tasks Flowcharts
Quiz Challenge
A quiz game against four computer players, then short and long written answers.
- Quiz Blitz12 questions against the clock
- Quick Fire4 short answers
- Big Think2 long answers
About 20 minutes
This or That
Pixel the cat asks 8 questions. Each has two answers: pick the right one.
- Two answers to every question
- A fish treat for every right answer
- Streaks win Pixel shades, then a party hat
About 4 minutes
Memory Match
Flip the cards two at a time to match each term card to its meaning card.
- 12 cards: each term has a meaning
- One peek at every card
- Combo points for pairs found in a row
6 pairs, about 4 minutes
The games need JavaScript. Every question is below, with the answers at the end.
Flowcharts: the questions
Quiz Challenge, round 1: Quiz Blitz
Which flowchart shape is used for a decision?
- Rounded rectangle
- Diamond
- Rectangle
- Parallelogram
Which shape would you use for: Input age?
- Parallelogram
- Rectangle
- Diamond
- Rounded rectangle
A decision diamond can have three exits when there are three possible answers.
- True
- False
Put this flowchart for an odd or even checker in order.
Number these 1 to 5.
- Is number MOD 2 = 0?
- Output Even or Odd
- Stop
- Start
- Input number
How is a loop shown in a flowchart?
- A circle drawn around the repeated steps
- A rectangle with the word LOOP inside
- A dotted line along the bottom
- An arrow going back up to an earlier step
What is output when the score is exactly 50?
Start Input score Is score >= 50? Yes -> Output "Pass" No -> Output "Fail" Stop- Pass, then Fail
- Pass
- Fail
- Nothing is output
Trace the flowchart. Type every number it outputs, with spaces between them.
Start count = 1 Output count <-+ count = count + 2 | Is count > 7? | No -> back up -------+ Yes -> StopStart, then Input age, then a diamond asking Is age >= 13? with one unlabelled arrow to Output Allowed, then Stop. What is wrong?
- Input should be drawn as a rectangle
- A flowchart needs two Start symbols
- Output must always come before Input
- The decision has only one exit, and it is not labelled
Which TWO are rules for drawing flowcharts?
Tick 2.
- Every decision has exactly two labelled exits
- It begins with Start and ends with Stop
- Every flowchart must contain a loop
- Arrows can point both ways at once
- Process boxes must be coloured in
Which shape is used for: total = total + price?
- Parallelogram
- Diamond
- Rounded rectangle
- Rectangle
A flowchart and a piece of pseudocode can describe exactly the same algorithm.
- True
- False
Why do programmers draw flowcharts before writing code?
- To check the logic of an algorithm before any code is written
- Computers run flowcharts faster than code
- A flowchart replaces the need for testing
- Code will not run without a flowchart
Quiz Challenge, round 2: Quick Fire
Name the flowchart symbol for each step. (a) Output Hello (b) Is x > 10? [2 marks]
Explain why both exits of a decision diamond must be labelled. [2 marks]
A flowchart asks Is password correct? If the answer is No, an arrow goes back to Input password. What does this arrow create, and what is the risk? [2 marks]
Explain the difference between a process box and an input or output box. [2 marks]
Quiz Challenge, round 3: Big Think
Describe a flowchart for an algorithm that asks for a number, then outputs whether it is positive, negative or zero. [4 marks]
Compare flowcharts and pseudocode as ways of planning an algorithm. Which would you use for a long program, and why? [6 marks]
This or That: tick the right answer
Which shape holds Start and Stop?
- A rounded rectangle
- A diamond
Which shape is used for Output "Well done"?
- Rectangle
- Parallelogram
What must be written on the two arrows that leave a decision?
- Yes and No
- Start and Stop
In the flowchart that checks whether a number is even, which test decides the answer?
- number / 2 = 0
- number MOD 2 = 0
What is the most common mistake in flowchart questions?
- Using too many arrows
- Unlabelled decision branches
A flowchart inputs 7 and asks: Is number MOD 2 = 0? What is output?
- Even
- Odd
Which symbol would hold: Is the password correct?
- Diamond
- Parallelogram
Where must every flowchart finish?
- At a Stop terminal
- At the last decision
Memory Match: match each term to its meaning
| Term | Meaning |
|---|---|
| A Rounded rectangle | 1 A decision with Yes and No exits |
| B Rectangle | 2 Start or Stop |
| C Parallelogram | 3 A process, such as a calculation |
| D Diamond | 4 Shows the direction of flow |
| E Arrow | 5 An algorithm drawn as a diagram |
| F Flowchart | 6 Input or output |
Answers
Round 1: Quiz Blitz
- Diamond A diamond asks a question and has exactly two labelled exits, such as Yes and No.
- Parallelogram Input and output both use the parallelogram.
- False A decision always has exactly two exits. Three outcomes need two decisions, one after the other.
- Start → Input number → Is number MOD 2 = 0? → Output Even or Odd → Stop Start, get the data in, decide, show the result, stop. Most flowcharts follow that shape.
- An arrow going back up to an earlier step An arrow that returns to an earlier box makes those steps happen again.
- Pass >= means greater than or equal to, so 50 passes. Boundary values like this are where bugs hide.
- 1 3 5 7 count goes 1, 3, 5, 7. After 7 it becomes 9, which is greater than 7, so the loop stops before 9 is output.
- The decision has only one exit, and it is not labelled Every decision needs two labelled exits. Here nobody knows what happens to someone under 13.
- Every decision has exactly two labelled exits; It begins with Start and ends with Stop Two labelled exits per decision, and one clear start and stop. Loops are only there when the algorithm needs one.
- Rectangle A calculation or action inside the computer is a process, drawn as a rectangle.
- True They are two ways of writing down the same steps: one as a diagram, one as structured text.
- To check the logic of an algorithm before any code is written A flowchart lets you see and fix the logic while it is still cheap to change.
Round 2: Quick Fire
- (a) Parallelogram
- (b) Diamond
Model answer(a) Output uses a parallelogram. (b) A decision uses a diamond.
- So the reader knows which way is Yes and which is No
- Otherwise it is unclear and could be followed the wrong way
Model answerLabels show which way is Yes and which is No. Without them the flowchart is ambiguous, and someone could follow the wrong branch and get the wrong result.
- A loop
- It could go on forever, giving unlimited guesses
Model answerThe arrow creates a loop. The risk is that it could go on forever: with no limit on attempts, someone could keep guessing passwords until they get in.
- A process is a calculation or action carried out inside the computer
- Input or output is data coming in from the user, or results shown to them
Model answerA process box is a calculation or action carried out inside the computer, such as adding to a total. An input or output box is data coming in from the user, such as typing a number, or results being displayed on the screen.
Round 3: Big Think
- Start and Stop in rounded terminal boxes
- The number is input in a parallelogram
- A decision diamond, such as Is number > 0?
- A second decision, because three outcomes need two diamonds
- Both exits of each decision labelled Yes and No
- Each result is output in a parallelogram
Model answerThe flowchart begins with a Start terminal. A parallelogram inputs the number. A decision diamond asks Is number > 0?; its Yes exit leads to an output parallelogram saying Positive. Its No exit leads to a second decision, because three outcomes need two diamonds: Is number < 0? Its Yes exit outputs Negative and its No exit outputs Zero. Every exit is labelled Yes or No, and all three outputs join and flow to Stop.
- Flowcharts are visual, so the flow is easy to see
- Flowcharts are easier for beginners or non-programmers to understand
- Flowcharts get large and messy for long programs
- Pseudocode is close to real code, so it is easy to turn into a program
- Pseudocode is quicker to write and edit, and more compact
- Pseudocode has no strict syntax, so you can focus on the logic
- A justified choice for a long program, normally pseudocode
Model answerFlowcharts are visual, so the flow of the algorithm is easy to see, and beginners or people who cannot code find them easy to understand. However, they take up a lot of space and get large and messy for long programs. Pseudocode is written as structured text, so it is compact and quicker to write and edit, and because it is close to real code it is easy to convert into a program. It has no strict syntax, so you can focus on the logic. For a long program I would use pseudocode, because a flowchart of hundreds of steps would cover many pages and be hard to change, whereas pseudocode stays readable and turns straight into code.
This or That
- A rounded rectangle Start and Stop go in the terminal shape, a rounded rectangle. A diamond is a decision.
- Parallelogram Inputs and outputs use a parallelogram. A rectangle is a process, such as a calculation.
- Yes and No Each exit is labelled, so the reader knows which way to go for each answer.
- number MOD 2 = 0 MOD gives the remainder. An even number leaves a remainder of 0 when divided by 2.
- Unlabelled decision branches Without Yes and No labels, nobody can tell which branch to follow.
- Odd 7 MOD 2 is 1, not 0, so the No branch runs and outputs Odd.
- Diamond A question with Yes and No answers is a decision, drawn as a diamond.
- At a Stop terminal Every flowchart begins with Start and finishes with Stop, both in rounded rectangles.
Memory Match
- A 2 Rounded rectangle: Start or Stop
- B 3 Rectangle: A process, such as a calculation
- C 6 Parallelogram: Input or output
- D 1 Diamond: A decision with Yes and No exits
- E 4 Arrow: Shows the direction of flow
- F 5 Flowchart: An algorithm drawn as a diagram