Skip to content
Computer ApplicationsICSE Class 8 · Algorithms and Flowcharts

Decision Making in Algorithms and Flowcharts: ICSE Class 8 with Traces

Updated 17 October 2026 · Fact-checked

A decision step asks a Yes/No question and the algorithm follows a different path for each answer. Class VIII covers one decision (greater of two, odd or even), a chain (positive, negative or zero; grades) and nested decisions (largest of three, leap year). Always trace the algorithm with boundary values.

Each diamond has one entry and two exits, Yes and No; follow N = -7: not above 0, below 0, so Negative.

Illustration drawn for QuestionBuddy.

Understand Decision Making in Algorithms and Flowcharts

What a decision is. A step that tests a condition. In a flowchart it is a diamond with one entry and two exits, Yes and No. Loops are not in Class VIII, so every algorithm here runs top to bottom once.

One decision: greater of two numbers. Input A, B. If A > B print A, else print B. Trace: A = 17, B = 29: 17 > 29 is No, so print 29.

One decision: odd or even. Input N. If N % 2 = 0 print Even, else print Odd. (% gives the remainder.) Trace: N = 27 gives remainder 1, so Odd; N = 40 gives remainder 0, so Even.

Chain: positive, negative or zero. If N > 0 print Positive; else if N < 0 print Negative; else print Zero. Trace: N = -7 is not above 0, is below 0, so Negative.

Chain: grade from marks M. If M >= 90 grade A; else if M >= 75 grade B; else if M >= 60 grade C; else grade D. Conditions are checked from the top and the first Yes wins. Trace: 82 gives B; 90 gives A; 60 gives C; 59 gives D.

Nested: largest of three A, B, C. If A > B then (if A > C print A, else print C) else (if B > C print B, else print C). Trace: 15, 25, 20: A > B is No, B > C is Yes, so print 25.

Nested: leap year Y. If Y is divisible by 400 it is a leap year; else if divisible by 100 it is not; else if divisible by 4 it is; else it is not. Traces: 2000 leap; 1900 not; 2024 leap; 2023 not.

Testing. Choose a value for each path and for each boundary (for example 90, 89, 75, 74 in the grade chain).

Decision Making in Algorithms and Flowcharts: key facts

Parts of a decision
  • Diamond
  • One entry
  • Two exits
  • Yes path
  • No path
Both exits must be labelled and both must reach Stop.
Grade chain
M >= 90A
M >= 75B
M >= 60C
OtherwiseD
Check from the top; first Yes wins.
Leap year rule
Divisible by 400leap
Else divisible by 100not leap
Else divisible by 4leap
Elsenot leap
2000 and 2024 are leap; 1900 and 2023 are not.

How to answer Decision Making in Algorithms and Flowcharts questions

Use this for any decision problem.

  1. 1List the input and the possible outputs.
  2. 2Write each condition as a Yes/No question using >, <, >= or the remainder test.
  3. 3Order the conditions so the strictest or most specific is tested first.
  4. 4Write Yes and No paths and make sure every path ends at Stop.
  5. 5Trace one value for each path plus the boundary values.

Decision Making in Algorithms and Flowcharts in real life

The idea, met in an everyday situation. Answer the question in your own words, then compare with the model answer. The one-line hook is what to remember.

A library fine rule

Suppose a hypothetical library charges nothing for up to 7 days, 2 rupees a day for 8 to 14 days and 5 rupees a day beyond 14 days (invented rates).

Which decisions are needed, and what is the rate for a book kept 10 days?

Try it first, then show the solutionSolution
  1. Ask: days <= 7? Yes means rate 0.
  2. No: ask days <= 14? Yes means rate 2.
  3. No: rate 5.
  4. For 10 days: not <= 7, is <= 14, so rate 2.

Answer: Two chained decisions give three outcomes; 10 days falls in the 2 rupee rate.

Memory hook: N outcomes need N - 1 decisions.

Tricks to remember Decision Making in Algorithms and Flowcharts

Short memory aids. Say each one aloud once, then use it on a question the same day.

  • First Yes wins

    In a chain, test from the top and stop at the first Yes.

    Use it when: Grade and sign problems.

  • 400, 100, 4

    Leap year: 400 yes, 100 no, 4 yes.

    Use it when: Leap year algorithm.

Decision Making in Algorithms and Flowcharts: solved examples

Ordered from board level to HOTS. Try each one before you open the solution.

Example 1: Trace greater of two · 1 mark · MCQBoard level

For A = 17 and B = 29, what does the algorithm "If A > B print A, else print B" print?
(a) 17 (b) 29 (c) 46 (d) Nothing

Try it first, then show the solutionSolution
  1. 17 > 29 is No.
  2. So the else part prints B.

Answer: (b) 29.

Example 2: Odd or even for 27 · 2 marks · Short answerBoard level

Write the condition used to test odd or even and state the output for N = 27. (2 marks)

Try it first, then show the solutionSolution
  1. Condition: N % 2 = 0 (1).
  2. 27 % 2 = 1, so Odd (1).

Answer: Test N % 2 = 0. For 27 the remainder is 1, so the output is Odd.

Example 3: Grade chain trace · 4 marks · Long answerHarder board level

A result rule is: Excellent for 80 and above, Good for 60 to 79, Pass for 40 to 59, Fail below 40. Give the result for the marks 80, 79, 40 and 39. (4 marks)

Try it first, then show the solutionSolution
  1. 80 meets the first test: Excellent (1).
  2. 79 fails 80, meets 60: Good (1).
  3. 40 fails 60, meets 40: Pass (1).
  4. 39 fails all: Fail (1).

Answer: 80 gives Excellent, 79 gives Good, 40 gives Pass and 39 gives Fail.

Example 4: Largest of three · 4 marks · Long answerHarder board level

Write the nested algorithm for the largest of A, B, C and trace it for A = 15, B = 25, C = 20. (4 marks)

Try it first, then show the solutionSolution
  1. Input A, B, C (1).
  2. If A > B then compare A with C, else compare B with C (1).
  3. Trace: 15 > 25 is No (1).
  4. Then 25 > 20 is Yes, so print 25 (1).

Answer: 1. Start. 2. Input A, B, C. 3. If A > B then (if A > C print A else print C) else (if B > C print B else print C). 4. Stop. For 15, 25, 20 the output is 25.

Example 5: Leap year with a century trap · 4 marks · Long answerHOTS / competency

A student says "every year divisible by 100 is a leap year because it is divisible by 4". Use the algorithm to test 1900, 2000 and 2023 and show the flaw. (4 marks)

Try it first, then show the solutionSolution
  1. 1900 is not divisible by 400, is divisible by 100, so not leap (1).
  2. 2000 is divisible by 400, so leap (1).
  3. 2023 is not divisible by 400, 100 or 4, so not leap (1).
  4. The student is wrong because 1900 is divisible by 100 but is not a leap year (1).

Answer: 1900 is not a leap year, 2000 is, 2023 is not. A century year must also be divisible by 400, so the student is wrong.

Where students lose marks in Decision Making in Algorithms and Flowcharts

The slips examiners see most often, and what to write instead.

  • Mistake: Using > instead of >= at the boundary

    The boundary value is lost.

    Wrong working

    If marks > 40 print Pass.

    Right working

    If marks >= 40 print Pass.

    Do this: Read the words "or more" and "at least" as >=.

    Usually costs: 1 mark

  • Mistake: A decision with only one exit

    A diamond needs both a Yes and a No path.

    Wrong working

    Only the Yes arrow drawn.

    Right working

    Yes and No arrows both drawn and both reach Stop.

    Do this: Label both exits.

    Usually costs: 1 to 2 marks

  • Mistake: Treating every century as a leap year

    Century years need divisibility by 400.

    Wrong working

    1900 is leap because 1900 / 4 is exact.

    Right working

    1900 is not leap; 2000 is.

    Do this: Test 400, then 100, then 4.

    Usually costs: 1 mark

Exam tips

  • Label Yes and No on every diamond exit.
  • Trace with a boundary value; it shows the examiner you tested.
  • Write conditions with the exact symbol: >, <, >=, <= or = (for example N % 2 = 0), as the algorithm needs.
  • End every path at Stop.

Practice questions on Decision Making in Algorithms and Flowcharts

Write each answer on paper first. Open the hint only if you are stuck, and the answer only when you have finished.

  1. Q1 · 1 mark · MCQBoard level

    In a flowchart, how many exits does a decision diamond have, and how are they labelled?
    (a) One, Start (b) Two, Yes and No (c) Three, A, B, C (d) None

    Hint

    Rules for the diamond.

    Answer

    (b) Two, Yes and No.

  2. Q2 · 3 marks · Short answerBoard level

    Write an algorithm to input two numbers P and Q and print whether P is greater than, smaller than or equal to Q. Trace it for 14 and 14. (3 marks)

    Hint

    Two decisions in a chain.

    Answer

    1. Start. 2. Input P, Q. 3. If P > Q print Greater. 4. Else if P < Q print Smaller. 5. Else print Equal. 6. Stop. For 14 and 14 neither test is true, so the output is Equal.

  3. Q3 · 4 marks · Long answerHarder board level

    Write an algorithm for the smallest of three numbers P, Q, R and trace it for 9, 4, 6. (4 marks)

    Hint

    Nested like the largest of three but with <.

    Answer

    1. Start. 2. Input P, Q, R. 3. If P < Q then (if P < R print P else print R) else (if Q < R print Q else print R). 4. Stop. For 9, 4, 6: 9 < 4 is No; 4 < 6 is Yes; the output is 4.

  4. Q4 · 4 marks · Long answerHarder board level

    A shop gives 10 percent discount if the bill is 1000 rupees or more, otherwise none. Write the algorithm and trace it for bills of 1000 and 999. (4 marks)

    Hint

    Test the boundary value.

    Answer

    1. Start. 2. Input Bill. 3. If Bill >= 1000 then Pay = Bill - Bill x 10 / 100 else Pay = Bill. 4. Print Pay. 5. Stop. For 1000: discount 100, Pay = 900. For 999: no discount, Pay = 999.

  5. Q5 · 4 marks · Long answerHOTS / competency

    An algorithm checks "If marks > 40 print Pass else print Fail" for a pass mark of 40. Find the error with a test value and correct it. (4 marks)

    Hint

    Which value sits exactly on the boundary?

    Answer

    With marks = 40, 40 > 40 is No, so the algorithm prints Fail although 40 is the pass mark. The condition must be marks >= 40. Then 40 gives Pass and 39 gives Fail.

Test your recall

Answer in your head or on paper first, then open the card. Pulling an answer out of memory makes it stick far better than re-reading.

  1. 1.What does N % 2 give?Show answer

    The remainder when N is divided by 2.

  2. 2.What is the grade for 82 in the A/B/C/D chain?Show answer

    B.

  3. 3.Which year is a leap year: 1900 or 2000?Show answer

    2000.

  4. 4.What is a nested decision?Show answer

    A decision placed inside another decision.

  5. 5.Which values should you test?Show answer

    One for each path and the boundary values.

  6. 6.Are loops used at Class VIII?Show answer

    No.

Decision Making in Algorithms and Flowcharts: frequently asked questions

How many decisions are needed for three outcomes?

Two, chained one after another.

Can the No path of a diamond lead to another diamond?

Yes, that is how chains and nested decisions are drawn.

Do I have to write both algorithm and flowchart?

Only if the question asks; a flowchart must match its algorithm step by step.