ITPEC FE Subject B April 2026 Question 12
ITPEC FE Subject B April 2026 — Question 12 of 20
A is s2[i] ≠ s2[j] and B is s2[i] = s2[j].
The double loop compares every pair of positions and looks for the two ways a mapping can break:
- •Blank A — the same character in
s1at both positions must produce the same character ins2. Ifs1[i] = s1[j]buts2[i] ≠ s2[j], one source character maps to two different targets - •Blank B — different characters in
s1must map to different characters ins2. Ifs1[i] ≠ s1[j]buts2[i] = s2[j], two source characters collapse onto one target
The table shows both failures: {"f", "o", "o"} against {"b", "a", "r"} breaks the first rule, and {"a", "b"} against {"c", "c"} breaks the second.
Answer (d)
Why not others:
- (a) and (b) — compare s1[i] with s2[j], matching a character in one array against a character in the other; isomorphism says nothing about whether the two alphabets overlap
- (c) — inverts both tests, rejecting exactly the pairs that are consistent and accepting the ones that are not
Key rule: A one-to-one mapping needs both directions checked: equal sources must give equal targets, and different sources must give different targets. Testing only one direction accepts {"a", "b"} → {"c", "c"}.
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.