Chapter 18 — Quiz
12 questions. Answers at the bottom.
Multiple choice
Q1. A strong entity maps to: - A) A column - B) A table (its key → primary key) - C) A foreign key - D) A view
Q2. A composite attribute (e.g., address) maps to: - A) One text column - B) Several component columns - C) A separate table always - D) A JSON blob always
Q3. A multi-valued attribute (e.g., several phone numbers) maps to: - A) Columns phone1, phone2, phone3 - B) A separate child table with a FK to the owner - C) A comma-separated column - D) The primary key
Q4. A one-to-many relationship is implemented by: - A) A junction table - B) A foreign key on the "many" side - C) A foreign key on the "one" side - D) An array
Q5. A many-to-many relationship is implemented by: - A) A foreign key on either side - B) A junction table with a composite key of the two FKs - C) An array column - D) Merging the tables
Q6. Attributes of an M:N relationship (e.g., quantity, grade) belong: - A) On the first entity's table - B) On the second entity's table - C) On the junction table - D) In a view
Q7. A one-to-one relationship is typically implemented with:
- A) A junction table
- B) A UNIQUE foreign key on one side (or merging the tables)
- C) An array
- D) Two primary keys
Q8. A weak entity's primary key: - A) Is auto-generated only - B) Includes the owner entity's key (often composite) - C) Doesn't exist - D) Is the same as the owner's
Q9. Single-table inheritance is characterized by:
- A) One table per subtype, no base
- B) One table with a type column and (often nullable) subtype columns
- C) A base table plus subtype tables
- D) No table at all
Q10. Table-per-subclass inheritance requires ____ to query a full object: - A) Nothing extra - B) A join between the base and subtype tables - C) A UNION - D) A trigger
True/False
Q11. In a 1:N relationship, the foreign key can go on either side without consequence. (True / False)
Q12. A self-referencing relationship is implemented with a foreign key to the same table. (True / False)
Short answer
Q13. Explain why "students take courses" cannot be modeled with a single foreign key, and give the correct mapping.
---
Answer key
Q1 — B. Entity → table; its key → primary key.
Q2 — B. Composite → component columns (queryable, constrainable individually).
Q3 — B. Multi-valued → a separate child table (never repeated columns or CSV).
Q4 — B. FK on the many side pointing to the one side.
Q5 — B. Junction table with composite PK of the two foreign keys.
Q6 — C. Relationship attributes describe the pairing → junction table.
Q7 — B. A UNIQUE FK on one side, or merge the entities into one table.
Q8 — B. Weak entity's PK includes the owner's key (e.g., order_items(order_id, product_id)).
Q9 — B. One table, type discriminator, nullable subtype columns.
Q10 — B. A join between base and subtype tables.
Q11 — False. The FK belongs on the many side; the other placement is wrong (a "one" can't hold many FK values).
Q12 — True. E.g., manager_id REFERENCES employees(employee_id).
Q13. Students↔courses is many-to-many (a student takes many courses; a course has many students), and a single foreign key can only represent "one." It requires a junction table — enrollments(student_id, course_id, ...) with composite PK (student_id, course_id) — which also gives relationship attributes like grade a home.
Scoring: 10–12 the mapping is mechanical for you; 7–9 review 1:N FK placement and M:N junctions; below 7, redo Exercises B–C.