Choose the correct answer :
What is a reason to have all the UML diagrams of a model have the same amount of detail?
D
Explanation:
Having all the UML diagrams of a model maintain the same level of detail is typically required by
tools that automatically transform the model into other forms, such as code or other types of
models. Consistency in the level of detail across different diagrams ensures that automated tools can
reliably interpret and convert the UML diagrams without encountering discrepancies that could lead
to errors or misrepresentations in the generated outputs. This consistency is crucial for maintaining
the integrity of the transformations and for ensuring that the resultant products accurately reflect
the intended design and specifications.
Choose the correct answer :
Which statement characterizes a valuable model?
A
Explanation:
A valuable model in UML and systems design is characterized by its usefulness rather than its
complexity or how "correct" it is in an engineering sense. A model's primary objective is to
effectively communicate the key aspects of a system or process, and simplicity often enhances this
communication by making the model easier to understand and use. The value of a model thus comes
from its ability to facilitate decision-making, problem-solving, and understanding among
stakeholders. This perspective aligns with the principle of Occam's Razor in modeling, which suggests
that simpler solutions are preferable when all other factors are equal. In UML, a model that provides
clear insights with minimal complexity is considered more valuable because it is accessible to a wider
audience and can be more readily applied to solve real-world problems.
Choose the correct answer :
What is an advantage of modeling as a part of the software analysis and design process?
A
Explanation:
Modeling as part of the software analysis and design process offers several advantages, one of the
primary being the reduction in the risk of inconsistent or improper implementations. By using
models, developers can visualize the structure and behavior of the system before actual coding
begins, allowing for the identification and correction of potential issues in the early stages of
development. This practice helps ensure that all components of the software work together as
intended, reducing the likelihood of bugs and inconsistencies that could arise if parts of the system
were developed in isolation. UML, as a standardized modeling language, provides a coherent and
universally understood set of diagrams and symbols, which facilitates clear communication among
team members and stakeholders, further mitigating the risk of misunderstandings that could lead to
improper implementations.
Choose the correct answer :
Consider the following class diagram:
Which statement is true about the class diagram?
B
Explanation:
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).
Choose the correct answer :
Consider the following diagram:
Which statement is correct according to the diagram?
D
Explanation:
In UML class diagrams, relationships between classes are represented in a number of different ways,
including generalization, association, and composition.
Looking at the provided options, let's analyze each one:
A . responsiblePerson inherits from Person – This is incorrect because the responsiblePerson is an
attribute of the Task class, not a class itself, so it cannot inherit from Person.
B . Client and Manager have nothing in common – This is incorrect because both Client and Manager
are specialized types of Person as indicated by the generalization arrows pointing to Person.
C . responsiblePerson can not refer to an object of class Client – This is incorrect. responsiblePerson is
typed by Person, which means that it can refer to an instance of any subclass of Person, including
Client.
D . The object referred to as responsiblePerson can be a Manager – This is correct. Since
responsiblePerson is an attribute of the Task class with the type Person, and Manager is a subclass of
Person, responsiblePerson can indeed refer to an instance of Manager.
The correct answer is based on the UML 2 Foundation specification that describes how attributes are
typed by classes and can refer to instances of these classes or their subclasses (UML 2.5 specification,
sections 9.3.3 and 9.5.3). The generalization relationship (represented by a triangle followed by a
line) establishes a hierarchy between a more general element and a more specific element, which in
this case means that Client and Manager are both specific types of Person and can be used wherever
Person is expected (UML 2.5 specification, section 9.4.5).
Choose the correct answer :
In the context of a UML model designed to capture the elements of a real-world business enterprise,
the class Employee appears in the fragment of a class diagram as shown below:
Which actual entity does this element represent?
B
Explanation:
In the context of a UML (Unified Modeling Language) model, the class named 'Employee' represents
a template for all entities that are classified as employees within the business enterprise model.
Therefore, the correct answer is:
B . The set of all employees of the company
The term 'Employee' in the class diagram is a UML Class, which is defined as a description of a set of
objects that share the same attributes, operations, relationships, and semantics (UML 2.5
specification, section 9.2). A class in UML is a blueprint from which individual objects (instances of
the class) are created. It is not a representation of any single employee, an anonymous employee, or
a diagram of an employee, but rather the conceptual model that defines the properties and
behaviors of all employee instances in the domain being modeled.
Choose the correct answer :
In UML modeling, what is a Constraint?
A
Explanation:
In UML modeling, a constraint is defined as:
A . a condition that must be satisfied when it is evaluated
A constraint is a semantic condition or restriction expressed in natural language text or a machine-
readable language for expressing constraints, such as OCL (Object Constraint Language). Constraints
specify invariants that must hold for the system being modeled at all times. This means that
whenever the constraint is evaluated, the condition it expresses must be satisfied (UML 2.5
specification, section 7.9).
The other options do not accurately define what a constraint is in the context of UML:
B . A condition that should be met depending on system operation – This is not precise as constraints
are not optional and do not depend on system operation; they are always applicable.
C . A condition that causes the state of the objects to change over time – This describes a side effect,
which is not the purpose of a constraint. A constraint is a condition that must always be met, not
something that induces change.
D . A condition that constrains what can or cannot be put in a class diagram – This is too broad and
imprecise. Constraints apply to elements within the class diagram and are not about the content of
the diagram itself.
Choose the correct answer :
Suppose you are using a programming language that knows the following basic types: byte, short,
and long.
Which diagram defines them:
A)
B)
C)
D)
A
Explanation:
In UML, basic types like byte, short, and long are represented as DataType elements. These are
typically used to specify the types of attributes, parameters, or return values of operations in a
model. Option A shows three separate classes named Byte, Short, and Long, which would represent
these as distinct data types within the UML model.
Option B incorrectly uses stereotypes on objects, which is not the correct UML representation for
data types. Option C shows a class with attributes of different types, but it does not define these
types as basic types. Option D is incorrect because it uses stereotypes on DataType elements, which
is not the standard way to represent basic types in UML.
According to the UML 2.5 specification, DataTypes are a kind of classifier that specifies a domain of
values without identity (section 10.5.8). DataTypes are not classes; they do not have operations and
cannot have instances that maintain an identity.
Choose the correct answer :
Consider the following model
Where is v visible?
C
Explanation:
In UML, visibility of an attribute is determined by the scope of the classifier it belongs to and its
visibility markers. The attribute 'v' is marked with a '-' sign, indicating it is private. Being private, it
would normally be visible only within the class it is defined in, which is 'S' in this case. However, since
'T' is a subclass of 'S' (as indicated by the generalization relationship, a line with a closed, unfilled
arrowhead), it inherits the attribute 'v'. Therefore, 'v' is visible in both 'S' and 'T'.
Option A is incorrect because it does not consider inheritance. Option B is incorrect for the same
reason. Option D is incorrect because a private attribute in a class is not visible to the entire package,
only to the class itself and its subclasses.
The UML 2.5 specification states that a private member is only accessible within the namespace it is
defined (section 7.5.3). Since 'T' is within the namespace of 'S' due to inheritance, 'v' is visible in
both.
Choose the correct answer :
What is the key difference between DataTypes and Classes?
C
Explanation:
DataTypes in UML are a type of classifier that represents a set of values that do not have identity,
which means that two instances of a DataType are indistinguishable if all their attributes are equal.
This is in contrast to instances of Classes, which are distinguishable by their identity - each instance is
considered unique even if their attributes have the same values.
Option A is incorrect because DataTypes can indeed have operations in UML. Option B is also
incorrect; DataTypes can have attributes of any complexity. Option D is incorrect because DataTypes
can also have features inherited from their super DataTypes; it is not solely about instantiation.
The UML 2.5 specification discusses DataTypes in section 10.5.8, stating that DataTypes do not have
an identity and are often used to type attributes and operation parameters. The equality of DataType
instances is based on the equality of their attribute values. Classes, however, are described in section
9.2 of the UML 2.5 specification as elements that can have identity, and instances of a Class are
distinguished based on that identity.