Skip to main content
SingaporeComputer ScienceSyllabus dot point

What is an algorithm, and how do flowchart symbols show its steps and decisions?

Define an algorithm and represent its sequence, selection and iteration using standard flowchart symbols

A focused answer to the O-Level Computing point on algorithms and flowcharts. What an algorithm is, the standard flowchart symbols, and how to show sequence, selection and iteration in a flowchart.

Generated by Claude Opus 4.87 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

SEAB wants you to define an algorithm and to draw its logic with the standard flowchart symbols, showing the three control structures: sequence, selection and iteration. The central idea is that any task can be broken into ordered steps, and a flowchart is a diagram that makes those steps, decisions and repetitions easy to see and check.

The answer

What an algorithm is

An algorithm is a step-by-step set of instructions for solving a problem. A good algorithm is:

  • Ordered: the steps run in a definite sequence.
  • Unambiguous: each step has one clear meaning.
  • Finite: it ends after a limited number of steps.

A recipe is an everyday algorithm: clear steps, in order, that finish with a result.

The three control structures

Every algorithm is built from three structures:

  • Sequence: steps done one after another.
  • Selection: a decision that chooses between paths.
  • Iteration: a loop that repeats steps.

Standard flowchart symbols

Symbol Shape Use
Terminator rounded box Start and Stop
Process rectangle a calculation or action
Input/Output parallelogram reading input or showing output
Decision diamond a yes/no question (two exits)
Flow line arrow the order to follow

Showing selection

A decision diamond asks a yes/no question. It has two exits, labelled Yes and No, and the flow follows one branch or the other. The branches usually rejoin afterwards.

        +-----------+
        | x > 0 ?   |
        +-----------+
         Yes /   \ No
            /     \
   "Positive"   "Not positive"

Showing iteration

A loop is drawn by sending a flow line back to an earlier point, guarded by a decision. While the decision keeps answering Yes, the steps repeat; when it answers No, the flow moves on. This is how a flowchart shows a "repeat until" or "while" loop.

Examples in context

Example 1. A vending machine. The machine follows an algorithm: take money (input), check if enough has been paid (decision), and either dispense the item (process and output) or ask for more (loop back). Drawing it as a flowchart shows exactly where the decision and the loop sit.

Example 2. Sorting the post. A worker following "if the letter is local, put it in tray A, otherwise tray B, and repeat for every letter" is running selection inside iteration. A flowchart with a decision diamond inside a loop captures the same logic before any code is written.

Try this

Q1. Name the flowchart symbol used for input and output. [1 mark]

  • Cue. A parallelogram.

Q2. State the three control structures used to build algorithms. [3 marks]

  • Cue. Sequence, selection and iteration.

Q3. Explain why a decision symbol has two exits. [2 marks]

  • Cue. It asks a yes/no question, and the flow must follow a different path for each answer.

Exam-style practice questions

Practice questions written in the style of SEAB exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Original4 marks(a) Define the term algorithm. (b) Name the flowchart symbol used for a decision, and explain how many exits it has and why.
Show worked answer →

(a) An algorithm is a step-by-step set of instructions for solving a problem or completing a task, written so that each step is clear and unambiguous and the steps are carried out in a definite order.

(b) The decision symbol is a diamond (a rhombus). It has two exits, usually labelled Yes and No (or True and False), because a decision asks a question with a yes-or-no answer and the flow must follow a different path depending on the result.

Markers reward a clear definition (ordered, unambiguous steps to solve a problem) and the diamond decision symbol with two labelled exits.

Original5 marksDescribe, using the correct flowchart symbols, an algorithm that asks the user for a number, then prints 'Positive' if the number is greater than 00 and 'Not positive' otherwise. State the symbol used at each stage.
Show worked answer →

The flow uses four kinds of symbol in order:

  1. Terminator (rounded box): Start.
  2. Input/output (parallelogram): input the number.
  3. Decision (diamond): is the number greater than 00? This has two exits.
  4. Input/output (parallelogram) on each branch: the Yes branch outputs "Positive"; the No branch outputs "Not positive".
  5. Terminator (rounded box): both branches join and reach Stop.

The decision is the selection; everything else is sequence.

Markers reward the terminator, input/output and decision symbols used correctly, two branches from the diamond, and the branches rejoining before Stop.

Related dot points