Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

OMG Exam OMG-OCUP2-FOUND100 Topic 4 Question 34 Discussion

Actual exam question for OMG's OMG-OCUP2-FOUND100 exam
Question #: 34
Topic #: 4
[All OMG-OCUP2-FOUND100 Questions]

Choose the correct answer:

Consider the following class diagram:

Which statement is true about the class diagram?

Show Suggested Answer Hide Answer
Suggested Answer: B

In UML 2, a class diagram is used to depict the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among the classes. The constraint {age >= 18} in the Person class diagram indicates a condition that must hold true for the instances of the Person class whenever they are used in the context of a BankAccount. This constraint is an invariant of the Person class that specifies the rule for the attribute age.

Now, let's consider the provided options and explain why option B is correct:

A . The preferred age to open a bank account is 18 years old or older -- This statement is incorrect because the diagram does not indicate a preference; it indicates a constraint or a rule.

B . Only customers who are 18 years old or older can open a bank account -- This is the correct statement. The {age >= 18} constraint next to the age attribute of the Person class signifies that any instance of Person associated with a BankAccount must be at least 18 years old. Since Person is connected to BankAccount with the role name customer, this implies that only persons who are at least 18 can be customers of a bank account.

C . The age condition should only hold when the setAge(Integer) function is called -- This statement is incorrect because the constraint {age >= 18} is not a condition that applies only when the setAge operation is invoked. Instead, it is a class invariant that must always hold true for any instance of Person.

D . An object of Customer with age set to 18 or greater will raise an exception -- This is incorrect because the UML diagram specifies a constraint, not an exception condition. The constraint ensures validity, not the raising of an exception.

The answer is verified according to the UML 2 Foundation documents, such as the UML 2.5 specification, where class diagrams and constraints are defined. The specification states that constraints are semantic conditions or restrictions expressed in natural language text or in a machine-readable language that must hold true for the system being modeled (UML 2.5 specification, section 7.9).


Contribute your Thoughts:

Kaitlyn
2 days ago
Because the age condition should only hold when the setAge(Integer) function is called.
upvoted 0 times
...
Shelton
6 days ago
Why do you think it's C?
upvoted 0 times
...
Kaitlyn
11 days ago
I disagree, I believe it's C.
upvoted 0 times
...
Chandra
15 days ago
Option C is interesting, but I don't think it's correct. The age condition seems to be a general requirement, not just when the setAge() function is called.
upvoted 0 times
...
Melissa
16 days ago
I think the correct answer is B. Only customers who are 18 years old or older can open a bank account. The class diagram clearly shows that the age condition is a constraint on the Customer class, not just a preference.
upvoted 0 times
Eun
9 days ago
Yes, the class diagram clearly indicates that age is a requirement for opening a bank account.
upvoted 0 times
...
Roosevelt
10 days ago
I agree, option B seems to be the most accurate.
upvoted 0 times
...
...
Shelton
19 days ago
I think the answer is B.
upvoted 0 times
...

Save Cancel