OMG Certified UML Professional 2 (OCUP 2) - Foundation Level OMG-OCUP2-FOUND100 Exam Practice Test

Page: 1 / 14
Total 90 questions
Question 1

Choose the correct answer:

What is a reason to have all the UML diagrams of a model have the same amount of detail?



Answer : D

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.


Question 2

Choose the correct answer:

Consider the following diagram fragment:

What makes this fragment invalid?



Answer : F

In the given UML package diagram fragment, various elements are listed with stereotypes indicating their nature (class, interface). Stereotypes are used in UML to extend the vocabulary of UML in order to create new kinds of building blocks. They are typically enclosed in guillemets ( ).

The last element, 'six', does not have a stereotype indicating whether it's a class, interface, or some other kind of element. This lack of a stereotype leads to ambiguity about the nature of 'six'. Therefore, the fragment is considered invalid due to this omission.

All the other options do not constitute an error in the UML fragment: A) A list of elements is allowed in a package body. B) Visibility is not required for every element, especially within package diagrams. C) Interfaces are allowed in packages. D) Private elements are allowed in a package. E) Protected elements are also allowed in a package.

Therefore, the correct answer is:

F . Element six is missing its stereotype.


Question 3

Choose the correct answer:

In your model, you need to represent accounts.

Which statement supports using a Class, rather than a DataType. lor this purpose''



Answer : C

In UML, a Class is a template that defines the structure and behavior of objects, whereas a DataType is a type of classifier which specifies a domain of values without identity. Operations (such as money transfers and withdrawals) are behaviors that change the state of an object and, therefore, are defined in Classes rather than DataTypes. This suggests that accounts, which require operations to transfer and withdraw money, should be modeled as Classes.


UML 2.x Superstructure Specification: Provides definitions for Classes and DataTypes, and details the circumstances under which each should be used. It specifically states that Classes can have operations while DataTypes cannot.

UML 2.x Infrastructure Specification: This foundational document provides an in-depth explanation of UML modeling constructs, supporting the use of Classes when operations are needed to manage an object's state.

Question 4

Choose the correct answer:

What is the key difference between DataTypes and Classes?



Answer : C

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.


Question 5

Choose the correct answer:

Given the diagram fragment below:

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



Answer : B

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'.


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.

Question 6

Choose the correct answer: OpaqueExpression can use which languages?



Answer : D

An OpaqueExpression in UML 2 is used to specify behavior in a textual form when it is not necessary to specify which language is used, or when it is not possible to use graphical notation. According to the UML 2 specification, an OpaqueExpression is not limited to any particular language; it can represent expressions written in any language.

The key characteristics of an OpaqueExpression are as follows:

The 'body' of an OpaqueExpression is a sequence of strings, where each string could be written in a different language. This means it has the capacity to include multiple languages simultaneously.

The 'language' attribute is optional and is used to indicate the languages of the respective 'body' parts.

The allowance for any language is clearly stated in the UML 2 Infrastructure Specification. OpaqueExpression is designed to be a flexible way to capture expressions that are not readily expressible in UML or when using a language outside the scope of UML (e.g., mathematical expressions, programming languages, or other domain-specific languages).


Question 7

Choose the correct answer:

Which statement is correct regarding Enumeration Literals?



Answer : A

Enumeration literals in UML are used within an enumeration to define a set of named constants. According to the UML specification:

A . This statement is correct. Enumeration literals are indeed immutable, which means once they are defined within an enumeration, their values cannot be changed.

B . Enumeration literals cannot be anonymous; they must be named so that they can be referenced unambiguously within the model.

C . Enumeration literals can be compared for equality. In fact, this is one of their primary uses, to allow for comparison between different values of an enumerated type to determine if they are the same.

D . Enumeration literal names must be unique within their enumeration. They cannot appear more than once as this would cause ambiguity in references to the literals.

The most accurate statement according to the UML 2 Foundation specification is A: EnumerationLiterals are immutable.


Page:    1 / 14   
Total 90 questions