ITPEC IP April 2024 Question 7
There exist four (4) states numbered 1 through 4. The four (4) states are connected as shown in the figure below, and the state transition occurs in a clockwise or counter-clockwise direction.
If the current state is 1, which of the following is the state that is reached after the procedure below is performed twice?
[Procedure]
The number of the current state is multiplied by 11, and the result is divided by 3. The process below is performed based on the remainder of the division.
- •When the remainder is 0, a transition to the next state occurs in the clockwise direction.
- •When the remainder is 1, a transition to the next state occurs in the counter-clockwise direction.
- •When the remainder is 2, a transition to the second state occurs in the clockwise direction.
Explanation
4 — the first procedure moves 1 → 3 and the second 3 → 4, with the remainder recomputed from the new state each time.
Clockwise, the states run 1 → 2 → 3 → 4 → 1.
- •First run, state 1: 1 × 11 = 11, and 11 ÷ 3 = 3 remainder 2, so move to the second state clockwise: 1 → 2 → 3
- •Second run, state 3: 3 × 11 = 33, and 33 ÷ 3 = 11 remainder 0, so move to the next state clockwise: 3 → 4
Answer (d)
Why not others:
- •(a) 1 — reuses the first remainder, 2, in the second run: two more states clockwise from 3 lands back on 1
- •(b) 2 — takes remainder 0 as counter-clockwise, moving 3 → 2
- •(c) 3 — the state after the first run only; the procedure is performed twice
Key rule: When a rule depends on the current state, recompute it after every transition instead of carrying the first result forward.
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.