What are the possible values for the attribute response in the class Query?

Given the diagram fragment below:

What are the possible values for the attribute response in the class Query?
A . Maybe
B . Yes. No, Maybe
C . There is insufficient information to determine the answer.
D . The diagram is not legal UML

Answer: B

Explanation:

The second diagram fragment you provided includes two enumeration types, YesNo and Answer, where YesNo is a generalization of Answer. The class Query has an attribute ‘response’ of type Answer. Given that YesNo is a generalization of Answer, the possible values for ‘response’ include the literals of Answer plus those inherited from YesNo. Since Answer includes ‘Maybe’, and YesNo includes ‘Yes’ and ‘No’, all three are valid values for ‘response’.

Reference: UML 2.x Superstructure Specification: Discusses attributes and their types, the concept of generalization, and how attributes of a generalized type can take on values from their own literals as well as those from their parent in the hierarchy.

UML 2.x Infrastructure Specification: Explains the foundational modeling constructs related to enumeration, classes, and attributes, which provides the basis for determining the legal values of an attribute based on its type’s enumeration literals.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments