UML Exercises

1.  Consider the following UML diagram.

(a) If there are 6 authors, what’s the minimum and maximum number of books? What’s the minimum and maximum number of readers?
(b) If there are 6 readers, what’s the minimum and maxiumum number of books? What’s the minumum and maximum number of authors?

2.  Consider a tiny social network containing high school students and their “crushes” (desired romantic relationships). Each student may have a crush on at most one other student, and associated with each crush is the length of time the crush has been going on. Students have a name and a grade, and names are unique. Draw a UML diagram that models this information. Make sure to capture the asymmetry and multiplicity of the crush relationship.

3.  Consider a class Book with four subclasses: Anthology, Fiction, Children, and Nonfiction. Is the subclassing relationship overlapping or disjoint (exclusive)? Is it complete or incomplete (partial)?

4.   Consider the following UML diagram.

Separate the following statements into those that are true and those that are false.

(a) No two companies can have the same name
(b) No two employees can have the same name
(c) No two companies can be at the same address
(d) No two employees can work at the same address
(e) Each employee works for at least one company
(f) No employees work for more than one company
(g) Each company has at least one employee
(h) Two employees with the same name cannot work for the same company
(h) Two employees with the same name cannot work for different companies

5.  Consider the following UML diagram.

(a) According to the diagram, what are the minimum and maximum total number of instructors for a given course?

(b) According to the diagram, what is the minimum and maximum teaching load (number of courses) for professors? For assistants?

(c) Translate the UML diagram to a relational schema. There are several possible automatic translations; use the translation for subclassing most appropriate for the specified properties as described in the video, and if it makes sense to eliminate any association-class relations as described in the video, do so.

(d) Specify a minimal key for each relation in your solution to part (c).

(e) Suppose by default attribute values cannot contain null. Does your solution to part (c) require any attributes to permit null values?

Sol

Scroll to Top