ITPEC FE Morning April 2022 Question 8
ITPEC FE Morning April 2022 — Question 8 of 80
Integer Division via Subtraction — flowchart computes quotient and remainder of x ÷ y.
The algorithm initializes q ← 0, r ← x, then repeatedly subtracts y from r while r ≥ y, incrementing q each time.
- •q counts how many times
yfits intox→ quotient - •r holds whatever is left over → remainder
Example: x = 13, y = 4
- r = 13 - 4 = 9, q = 1
- r = 9 - 4 = 5, q = 2
- r = 5 - 4 = 1, q = 3
- r < y → stop → q = 3, r = 1
Why not others:
- (b) Quotient/remainder of y ÷ x — division is x by y, not reversed
- (c) Swaps quotient and remainder — q counts subtractions (quotient), r holds leftover (remainder)
- (d) Both reversed and swapped
Key rule: Repeated subtraction is the most basic division algorithm: subtract divisor from dividend, count iterations (quotient), stop when remainder < divisor.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.