10
10
10
Paolo Ciancarini
Summary
• This is a set of exercises on writing and
understanding the UML notations
• Some exercises have more than one
correct answer
Diagrams covered
• Use case
• Class diagrams
• Object diagrams
• State diagrams
• Activity diagrams
• Sequence diagrams
• Communication diagrams
• Component diagrams
• Package diagrams
• Deployment diagrams
Think about it!
On requirements
Which of these are functional requirements?
a) Users of the library are either normal or staff
b) A user can borrow a book
c) A staff person can borrow a book
d) The library contains one million books
e) If a user asks a book that has been borrowed, her
request is inserted in a waiting list
f) Staff has no priority in borrowing books
On requirements
Which of these are non-functional requirements?
a) Pressing the switch the room gets lightened
b) Pressing the switch the room gets lightened in less than
one second
c) If the room is dark, pressing the switch it gets lightened
d) The light in the room must be sufficient to read
e) If someone is reading then the light must stay on
f) After two minutes that the room is empty the light must
switch off
On requirements
• Based on the following statements from a domain expert on a project, which of the
following are requirements that must be extracted?
"We get incomplete mortgage applications all the time. In those cases, we just hand
them back to the customer with a handwritten note telling them what's missing. We
have to log the application anyway, so we use the new mortgage screen to enter the
customer information and assign a unique identifier to the file. In the past, we have
entered the address in upper case. The identifier follows an industry standard format
of bank number, customer account number, and the next available number for that
customer all as one long number."
a) A note must be sent to the customer for incomplete
mortgage applications, listing the missing items
b) A file must be established for every mortgage
application at the time it is submitted, whether the
application is complete or not
c) Addresses on mortgage applications must be
entered as all capital letters
d) A unique mortgage number must be assigned to
each mortgage file. This identifier must follow
financial industry standard format
On diagrams
Which are behavior diagrams?
a) Use case diagrams
b) Class diagrams
c) State diagrams
d) Sequence diagrams
e) Communication diagrams
f) Package diagrams
g) Deployment diagrams
On diagrams
For understanding control mechanisms, such as user
interfaces and device controllers, which one of the
following artifacts is the most useful?
a) Interaction Diagrams
b) Activity Diagrams
c) Package Diagrams
d) State Diagrams
e) Class Diagrams
f) Communication diagrams
g) Deployment diagrams
On diagrams
What is the best diagram type to represent
the sentence “all men are mortal”?
a) Use case diagram Mortal
Given that having multiple spouses at the same time is prohibited, but
it is allowed to have many spouses over time, which of the following
are valid models?
a) The diagram shown represents the concepts to be modeled in the domain
and no changes are required.
b) Use the <<history>> stereotype to show the history over time and snapshot
in time constraint in the model.
c) Promote the “is married to” association to an association class called
Marriage and break up the Many to Many association between Husband
and Wife
d) Create a link attribute called “wedding date” and attach it to the association,
rather than to either Class in the Association.
e) Create a link attribute called “wedding date” and attach it to either husband
or wife class.
On class diagrams
Which sentences are coherent with this model?
a) A company may employ 0 or 1 person
b) A person may work for a single company
c) A person has one employment
d) A company has one employer that is a person
e) A company may have zero employers
On objects diagrams
Which one is a non valid instance of this model?
a) b)
c)
d)
On class diagrams
1
2
3
On sequence diagrams
What is this in the red oval?
a) A message
b) A guard
c) An event
d) An association
On sequence diagrams
• What can you say about the control flow of each
of the following systems?
– Which is more centralized?
– Which is more distributed?
39
On sequence diagrams
What is wrong with this sequence diagram?
40
On sequence diagrams
What is wrong with this sequence diagram?
41
On sequence diagrams
What are the names of missing
classes XXX and YYY in
the sequence diagram?