ITPEC FE Morning October 2021 Question 25
When the relationships between continent and country, and between country and city are shown in the class diagram below, which of the following is an appropriate combination of multiplicities that are to be inserted into blank A through blank D? Here, there are no cross continental countries. Each continent has at least one country, and each country has at least one city.
Explanation
A and C exactly one, B and D at least one — 1., 1., 1., 1., each written beside the class it counts.
- •A, beside Continent: one country lies in exactly one continent (no cross-continental countries), so
1..1 - •B, beside Country: one continent has at least one country, so
1..* - •C, beside Country: one city belongs to exactly one country, so
1..1 - •D, beside City: one country has at least one city, so
1..*
Answer (b)
Why not others:
- •(a) — swaps C and D, so each country would have exactly one city and a city could belong to several countries
- •(c) — B =
0.allows a continent with no countries, and C and D are swapped as in (a).* - •(d) — B =
0.and D =.* 0.allow a continent with no country and a country with no city, against "at least one".*
Key rule: Read a multiplicity as "one object on the far side is linked to this many objects of the class next to the number"; "at least one" gives a lower bound of 1, never 0.
Databases · 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 FE past-paper collection or Report an issue.