New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

OMG-OCUP2-FOUND100 Exam - 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:

0/2000 characters
Tasia
2 months ago
Wait, are we sure about this age rule? Seems odd!
upvoted 0 times
...
Antonio
2 months ago
D is definitely wrong, no exceptions for age 18.
upvoted 0 times
...
Lura
2 months ago
I think B is more accurate, only 18+ can open accounts.
upvoted 0 times
...
In
3 months ago
A seems correct, age 18 is standard.
upvoted 0 times
...
Geoffrey
3 months ago
C is misleading, age should be validated at setAge.
upvoted 0 times
...
Daryl
3 months ago
D seems really off to me. I can't imagine an age of 18 raising an exception; that would be too strict for a bank account policy.
upvoted 0 times
...
Maryann
3 months ago
I feel like option C could be misleading. The age condition might be checked elsewhere, not just when setAge is called.
upvoted 0 times
...
Matthew
4 months ago
I'm not so sure about that. I remember a practice question where the age was more of a guideline, not a strict rule. Maybe A is the better choice?
upvoted 0 times
...
Twana
4 months ago
I think option B sounds right because it specifically states that only customers 18 or older can open an account, which seems clear.
upvoted 0 times
...
Arlen
4 months ago
This seems like a good opportunity to apply my knowledge of object-oriented design principles. I'll think through the design intent and select the most appropriate answer.
upvoted 0 times
...
Cherry
4 months ago
I'm a bit confused by the wording of the options. I'll need to re-read the question and diagram a few times to make sure I understand the nuances.
upvoted 0 times
...
Tyra
4 months ago
Okay, the key here is understanding the relationship between the Customer class and the age attribute. I'll focus on that to determine the correct statement.
upvoted 0 times
...
Xuan
5 months ago
Hmm, the age condition seems a bit tricky. I'll need to analyze the diagram closely and consider the implications of each answer choice.
upvoted 0 times
...
Nilsa
5 months ago
This looks like a straightforward UML class diagram question. I'll carefully read through the options and think about the age-related constraints.
upvoted 0 times
...
Chau
6 months ago
Haha, I wonder if the bank has a special 'senior customer' discount for those 18 and up. Maybe they throw a birthday party when you open your first account?
upvoted 0 times
...
Dalene
6 months ago
D can't be right, because an object with age 18 or greater wouldn't raise an exception - that would go against the requirement. B makes the most sense to me.
upvoted 0 times
...
Kaitlyn
7 months ago
Because the age condition should only hold when the setAge(Integer) function is called.
upvoted 0 times
...
Shelton
7 months ago
Why do you think it's C?
upvoted 0 times
...
Kaitlyn
8 months ago
I disagree, I believe it's C.
upvoted 0 times
...
Chandra
8 months 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
8 months 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
Lisha
7 months ago
I think option B is the correct choice as well. It's a strict rule based on the diagram.
upvoted 0 times
...
Eun
8 months ago
Yes, the class diagram clearly indicates that age is a requirement for opening a bank account.
upvoted 0 times
...
Roosevelt
8 months ago
I agree, option B seems to be the most accurate.
upvoted 0 times
...
...
Shelton
8 months ago
I think the answer is B.
upvoted 0 times
...

Save Cancel