Object Oriented and Analysis with UML (part 3)

You are creating a banking application that will take queries from users. The application must be able to simultaneously debit and credit the appropriate accounts.

Which of the following diagrams allow you to show parallel or concurrent behavior in your program? (Choose three)

Activity diagram
State diagram
Class diagram
Sequence diagram
Answer Explanation: Activity diagrams, state diagrams, and sequence diagrams all can be used to show parallel or concurrent behavior in your program. An activity diagram is a diagram that shows an activity graph. The activity graph shows the sequential and concurrent steps of a computational procedure. State diagrams are used to describe the behavior of the system, such as any concurrent or parallel behavior. A sequence diagram shows the progression of messages in a time sequence.

The option “Class diagram” is incorrect. A class diagram is a description of objects and object relationships. A class diagram would not be a good diagram to use to show parallel or concurrent behavior. Activity, state, and sequence diagrams would be better used to show parallel or concurrent behavior in your program.

==================================================================================
You are designing a project for a large banking institution. In your state diagram, you are using guards that will determine if the client has sufficient funds to withdraw a specified amount.

Which of the following options is the best method of implementing an action on a transition, which contains a guard condition, in a UML state diagram?

If a particular transition has an action, you will need to append the action name to the event guard.
If a particular transition does not have an action, you will need to append the action name to the event guard.
Append the action name to the transition that has an action.
Append the action name to the event guard for every action.
Answer Explanation: Actions and activities are used to specify the functional transformations and computational behavior of objects in a class. Actions are used to specify some task to be completed as an object makes a transition. Actions are shown in state diagrams by appending “/action-name” to the “event [guard]” for every transition that has an action. An example of the use of actions for a banking application in an UML state diagram is as follows:Withdraw(amt)[amt<=AccBalance] /DecreaseBalance
When the Deposit function is called with an amt, the action of this is that the IncreaseBalance function is called.

The option “If a particular transition does not have an action, you will need to append the action name to the event guard” is incorrect. If a transition has an associated action, the action is shown with a forward slash character (/). The transition could also have a guard that will determine if the transition will fire. You will need to append the action name to the event guard for every transition that has an action. If there is no event guard, the action will occur regardless.

The option “Append the action name to the transition that has an action” is incorrect. You would need to append the action name to the event guard for every transition that has an action, not directly to each transition that has an action.

The option “Append the action name to the event guard for every action” is incorrect. Appending the action name to the event guard for every transition that has an action is the best way to implement an action on a transition in an UML state diagram.

==================================================================================
Which of the following diagrams should be implemented with inheritance?
Answer Explanation: Inheritance is best used to model a generalization relationship. This relationship models classes that have many similarities that can be grouped together in a more general superclass, making it a perfect situation for inheritance.

The “A” option is incorrect. This is a composition relationship. Composition is a whole/part relationship where a part can only belong to one whole at a time. This type of relationship cannot be modeled with inheritance.

The “B” option is incorrect. This is an association diagram. An association diagram models relationships between instances of classes. Since these classes would not necessarily have common attributes or behavior, inheritance does not apply.

The “C” option is incorrect. This is a package diagram that shows the dependency between classes. Dependencies between packages are not modeled with inheritance.

=================================================================================
Which diagram displays the use of a qualified association?
Answer Explanation: A qualified association is one between two classes that uses a qualifier value that distinguishes the set of objects at the far end of the association. It is essentially a parameter. In the diagram, without the Account # qualifier, the Bank-to-Person relationship would have to be modeled as many to many (* – *) instead of many to 0 or 1(* – 0..1).

The “a” option is incorrect. This is an example of an association class.

The “b” option is incorrect. This is an example of self association.

The “d” option is incorrect. This is an example of binary association.

=================================================================================
You are designing a class. This class will transition between different states.

What can you place on a transition that will conditionally fire depending on a Boolean value?

Guard
Event
Action
Super State
Answer: Guard
Answer Explanation: Transitions are the changing of an object from one state to another. Guard conditions are Boolean expressions that are part of the specifications of a transition, and must be true before an object can change state.

The option “Event” is incorrect. Events are specific occurrences. An event can trigger a state transition. Events do not conditionally fire depending on a Boolean value. Guards conditionally fire depending on a Boolean value.

The option “Action” is incorrect. Once a transition fires, its action is executed. Actions do not conditionally fire depending on a Boolean value.

The option “Super state” is incorrect. Super states are used to generalize a portion of the diagram. Super states are not dependant on a Boolean value to conditionally fire.

=================================================================================
Which of the following statements are true of association classes?
An association class itself cannot participate in an association.
The class symbol is attached to the association line using a broken line.
The class symbol and association line are considered a single entity.
The broken line of the association class can include multiplicity.
Answer Explanation: The class portion of an association class is attached to the association line with a broken line. This combination is regarded as a single component in the UML.

The “An association class itself cannot participate in an association” option is incorrect. Since they are much like regular classes, association classes can have associations of their own.

The “The broken line of the association class can include multiplicity” option is incorrect. The broken line simply serves to attach the class to the association line. It has no semantic value.

=================================================================================
Which use case model concept is used?
Realization
Generalization
Include
Extend
Answer Explanation: The UML notation for the generalization relationship is a solid line with a hollow triangle running from the more specific to the more general component.

The “Realization” option is incorrect. The UML notation for a realization relationship is a broken line with a hollow triangle. It is normally used in a class diagram to specify a realization relationship between a class and an interface.

The “Include” option is incorrect. The include relationship in a use case diagram is used to denote a use case that “includes” another use case. It is specified by a broken line with an open arrowhead that runs from the base use case to the use case that it includes.

The “Extend” option is incorrect. The extend relationship in a use case diagram is specified by a broken line with an open arrowhead running from the extended use case to the base use case. This relationship is much like the generalization relationship, but includes more specific details about the variation in behavior.

=================================================================================
Diagrams in the UML can represent activities, classes, use cases, sequence diagrams, etc. Each of these diagrams serves a specific purpose in designing your application.

Which of the following UML diagrams show nodes with packages, modules, objects and operating system processes?

Use case diagram
Deployment diagram
State diagram
Component diagram
Answer Explanation: A UML deployment diagram depicts the physical resources in a system including nodes, components, and connections. Components represent run-time elements of code units. Developers can model these physical resources and network connections to be used in their applications. Nodes are used to represent physical entities, such as computers, printers, etc. On these nodes lie the packages, modules, objects, and processes (as in operating system processes).

The option “Use case diagram” is incorrect. Use case diagrams do not show nodes with packages, modules, objects, and operating system processes. Use case diagrams show the relationships among use case actors and use cases within a system.

The option “State diagram” is incorrect. Also known as a statechart diagram, this type of diagram displays the states of an object that are created by transitions. State machine is a specification of the sequences of states that an object or an interaction will encounter during its life cycle.

The option “Component diagram” is incorrect. A component diagram is a diagram that displays the component architecture of the system.

=================================================================================
Which of the following statements are true of qualified associations?

A qualifier is only used on an association with a “many” multiplicity in the target direction.
It is common to use a qualifier to select a single object from a set of related objects.
A qualifier is normally an attribute of the source object.
The qualifier rectangle is part of the source class.
Answer Explanation: A qualifier value is normally used to select a single object from a set of objects, such as an array. In the case of an array, the qualifier will be the array index value. If the target were not a set of objects, but a single object, there would be no need for a qualifier.

The “A qualifier is normally an attribute of the source object” option is incorrect. Since the target is a set of objects from which one object will be selected, the qualifier will normally be an attribute of the target. This is apparent in a Bank-to-Customer relationship. Since a Bank object will be associated with many Customer objects, a customerID attribute would normally be used as a qualifier.

The “The qualifier rectangle is part of the source class” option is incorrect. The qualifier rectangle is a part of the association itself, not the target or source classes.

================================================================================
Which of the following are true concerning subtyping? (Choose all that apply)

Using a bound element is the same as subtyping.
There is no difference between realization and subtyping in a specification model.
From the specification perspective, generalization refers to inheritance through subclassing.
Subtyping can be used with packages.
Answer Explanation: In a specification model, subtyping involves generalization/specialization through interfaces. A class’ relationship to an implemented interface is a realization relationship. You can also use subtyping, or generalization, with packages. When a generalization relationship is used with packages, the specific package, or subpackage, must conform to the interface of the general package.

The “Using a bound element is the same as subtyping” option is incorrect. When using a bound element, the addition of methods or attributes is not permitted as it is with subtyping.

The “From the specification perspective, generalization refers to inheritance through subclassing” option is incorrect. Generalization through inheritance of superclasses is associated with the implementation perspective, not the specification perspective.

==================================================================================
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: