AC9M7SP04 • Homework
Algorithms for Sorting & Classifying Shapes
Design clear decision processes that classify shapes from geometric properties. Use complete branches, precise conditions and the most specific valid output.
Part A — Short response
- What decision identifies an equilateral triangle in a triangle-classification algorithm? (2)
- What should a quadrilateral algorithm check to distinguish a trapezium from a parallelogram? (2)
- State the condition for a polygon to be regular. (2)
- What condition identifies a concave polygon? (2)
- A triangle algorithm asks “Are all sides equal?” and the answer is NO. What side-based decision should usually come next? (2)
Part B — Extended response
- Design an algorithm that classifies a triangle by both sides and angles. Include all necessary branches for equilateral/isosceles/scalene and acute/right/obtuse. (5)
- A quadrilateral has two pairs of parallel sides. Write the next decisions needed to classify it as rectangle, rhombus or square, and explain why a square belongs to more than one class. (5)
- Create a flow chart that classifies a polygon by number of sides, then regular/irregular, then concave/convex. Explain why each decision narrows the possibilities. (5)
- A student’s rule says: “If a quadrilateral has four equal sides, output square.” Identify the bug, give a counterexample, and write a corrected rule. (5)
- Explain how you would test a shape-classification algorithm for reliability. Include at least four test cases that target different branches or boundary cases. (5)
Part C — Enrichment
11. Complete classification algorithm. Design a flow chart or decision tree for any simple polygon that records: number of sides, regular/irregular, concave/convex, and — when the shape is a quadrilateral — the most specific class among trapezium, parallelogram, rectangle, rhombus, square and kite. Explain the order you chose, show how your algorithm handles a square and a concave pentagon, and identify one possible bug if a branch stops too early.
Answers / checking guide
1
Check whether all three sides are equal.
2
Check the number of pairs of parallel sides: exactly one pair → trapezium in this unit; two pairs → parallelogram.
3
All sides equal and all interior angles equal.
4
At least one interior angle is greater than 180°.
5
Ask whether exactly two sides are equal; YES → isosceles, NO → scalene.
6
Example: all sides equal? yes→equilateral; otherwise two equal? yes→isosceles, no→scalene. Then one angle 90°? yes→right; otherwise one angle >90°? yes→obtuse, no→acute.
7
From parallelogram: test four right angles → rectangle; four equal sides → rhombus; both → square. A square satisfies all rectangle and rhombus conditions.
8
Count sides for polygon family; test equal sides + equal angles for regularity; test for any reflex interior angle for concavity. Combine the outputs.
9
Bug: four equal sides prove rhombus, not necessarily square. Counterexample: a non-square rhombus. Correction: if four equal sides AND four right angles, output square.
10
Use contrasting and boundary cases such as equilateral triangle, isosceles triangle, square, non-square rhombus, trapezium, convex pentagon and concave pentagon. Trace each branch and compare output with definitions.
11
Full-credit responses use precise decisions, complete YES/NO branches, hierarchical refinement for quadrilaterals, and do not stop at rectangle or rhombus before checking square. A concave pentagon must reach 5 sides + concave, with regularity handled consistently.