ITPEC IP April 2025 Question 9

As shown in Figure 1, there is a box that generates two (2) numerical values B1 and B2 when two (2) positive integers A1 and A2 are entered. B1 has the same value as A2, and B2 is the remainder of A1 divided by A2. In Figure 2, when two (2) boxes are connected, and 49 is entered as A1 and 11 is entered as A2 in the left box, what is the value of B2 generated from the right box?

A1A2B1B2

Figure 1

4911B1B2

Figure 2

Explanation

1 — the left box's outputs become the right box's inputs, so take the remainder twice.

  • •Left box: A1 = 49, A2 = 11, so B1 = 11 and B2 = remainder of 49 ÷ 11 = 5, since 49 = 4 × 11 + 5
  • •Right box: A1 = 11, A2 = 5, so B1 = 5 and B2 = remainder of 11 ÷ 5 = 1, since 11 = 2 × 5 + 1

Answer (a)

Why not others:

  • •(b) 2 — is the quotient of 11 ÷ 5 in the right box, not its remainder
  • •(c) 4 — is the quotient of 49 ÷ 11 in the left box
  • •(d) 5 — is the left box's B2, which the right box receives as A2 and passes on as its B1, not the right box's B2

Key rule: Each box is one step of the Euclidean algorithm, (a, b) → (b, a mod b); chaining boxes until the remainder is 0 leaves the greatest common divisor, here 1.

Algorithm and Programming · AI-written, may contain errors

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 IP past-paper collection or Report an issue.