Practice Free OMG-OCUP2-ADV300 Exam Online Questions
Question #21
Consider the following diagram:
What could be substituted for myTypel?
- A . Number
- B . Short or Long
- C . any subtype of Number
- D . any Type, there is no restriction
Correct Answer: C
C
Explanation:
In the given diagram, myType1 is shown redefining prop1, which was originally of type Integer. Given that Integer is a subtype of Number, and myType1 is used in a redefinition context, it implies that myType1 must also be a subtype of Number. In UML, when a property is redefined, the redefining property must be type compatible with the property it redefines. Therefore, myType1 could be substituted by any subtype of Number, which includes Integer, Real, and all their subtypes (Short, Long, Float, Double, etc.). This is based on the UML principle of type conformance in property redefinition, as specified in the UML 2.x Superstructure Specification.
C
Explanation:
In the given diagram, myType1 is shown redefining prop1, which was originally of type Integer. Given that Integer is a subtype of Number, and myType1 is used in a redefinition context, it implies that myType1 must also be a subtype of Number. In UML, when a property is redefined, the redefining property must be type compatible with the property it redefines. Therefore, myType1 could be substituted by any subtype of Number, which includes Integer, Real, and all their subtypes (Short, Long, Float, Double, etc.). This is based on the UML principle of type conformance in property redefinition, as specified in the UML 2.x Superstructure Specification.
Question #22
Consider the following profile:
Which statement is true?
- A . Each instance of Class must be linked to exactly one instance of DisplayArea, Frame, or Form.
- B . Each instance of Class must be linked to at most one instance of DisplayArea. Frame, or Form.
- C . Each instance of Class must be linked to exactly one instance of DisplayArea. Frame, and Form.
- D . Instances of Class or its subclasses do not have to be linked to instances of DisplayArea. Frame, or Form.
- E . The diagram is incorrect because a required extension cannot be applied to a stereotype inheritance hierarchy.
Correct Answer: D
D
Explanation:
The UML diagram fragment provided shows a UML profile with a required extension from the metaclass Class to the stereotype DisplayArea, which in turn has two subclasses Frame and Form. The use of {required} indicates that whenever an instance of Class is extended by the DisplayArea stereotype, it becomes mandatory to do so. However, this does not enforce that every instance of Class must be linked to DisplayArea or its subclasses (Frame or Form). It only means that if the DisplayArea stereotype is applied, it is required. Therefore, there is no obligation for every instance of Class or its subclasses to be stereotyped as DisplayArea, Frame, or Form. It’s also worth noting that the last option (E) could be considered true in some interpretations of UML, but given the options provided and common UML practices, option D is more accurate.
D
Explanation:
The UML diagram fragment provided shows a UML profile with a required extension from the metaclass Class to the stereotype DisplayArea, which in turn has two subclasses Frame and Form. The use of {required} indicates that whenever an instance of Class is extended by the DisplayArea stereotype, it becomes mandatory to do so. However, this does not enforce that every instance of Class must be linked to DisplayArea or its subclasses (Frame or Form). It only means that if the DisplayArea stereotype is applied, it is required. Therefore, there is no obligation for every instance of Class or its subclasses to be stereotyped as DisplayArea, Frame, or Form. It’s also worth noting that the last option (E) could be considered true in some interpretations of UML, but given the options provided and common UML practices, option D is more accurate.
Question #23
What is the main purpose of the concept of Extent in MOF?
- A . To allow an Element to access its meta class in order to obtain a reflective description of that Element.
- B . To define a set of Tags that represent information to be associated by any number of model Elements.
- C . To provide a context in which an Element can be identified independently from any value in the Element.
- D . To provide an extension mechanism to dynamically annotate model Elements with additional information.
Correct Answer: B
B
Explanation:
The concept of Extent in MOF serves the purpose of defining a set of Tags that can be associated with any number of model elements. These tags provide additional information or metadata about the elements. Extent allows you to annotate model elements with relevant information beyond their intrinsic properties. It provides a context for identifying and managing these annotations independently from the element’s actual values.
Reference: Meta-Modeling and the OMG Meta Object Facility (MOF)
About the Meta Object Facility Specification Version 2.5.1
Semantics, Metamodels, and Ontologies | SpringerLink
B
Explanation:
The concept of Extent in MOF serves the purpose of defining a set of Tags that can be associated with any number of model elements. These tags provide additional information or metadata about the elements. Extent allows you to annotate model elements with relevant information beyond their intrinsic properties. It provides a context for identifying and managing these annotations independently from the element’s actual values.
Reference: Meta-Modeling and the OMG Meta Object Facility (MOF)
About the Meta Object Facility Specification Version 2.5.1
Semantics, Metamodels, and Ontologies | SpringerLink
Question #24
Consider the following sequence diagram:
What does "critical" refer to?
- A . That the emergency message is given highest priority
- B . That the diagram fragment within "critical may be up for redesign
- C . That no other events may interfere m between the events of the critical fragment
- D . That the most urgent and important issue is to make sure that Emergency gets the message
Correct Answer: C
C
Explanation:
In UML 2, a “critical” section in a sequence diagram, like the one depicted, refers to a period where certain interactions are protected so that they can be executed without interruption or interference from other interactions (events). This is akin to a critical section in multi-threading where certain threads have exclusive access to resources or operations for a period of time. The correct answer is option C because it aligns with this definition: during the “critical” section on the sequence diagram, no other events may interfere between its events.
Reference: Object Management Group (OMG). (2017). Unified Modeling Language (UML) C Version 2.5. Retrieved from 6
C
Explanation:
In UML 2, a “critical” section in a sequence diagram, like the one depicted, refers to a period where certain interactions are protected so that they can be executed without interruption or interference from other interactions (events). This is akin to a critical section in multi-threading where certain threads have exclusive access to resources or operations for a period of time. The correct answer is option C because it aligns with this definition: during the “critical” section on the sequence diagram, no other events may interfere between its events.
Reference: Object Management Group (OMG). (2017). Unified Modeling Language (UML) C Version 2.5. Retrieved from 6
Question #25
Which can be added to a redefined operation?
- A . scope
- B . templates
- C . parameters
- D . preconditions
Correct Answer: D
D
Explanation:
In UML, operations can have preconditions defined, which are constraints that must be true before the operation is invoked. When an operation is redefined in a subclass, it is possible to add new preconditions or alter existing ones. Redefining an operation does not typically allow for changes to its scope or the addition of templates, but the preconditions may be expanded to reflect the semantics of the subclass. This is in line with the behavioral specification of operations in UML, where preconditions are part of the behavioral contract of an operation, as described in the UML 2.x Superstructure Specification.
D
Explanation:
In UML, operations can have preconditions defined, which are constraints that must be true before the operation is invoked. When an operation is redefined in a subclass, it is possible to add new preconditions or alter existing ones. Redefining an operation does not typically allow for changes to its scope or the addition of templates, but the preconditions may be expanded to reflect the semantics of the subclass. This is in line with the behavioral specification of operations in UML, where preconditions are part of the behavioral contract of an operation, as described in the UML 2.x Superstructure Specification.
Question #26
The implementation of the collection functions cannot be overridden.
Which UML concept should these designers use?
- A . Classes
- B . Interfaces
- C . Power Types
- D . Class Templates
Correct Answer: D
D
Explanation:
In UML, class templates are the concept used to create classes that can be parameterized with different data types. This feature satisfies the first condition, allowing collections to support any data type. Class templates can be specialized, fulfilling the second condition, where some collections can inherit from others, thus enabling the reuse of functionality. Additionally, UML allows for operations to be defined in such a way that they cannot be overridden, by specifying them as non-virtual or final, which meets the third condition. Therefore, the use of class templates would be the most suitable approach for the design criteria specified by the programming language designers. This approach is consistent with the capabilities of class templates as described in the UML 2.x Superstructure Specification.
D
Explanation:
In UML, class templates are the concept used to create classes that can be parameterized with different data types. This feature satisfies the first condition, allowing collections to support any data type. Class templates can be specialized, fulfilling the second condition, where some collections can inherit from others, thus enabling the reuse of functionality. Additionally, UML allows for operations to be defined in such a way that they cannot be overridden, by specifying them as non-virtual or final, which meets the third condition. Therefore, the use of class templates would be the most suitable approach for the design criteria specified by the programming language designers. This approach is consistent with the capabilities of class templates as described in the UML 2.x Superstructure Specification.
Question #27
Consider the following diagram fragment:
What is the signature of the class template List?
- A . List
- B . T[0..n]
- C . The ordered set {T. n: Integer}
- D . <T -> Customer, n -> 2000> or <T -> Order, n – >10000>
Correct Answer: C
C
Explanation:
The class template List shown in the diagram fragment is a parametrized class with two template parameters: T and n. The signature of the class template includes both of these parameters. The template parameter T represents a type that can be bound to a specific class when the template is instantiated, while n represents an integer value that specifies the multiplicity of elements that can be contained in the list. Therefore, the signature of the class template List is the ordered set {T, n: Integer}, which includes both the type parameter T and the integer parameter n indicating the maximum number of elements the list can hold.
C
Explanation:
The class template List shown in the diagram fragment is a parametrized class with two template parameters: T and n. The signature of the class template includes both of these parameters. The template parameter T represents a type that can be bound to a specific class when the template is instantiated, while n represents an integer value that specifies the multiplicity of elements that can be contained in the list. Therefore, the signature of the class template List is the ordered set {T, n: Integer}, which includes both the type parameter T and the integer parameter n indicating the maximum number of elements the list can hold.
Question #28
Consider the following diagram fragment:
What is "QueryCustomerFromParcel"?
- A . A SQL query
- B . An OCL expression.
- C . An Action with a reference to a transformation behavior.
- D . A Behavior element, for example, an Activity. State Machine, or OpaqueBehavior.
Correct Answer: D
D
Explanation:
"QueryCustomerFromParcel" is annotated with the «transformation» stereotype, which indicates that it is a behavior element that specifies how to convert input objects into output objects. Therefore, the answer is D, a Behavior element, for example, an Activity, State Machine, or OpaqueBehavior. In UML, the «transformation» stereotype is applied to specify that an action or activity is responsible for transforming an input (in this case, "Parcel") into an output ("Customer"), typically by employing a specific behavior element.
Reference: UML 2.5 Specification: Section on Object Flows describes how transformations can be used within activity diagrams to turn inputs into outputs using behavior elements.
D
Explanation:
"QueryCustomerFromParcel" is annotated with the «transformation» stereotype, which indicates that it is a behavior element that specifies how to convert input objects into output objects. Therefore, the answer is D, a Behavior element, for example, an Activity, State Machine, or OpaqueBehavior. In UML, the «transformation» stereotype is applied to specify that an action or activity is responsible for transforming an input (in this case, "Parcel") into an output ("Customer"), typically by employing a specific behavior element.
Reference: UML 2.5 Specification: Section on Object Flows describes how transformations can be used within activity diagrams to turn inputs into outputs using behavior elements.