CIE IGCSE | 7.2.4 Flowchart Symbols and Control Flow

Lesson objective

Identify standard flowchart symbols and trace sequence, selection and iteration through a flowchart.

Learn

7.2.4 | FLOWCHART SYMBOLS AND CONTROL FLOW

01 | MAKE THE STEPS VISIBLE

Imagine giving someone directions through school: start at reception, walk to the stairs, and check whether the library is open. If it is open, go inside; if not, return to reception. Some instructions happen in order, but one instruction creates a choice.

A flowchart represents an algorithm using symbols connected by arrows. An algorithm is a precise sequence of steps for completing a task. The shapes tell us what kind of step is happening, and the arrows show where to go next.

The route followed through the instructions is called control flow. It can move through a sequence, choose a branch or repeat earlier steps.

Unlike a structure diagram, a flowchart shows execution rather than just grouping components. Read it by following its arrows, not by assuming every box runs from top to bottom.

02 | LEARN THE STANDARD SYMBOLS

The symbol is part of the meaning. A calculation and a decision should not be drawn in identical shapes just because both contain text.

TERMINATOR

Start / End

PROCESS

Total ← A + B

INPUT / OUTPUT

INPUT A

DECISION

A > 0?

SUBROUTINE / PREDEFINED PROCESS

CheckDuplicate

FLOW LINE

A terminator marks where an algorithm starts or ends. A process rectangle contains an action such as calculating or assigning a value. An input/output parallelogram receives or communicates data. A decision diamond tests a condition and has labelled outcomes.

A flow line has an arrowhead to show direction. The Cambridge syllabus also includes a subroutine symbol, also called a predefined-process symbol: a rectangle with an extra vertical line near each side. It represents a named routine whose internal steps are defined elsewhere.

Use the standard symbols when constructing an exam flowchart. The examples below use these shapes rather than decorative boxes.

03 | SEQUENCE: ONE STEP AFTER ANOTHER

Sequence means executing instructions in order. Let us build a simple program that receives two numbers and displays their sum.

StartINPUT AINPUT BTotal ← A + BOUTPUT TotalEnd

The first parallelogram receives A. The second receives B. The rectangle calculates Total ← A + B. The final parallelogram outputs the calculated total.

The arrow ← means assignment: work out the expression on the right, then store the value using the name on the left. If A is 4 and B is 3, the process sets Total to 7.

Notice the difference between calculating and displaying. Total ← A + B is a process, while OUTPUT Total is output. Reversing their order would try to show the total before this calculation has produced it.

04 | SELECTION: A DECISION CHOOSES A PATH

Selection means choosing which instructions to execute according to a condition. A condition is a question whose result is true or false.

Suppose a club has capacity 3. We will focus only on checking capacity, assuming the student identifier has already passed the other required checks. BookingCount < Capacity asks whether there is room for another booking.

StartBookingCount< Capacity?YesNoBookingCount ←BookingCount + 1OUTPUT"Booking accepted"OUTPUT "Club full"End

If the condition is true, follow the Yes branch to increase the count and display acceptance. If it is false, follow the No branch to display “Club full”. The branches then join at the end.

One execution follows one outcome of this decision. It does not display both messages. Yes/No labels explain which arrow corresponds to each condition result; True/False can express the same distinction.

05 | TRACE BOTH SIDES OF THE DECISION

A trace follows the algorithm step by step using particular starting values. You do not need a computer to do this: use the values to decide which arrows to follow.

With count 2 and capacity 3, the condition is 2 < 3, which is true. Follow Yes. The count becomes 3 and the output is “Booking accepted”.

With count 3 and capacity 3, the condition is 3 < 3, which is false. Follow No. The count stays at 3 and the output is “Club full”.

Independent capacity-check traces
Starting countCondition with capacity 3PathFinal count and output
22 < 3 is trueYes3; Booking accepted
33 < 3 is falseNo3; Club full

The two rows are independent starting situations. Checking both matters because a correct acceptance path does not prove the rejection path is also correct.

This simplified example changes only the count. A complete booking solution must also record accepted identifiers and carry out duplicate checking. A flowchart’s scope should be clear.

06 | ITERATION: REPEAT A GROUP OF STEPS

Iteration means repetition. A loop is a section of an algorithm that can run more than once. In a flowchart, a backwards arrow can return control to an earlier point.

Suppose we want to display 1, 2 and 3. We set a variable called Count to 1. Before each repetition, we check whether Count is less than or equal to 3. If it is, we output Count, increase it by 1 and return to the condition.

StartCount ← 1Count ≤ 3?YesOUTPUT CountCount ← Count + 1NoEnd

On the No branch, the algorithm ends. This is a pre-condition loop because the condition is checked before executing the repeated instructions. If Count had started at 4, the body would not run at all.

The loop body is the group of instructions being repeated: output the count and increase it. The return arrow is essential because it shows that the next step is another condition check.

07 | WALK THROUGH THE LOOP SLOWLY

At the start, Count is 1. The check 1 ≤ 3 is true, so the flowchart outputs 1. The update makes Count equal to 2, and the arrow returns to the condition.

The check 2 ≤ 3 is true, so 2 is output and Count becomes 3. The check 3 ≤ 3 is also true, so 3 is output and Count becomes 4.

Now 4 ≤ 3 is false. Follow No to End. The displayed values are 1, 2 and 3; 4 is never displayed.

Tracing every condition check
Count at checkCount ≤ 3?OutputCount after update
1True12
2True23
3True34
4FalseNoneNo update; ends

The final condition check is still a step in the algorithm even though the body does not execute. Do not stop tracing immediately after the last intended output: follow the arrows until the algorithm reaches End.

08 | WHAT MAKES A LOOP STOP?

The condition and the update work together. The condition asks whether another repetition should happen. The update changes a value so that the condition can eventually become false.

If we remove Count ← Count + 1, Count stays at 1. The condition remains true and the algorithm keeps displaying 1. This is an infinite loop: control continues repeating without reaching the intended exit.

If we change the condition from Count ≤ 3 to Count < 3, the algorithm outputs only 1 and 2. When Count reaches 3, the condition is already false. That is a logic error if the requirement was to display 1 through 3.

Always check initialisation, condition, repeated actions, update and exit path. A neat picture can still describe an incorrect algorithm.

09 | A LOOP CAN CHECK AFTER THE BODY

Some tasks must happen at least once. For example, a program has to ask for a menu choice before it can check whether the entered choice is valid.

In a post-condition loop, control enters the body first, then reaches the decision. A validation design could input a choice, check whether it is valid, and follow the invalid branch back to input another choice.

If the first choice is valid, the body still ran once. This differs from a pre-condition loop, whose initial check can prevent the body running at all.

The labels must match the actual question in the diamond. If it asks “Choice valid?”, Yes should leave the retry loop and No should return for another input. If you instead ask “Choice invalid?”, the branch meanings reverse.

You will practise different loop forms in the programming lessons. For now, use the position of the decision and the arrow directions to work out the behaviour.

10 | USE A NAMED ROUTINE WITHOUT DRAWING EVERY STEP

Large flowcharts can become difficult to read. A predefined process symbol can represent a routine whose detailed algorithm is shown elsewhere.

For example, a main booking flowchart might call CheckDuplicate. A separate flowchart or pseudocode description explains how that routine checks identifiers.

The extra vertical lines distinguish this symbol from an ordinary process rectangle. The label should name the routine clearly; it should not hide an undefined instruction such as “Do everything”.

A predefined process supports organising the design into smaller parts, but the main flowchart still needs to show the relevant steps and decisions. The routine’s required inputs and results must be explained where needed.

11 | DRAW A FLOWCHART THAT CAN BE FOLLOWED

Begin by understanding the task and identifying the information and decisions required. Put a clear Start at the entry point, then draw each step using the appropriate symbol.

Connect the shapes with arrowheads. Give both outcomes of a binary decision a route, and label them. If paths merge, make the meeting point clear rather than letting lines cross ambiguously.

For a loop, draw the return path to the correct step. Returning to an initialisation that resets Count to 1 every time would produce different behaviour from returning to the condition.

Keep labels precise and inside their symbols. Use an expression such as Count < Capacity rather than “Is it okay?” when the decision depends on those values.

Finally, dry-run the drawing with more than one input. The drawing is a proposed algorithm, so it needs the same careful checking as written pseudocode.

12 | PRACTISE WITH A SIMPLE DISCOUNT TASK

A shop gives a discount of 2 units when an order total is at least 10. Otherwise no discount is applied. The program receives Total and outputs the final amount.

Design the input/output parallelogram for Total, then a decision diamond containing Total ≥ 10. The Yes branch calculates Final ← Total − 2. The No branch sets Final ← Total. Both join before OUTPUT Final.

Test 8, 10 and 12. The expected outputs are 8, 8 and 10 respectively. Testing exactly 10 matters because the rule says “at least”, which includes equality.

Draw the chart in your exercise book before looking at the suggested structure in Questions. You are practising how a requirement becomes a precise condition and two different paths.

13 | EXPLAIN CONTROL FLOW CLEARLY

For a describe question, state the steps and conditions in a sensible order. For an explain question, include why the path is followed: “With Count equal to 4, the condition Count ≤ 3 is false, therefore control follows the No branch and the loop ends.”

Avoid saying that every shape runs once. Selection skips the unchosen branch, and iteration can revisit a shape several times. Read the arrows and evaluate the conditions.

Remember the distinction from the previous lesson: structure diagrams show how components are organised. Flowcharts show the steps and decision paths used while an algorithm executes.

You should now be able to identify the standard symbols, follow both sides of a decision and trace a loop through its final exit check.

MATCH THE FLOWCHART TERM

Terminology

Terminology

Flowchart

A graphical representation of an algorithm using symbols and arrows.

Algorithm

A precise sequence of steps for completing a task.

Control flow

The order and paths followed during execution.

Terminator

The symbol marking the start or end of an algorithm.

Process symbol

A rectangle representing an operation such as calculation or assignment.

Input/output symbol

A parallelogram representing receiving or communicating data.

Decision symbol

A diamond testing a condition with labelled outcomes.

Flow line

A directed connection showing where control goes next.

Predefined process

A symbol naming a routine whose detailed steps are defined elsewhere.

Sequence

Executing instructions in order.

Selection

Choosing instructions according to a condition.

Iteration

Repeating instructions.

Condition

An expression evaluated as true or false.

Assignment

Storing a calculated or supplied value using a name.

Loop body

The instructions repeated by a loop.

Pre-condition loop

A loop checking its condition before executing its body.

Post-condition loop

A loop checking its condition after executing its body at least once.

Infinite loop

Repetition that does not reach an intended exit.

Initialisation

Setting a starting value before it is used.

Dry run

Following an algorithm by hand using chosen data.

Questions

Questions

CHECK YOUR UNDERSTANDING

Select all correct choices. Each exact set earns one point.

1. Which symbol should contain INPUT StudentID?
2. Which belong in process rectangles?
3. With count 3 and capacity 3, is Count < Capacity true?
4. Which describe a decision?
5. Count starts at 1; while Count ≤ 3, output it then add one. What is output?
6. What happens if the counter update is removed from that loop?
7. Which statements about loop forms are correct?
8. Which make a flowchart precise?

EXPLAIN AND COMPARE

Write your answers before revealing each sample.

1. Describe the purpose of four standard flowchart symbols.

2. Explain why Count ← Count + 1 and OUTPUT Count use different symbols.

3. Explain why Count < Capacity rejects a count of three when capacity is three.

4. Describe the trace of the loop that outputs one through three.

5. Explain why removing the update creates an infinite loop in this example.

6. Compare a pre-condition and post-condition loop.

7. Explain why a structure diagram cannot replace the booking decision flowchart.

APPLY IT | DRAW THE DISCOUNT FLOWCHART

Draw the discount algorithm described in Learn, using standard symbols. Trace totals of 8, 10 and 12. Then change the condition to Total > 10 and explain which of those tests reveals the error.

Reveal suggested structure and results

Start → INPUT Total → decision Total ≥ 10. Yes: Final ← Total − 2. No: Final ← Total. Join the branches → OUTPUT Final → End. The correct outputs are 8, 8 and 10. With > instead of ≥, input 10 incorrectly outputs 10, because equality no longer qualifies for the discount.

Flashcards

Flashcards

Click to flip. Select the ideas you need to revisit.

0 cards selected for revision.

    Selections are kept while this page is open.

    Workbook

    Workbook

    COMING SOON

    The workbook for 7.2.4 Flowchart Symbols and Control Flow is coming soon. Complete the matching task and written questions in your exercise book.