Flowchart Examples: 46 Problems with Answers

Worked examples of Flowchart to try before you open each solution, then practice problems with answers.

Worked Examples

Example 1

easy
Name the four standard flowchart symbols and what each represents.
Show solution

Answer

Oval = Start/End, Rectangle = Process, Diamond = Decision, Parallelogram = Input/Output. Arrows show flow.

First step

1.
Step 1: Oval (rounded rectangle) = Start/End (terminator). Rectangle = Process (an action or calculation).

Full solution

  1. 2.
    Step 2: Diamond = Decision (a yes/no question that creates a branch). Parallelogram = Input/Output (data entering or leaving the system).
  2. 3.
    Step 3: Arrows connect the symbols to show the flow of control from one step to the next.
Flowcharts use standardised symbols to visually represent algorithms. They are especially useful for showing branching logic and loops in a way that is easy to follow.

Example 2

medium
Describe the flowchart for a program that keeps asking the user to enter a password until they enter the correct one ('secret123'), then outputs 'Access granted'.

Example 3

medium
Trace: Start -> [i=0,s=0] -> <i<5?> yes-> [s=s+i; i=i+1] back to diamond; no-> [print s] -> End. What prints?

Example 4

medium
Trace: Start -> [n=7,c=0] -> <n>0?> yes->[c=c+1; n=n-2] back; no-> [print c] -> End. What prints?

Example 5

medium
Trace: Start -> [a=5,b=2] -> [t=a; a=b; b=t] -> [print a, print b] -> End. What is printed?

Example 6

medium
Trace: Start -> [n=12] -> <n%2==0?> yes->[print EVEN] no->[print ODD] -> End. What prints?

Example 7

medium
Trace: Start -> [a=4,b=6] -> <a>b?> yes->[m=a] no->[m=b] -> [print m] -> End. What prints?

Example 8

medium
Trace: Start -> [i=1,p=1] -> <i<=4?> yes->[p=p*i; i=i+1] back; no->[print p] -> End. What prints?

Example 9

hard
Trace nested decisions: Start -> [t=72] -> <t<60?> yes->[print COLD] no-><t<80?> yes->[print MILD] no->[print HOT] -> End. What prints?

Example 10

hard
Trace: Start -> [n=20,c=0] -> <n>1?> yes-> [if n even: n=n/2 else n=3n+1; c=c+1] back; no-> print c -> End. What prints? (Collatz from 20)

Example 11

hard
Trace: Start -> [i=2,n=10,f=true] -> <i*i<=n?> yes-> [if n%i==0: f=false; i=i+1] back; no-> if f print PRIME else print NOT -> End. What prints?

Example 12

challenge
Trace: Start -> [a=48,b=18] -> <b!=0?> yes-> [t=b; b=a%b; a=t] back; no-> [print a] -> End. What prints? (Euclidean GCD)

Practice Problems

Try each one, then open the solution to compare your method.

Example 1

medium
Describe the flowchart for a program that reads a number and outputs whether it is positive, negative, or zero.

Example 2

hard
Compare the strengths and weaknesses of flowcharts vs pseudocode for designing algorithms. When would you choose each?

Example 3

easy
In a flowchart, which shape represents a DECISION (yes/no question)?

Example 4

easy
In a flowchart, which shape represents a PROCESS or action step?

Example 5

easy
Which flowchart shape marks the START or END of the program?

Example 6

easy
Which flowchart shape represents INPUT or OUTPUT (e.g., read a number, print a result)?

Example 7

easy
What do the ARROWS in a flowchart represent?

Example 8

easy
A diamond in a flowchart has how many outgoing branches at minimum?

Example 9

easy
Trace this flowchart: Start -> [read x=5] -> <x > 0?> --yes--> [print POSITIVE] -> End. What is printed?

Example 10

easy
Which shape is WRONG for a decision: diamond or rectangle?

Example 11

medium
Trace: Start -> [n=4] -> <n even?> --yes--> [print EVEN] -> End; --no--> [print ODD] -> End. Printed?

Example 12

medium
Trace a loop flowchart: Start -> [i=1, s=0] -> <i <= 3?> --yes--> [s=s+i; i=i+1] -> back to diamond; --no--> [print s]. What prints?

Example 13

medium
A flowchart has a process box with NO outgoing arrow (a dead end before End). What is the defect?

Example 14

medium
Trace: Start -> [x=10] -> <x>5?> yes-> [x=x-5] -> back to diamond; no-> [print x]. What prints?

Example 15

medium
Convert this pseudocode to flowchart shapes: INPUT n; IF n<0 THEN OUTPUT 'neg'. Which shapes, in order?

Example 16

medium
Trace: Start -> [a=2,b=3] -> <a>b?> yes->[m=a] no->[m=b] -> [print m]. What prints?

Example 17

medium
How detailed should a flowchart be, per the design guideline?

Example 18

medium
Trace: Start -> [n=6,c=0] -> <n>1?> yes-> [IF n even: n=n/2 ELSE n=3n+1; c=c+1] back; no-> print c. (Collatz from 6) What prints?

Example 19

medium
Trace: Start -> [x=3,y=4] -> <x<y?> yes->[print x] no->[print y] -> [print x+y]. What is printed (in order)?

Example 20

challenge
Trace a counting loop with a guard: Start -> [i=0,c=0] -> <i<5?> yes-> [IF i is odd: c=c+1; i=i+1] back; no-> print c. What prints?

Example 21

challenge
A flowchart's loop diamond always evaluates to 'yes' (condition never becomes false). What is the defect, and what loop construct does it mirror?

Example 22

challenge
Trace nested decisions: Start -> [s=85] -> <s>=90?> yes->[g=A] no-><s>=80?> yes->[g=B] no->[g=C] -> print g. What prints?

Example 23

easy
How many outgoing arrows does a well-formed decision diamond have?

Example 24

easy
Trace: Start -> [x=8] -> <x>10?> yes->[print BIG]; no->[print SMALL] -> End. What prints?

Example 25

easy
Which is wrong: using a diamond for 'set total = 0'?

Example 26

easy
Trace: Start -> [n=0] -> <n==0?> yes->[print ZERO] no->[print NONZERO] -> End. What prints?

Example 27

medium
A diamond in a flowchart has only ONE outgoing arrow. What defect is this?

Example 28

medium
Convert to flowchart shapes: 'INPUT x; SET y = x * 2; OUTPUT y'. List the shapes in order.

Example 29

medium
Why is a flowchart useful for explaining a loop with a parent or non-programmer?

Example 30

medium
A flowchart shows a process box that points back to itself with no decision in between. What problem is this?

Example 31

medium
Should the same flowchart be shown to engineers and to first-time users?

Example 32

hard
A flowchart has TWO start ovals at the top. Why is this a defect?

Example 33

hard
Compare: when is a flowchart better than pseudocode, and when is pseudocode better?

Example 34

challenge
A flowchart's two branches of a decision both rejoin the same downstream rectangle. What programming construct does this rejoin represent?

What to focus on

Core idea: Flowcharts make control flow visible. They're especially useful for understanding loops and branching logic.

Common stuck point: Diamonds are for decisions (yes/no questions) only. Rectangles are for actions/processes.

Ask yourself: Are the steps drawn as shapes joined by arrows, with diamonds where the path splits on a yes/no answer?

Concept recap

A visual diagram that represents the steps of an algorithm using standard shapes: ovals for start and end, rectangles for processes or actions, diamonds for decisions (yes/no questions), parallelograms for input/output, and arrows to show the flow of execution between steps.

A flowchart is a board game track: you start on one square, follow the arrows, and some squares ask a question that sends you down one of two paths. Like a good game board, every path must lead to the finish or back into play. Unlike a game, nothing is left to chance: the same input always takes the same path.

Read the full lesson on Flowchart

Background knowledge

These ideas may be useful before you work through the harder examples.

pseudocodealgorithm