Você está na página 1de 200

OBJECT

ORIENTED
MODELING &
DESIGN

Made by:-
Shaikh Abdullah Irfan
8879575588
Page 1 of 200
NAME : SHAIKH ABDULLAH IRFAN
COURSE : CM6G
ROLL NO : 21
OBJECT ORIENTED MODELING & DESIGN (17630)
CHAPTERS W14 S15 W15 S16

CHP 1 40 24 12 32

CHP 2 48 48 48 28

CHP 3 12 36 38 36

CHP 4 20 36 36 36

CHP 5 12 12 12 12

THEORY (TH) 100


PRACTICAL (PR) -
THEORY WORK (TW) 25

Page 2 of 200
CHP.1 IMPORTANCE OF MODELING
Q1. What is object orientation? Explain object oriented themes: [S16] [8MKS]

(i) Abstraction

(ii) Encapsulation

(iii) Combining Data

(Definition of Object orientation 1 M; four aspects 1M each, Abstraction 1M;


Encapsulation 1 M; Combining Data 1 M)

Ans 1:

Object Oriented: It means that we organize software as a collection of discrete


objects that incorporate both data structure and behavior. It includes four
aspects:

1. Identity: - It means that data is quantized into discrete, distinguishable


entities called object. Objects can be concrete, such as a file system, or
conceptual such as scheduling policy in multiprocessing operating system. Each
object has its inherent identity.

2. Classification: - objects with the same data structure (attributes) and


behavior (operations) are grouped into a class. A class is an abstraction that
describes properties important to an application and ignores the rest.

3. Inheritance: - It is sharing of attributes and operations (features) among


classes based on hierarchical relationships. A super class has information that its
sub classes refine and elaborate.

4. Polymorphism: - It means that the same operation may behave differently for
different classes. The move operation behaves differently for the pawn
than for the queen in a chess game.

Object oriented themes:

[Same as Ans2]

Page 3 of 200
Q2. Describe any two features/principles/themes of OO (Object Oriented).

(2 marks for each feature, any 2 features can be considered) [W14,W15] [4MKS]

Ans 2: 1) Abstraction

It means focusing on the essential aspects of an entity while ignoring its


details. This means focusing on what an object is and does, before
deciding how it should be Implemented. Use of abstraction during analysis
means dealing only with application domain concepts, not making decisions
before problem is understood.

2) Encapsulation

It means information hiding. It consists of separating the external aspects of an


object, which are accessible to other objects, from internal implementation
details of the object, which are hidden from other objects. It prevents
program from becoming so interdependent that a small change has massive
ripple effect. It gives the ability to combine data structure and behavior in a
single entity.

3)Modularity

Modularity allows us to break up complex system into small, self-contained and


easily understandable pieces that can be managed independently.

4)Hierarchy

Hierarchy is a tree like structure. It is mainly used to order the abstraction.


Abstraction increases from bottom to top.

5) Sharing

OO techniques promote sharing at several different levels. The sharing of a code


using inheritance is one of the main advantages of Object Oriented technique. It
not only allows information to be shared within an application, but also offers the
prospects of reusing designs and code on future projects.

6) Combining Data and Behavior [S16]

The burden of calling code for data execution and operations separately
can be minimized by combining data properties and behavioral properties of an
entity together. In object oriented program data structure and procedure is
defined in single class definition.
Page 4 of 200
Q3.What is attributes? Explain with suitable example. [S15][4MKS]

(Explanation of Attribute -2 Marks; Example - 2 Marks)

Ans: Attributes:

1. An attributes is nothing but data values of an object. An attributes is a named property


of a class that describes a value held by each object of the class.
2. An Attributes are listed in the second part of Class Box.
3. Each attribute name may be followed by optional details.
4. An attributes should describe values, not objects e.g. name, birthday, weight are
attributes of person objects
5. Each attribute name is Unique within a class.

For Example :

Class Person has attributes Name, Birth date and weight. Name is string,
Birthdate is Date and Weight is integer.

Page 5 of 200
Q4. Define model. Why modeling is important? [W14] [4MKS]

(Definition - 1 Mark, Any three Importance - 3 Marks (1 Mark each))

Ans 4:

Model is defined as a simplification of reality/blueprint of system/semantically


close abstraction of the system/ behavior, emphasizing the dynamic of the
system. The fundamental reason for building a model is to understand the system
we are developing in a better way.

Importance of Modeling: [Q7]

Q5. Give relationship among object, dynamic and functional model. [W14] [4MKS]

(Correct explanation with min. 4 points – 4 Marks)

Ans 5:

Relationships among object, dynamic, functional models

The object model represents the static, structural, 'data' aspects of a


system; The dynamic model represents the temporal, behavioral, 'control'
aspects of a system; The functional model represents the transformational,
'functional' aspects of a system. The three kinds of models separate a system into
orthogonal views; they all describe one aspect of the system, but contain
references to the other models. The object model provides the data essential
framework into which the dynamic and functional models can be placed; it
defines the data structure that the other models operate on. In the end the three
models come together in implementation, which involves data (object model),
sequencing (dynamic model) and operations (functional model).

Relationships between the three models are:-

Object and dynamic model:

The dynamic model specifies allowable sequences of changes to objects from the
object model. The states of the dynamic model can be related to classes of
attribute and links values of an object, events can be represented as
operations on the object model. The object model concepts of generalization,
aggregation and inheritance also apply to the dynamic model.

Page 6 of 200
Object and functional model:

All four components of the functional model can be related to the object model
processes. The functional model shows the processes that have to be
implemented in the methods of the objects. The processes in the functional
model show the objects that are related by function. Often one in- or output is
the target (client) of a process. The other inputs are the parameters (suppliers).
These client-supplier relationships establish implementation dependencies
between the related classes.

Dynamic and functional model:

The relationship between these two models is that the dynamic model states
when operations are performed, and the functional model states how they
are performed and which arguments are needed. There is however a
difference between operations on actors and operations on data stores. Because
actors are active objects, the dynamic model has to specify when it acts. The
data stores are passive objects, they only respond to updates and queries,
therefore you do not have to specify in the dynamic model when they act.

Page 7 of 200
Q6. Explain Object Modeling Technology (OMT) by Rambaugh. [W14,S15,S16]
[4MKS]

(Correct explanation of OMT technique- 4 Marks)

Ans 6:

Rambaugh’s Object modeling technique: The Object Modeling Technique (OMT)


presented by James Rumbaugh and his Co-worker describes a method for
the analysis, design and implementation of a system using an object-oriented
technique. OMT is fast, intuitive approach for identifying and modeling all the
objects making up a system. OMT consists of four phases, which can be
performed iteratively. The four phases are Analysis, System Design, Object
Design and Implementation. The results of this phase are reusable, extendible
and robust code.OMT separates modeling into three different parts: OMT has
proposed three main types of models:

1. Object model: The object model represents the static and most stable
phenomena in the modeled domain. Main concepts are classes and
associations with attributes and operations. Aggregation and generalization
(with multiple inheritances) are predefined relationships.

2. Dynamic model: The dynamic model represents a state/transition view


on the model. Main concepts are states, transitions between states, and
events to trigger transitions. Actions can be modeled as occurring within
states. Generalization and aggregation (concurrency) are predefined
relationships.

3. Functional model: The functional model handles the process perspective


of the model, corresponding roughly to data flow diagrams. Main concepts are
process, data store, data flow, and actors. OMT is a predecessor of the Unified
Modeling Language (UML). Many OMT modeling elements are common to UML.

Page 8 of 200
Q7. Write the importance of modeling. [S16] [4MKS]

(Relevant description of importance of modeling 4M)

Ans:

Modeling is defined as the simplification of reality blueprint of system.

Modeling is a central part of all activities that lead up to the deployment o f good
software. It is required to build quality software.

Importance of Modeling:

Modeling gives graphical representation of system to be built.

1. Modeling contributes to a successful software organization.


2. Modeling is a proven and well accepted engineering technique.
3. A model is a simplification of reality. A model provides the blueprint of a
system.
4. A model may be structural, emphasizing the organization of the system, or it
may be behavioral, emphasizing the dynamics of the system.
5. Models are build for better understanding of the system that we are
developing:

a. Models help us to visualize a system as it is or as we want it to be.

b. Models helps us to specify the structure or behavior of a system.

c. Models documents the decision that we have made.

d. Models may be expressed at different levels of precision.

Page 9 of 200
Q8. What is modeling? What are four principles of modeling? [S15,W15,S16]
[4MKS]

(Modeling- 2 Marks, Four Principles – 2 Marks )

Ans: A model is an abstract representation of a system, constructed to


understand system prior to building or modifying it. Building a model for a
software system prior to its construction is like preparing a blueprint for
building a large building. Model includes fundamental modeling concepts and
semantics, notations and guidelines. Models help us to visualize a system as
it is or as we want it to be. It permits us to specify the structure or behavior of a
system. Models give us a template that guides us in constructing a system. It
documents the decisions we have made.

Four principles of object oriented related to modeling: [W14,W15,S16] [4MKS]

1. The choice of what models to create has a profound influence on


how a problem is attacked and how a solution is shaped: It means choose your
model well. The right models will brilliantly illuminate the most wicked
development problems. The wrong models will mislead you, causing you to
focus on irrelevant issues.

2. Every model may be expressed at different levels of precision: All the users
and developers both may visualize a system at different levels of details at
different times.

3. The best models are connected to reality: In object oriented systems, it is


possible to connect all the nearly independent views of a system into one
semantic whole.

4. No single model is sufficient. Every nontrivial system is best approached


through a small set of nearly independent models: To understand the
architecture of a system, you need multiple interlocking views such as use case
view, design view, process view, implementation view and deployment view.
Each of these views may have structural as well as behavioral aspects.
Together these views represent a system.

Page 10 of 200
Q9.i)What is UML? Where it is used? [W13] [4MKS]

(UML definition: 1 Marks and where it is used (minimum three uses): 3 Marks)

Ans :

Definition: The Unified Modeling Language (UML) is a language that unifies the
industry’s best engineering practices for modeling system. The UML is not
simply a notation for drawing diagrams, but a complete language for
capturing knowledge about a subject and expressing knowledge regarding
the subject for the purpose of communication. The UML defines nine types of
diagrams.

Uses:

- UML is mainly used to provide development community with a stable and


common design language that can be used to develop and build computer
applications.

- UML applies to modeling and systems.

- It is used for specifying, visualizing, constructing and documenting systems.

- UML can be used as a standard modeling language because it is


programming language independent also the UML notation set is a language and
not a methodology.

- UML is not a methodology; it does not require any formal work


products. It provides several types of diagrams which can be used within given
methodology, increases the ease of understanding an application under
development.

Page 11 of 200
ii)Give overview of UML. [S14] [4MKS]

(Brief overview – 2 Marks, need of modeling/principle – 2 Marks)

Ans :

Modeling involves the following activities:

1) It represents the reality in simplest form.

2) It provides a blueprint of system.

Various Modeling Techniques required due to following reason.

a) Modeling gives better understanding of the system which we are developing.

b) It also helps in describing the structure or behavior of the system.

c) The important aspect of modeling is that it allows us to experiment by


exploring multiple solutions for the system.

d) The main aspect of modeling complexity of a system.

e) Documenting of the design decisions is very much possible with modeling


which clarifies the system.

f) It helps in visualizing systems as it is and how it will appear in the future once
it is developed.

g) Modeling provides a template or pattern for constructing systems.

Modeling Principles are:

1) According to first principal, the choice of models affects how a problem is


tackled.

2) Second principle of modeling states that every model may be expressed at


Different levels of abstraction.

3) Third principle is effective models are connected to reality.

4) According to fourth principle of modeling no single model is sufficient to


describe non- trivial systems.
Page 12 of 200
UML is Unified Modeling Language (UML). It is a standard language for writing
software blueprints. The UML is used to

a) Visualize

b) Specify

c) Construct and

d) Document the artifacts of a Software- intensive System

Application of UML: UML is Best for modeling Various types of systems:

1) Used in Enterprise Information Systems ,

2) Useful for Distributed Web- based systems

3) Also real – time embedded systems etc.

Major Goals of UML : The major goals of UML are Described Below :

1) To develop meaningful models with an expressive and visual modeling


language.

2) TO extend core concept with extensibility and specialization mechanisms.

3) To develop Specification that that will not depend on particular programming


languages and development processes.

4) To understand the specifications language, UML provides a basis for that.

5) Important goals of UML is to promote the growth of the object tools market.

6) One of the goals of UML is to supports higher level of development


with ideas like components frameworks or patterns.

Page 13 of 200
Q10.i) Describe OMG Model driven architecture. [W9,W10]

ii)Who is the father of UML? What is OMG? [W10,W14] [4MKS]

(Inventors/fathers of UML - 1 Mark, Explanation of OMG with min. 3 points – 3


Marks)

Ans ii:

UML:

The Unified Modeling Language (UML) is a general-purpose modeling language in


the field of software engineering, which is designed to provide a standard way to
visualize the design of a system .

It was created and developed by Grady Booch, Ivar Jacobson and James
Rumbaugh at Rational Software during 1994–95 with further development led by
them through 1996.In 1997 it was adopted as a standard by the Object
Management Group (OMG), and has been managed by this organization ever since.
In 2000 the Unified Modeling Language was also accepted by the International
Organization for Standardization (ISO) as an approved ISO standard.

OMG:

The Object Management Group (OMG) is an international, open


membership, not-for-profit computer industry standards group.OMG Task Forces
develop enterprise integration standards for a wide range of technologies and an
even wider range of industries. OMG's modeling standards enable powerful
visual design, execution and maintenance of software and other processes.OMG
provides only specifications, and does not provide implementations. But
before a specification can be accepted as a standard by OMG, the members of
the winning submitter team must guarantee that they will bring a conforming
product to market within a year. This is an attempt to prevent
unimplemented (and unimplementable) standards.

Example of OMG:

1.Common Object Request Broker Architecture (CORBA)

2.Data Distribution Service(DDS for real-time systems)

3.Meta-Object Facility

Page 14 of 200
Q11. Describe conceptual model of UML? [S14,W14,S15] [4MKS]

(Correct explanation with diagram – 4 Marks )

Ans:

To understand the UML, it is needed to form a conceptual model of the


language, and this requires learning three major elements: the UML‟s basic
building blocks, the rules that dictate how those building blocks may be
put together, and some common mechanisms that apply throughout the
UML.

UML 2.0 has 13 types of diagrams divided into three categories: Six
diagram types represent static application structure, three represent general
types of behaviors, and four represent different aspects of interactions .
These diagrams can be categorized hierarchically as shown in the following
block diagram:

Page 15 of 200
Q12. Explain different relationship in UML. [S12,S15] [4MKS]

(At least two types of relations Explanation with example – 2Marks each. )

Ans: UML shows the following relationships:

1. Instance Level (object level)

2. Class Level

1.Instance level relationship:

Links

A Link is the basic relationship among objects. It is used in object diagrams. Helps
in understanding the relationship between objects, with data values and
multiplicity diagram.

2. Class level relationships

Association

Page 16 of 200
An association represents a family of links. A binary association (with two ends)
is normally represented as a line. An association can link any number of classes.
An association with three links is called a ternary association. An association can
be named, and the ends of an association can be adorned with role names,
ownership indicators, multiplicity, visibility, and other properties. The classes
may be associated with each other by aggregation or generalization.

Aggregation

Aggregation is a variant of the "has a" association relationship; aggregation is


more specific than association. It is an association that represents a part-whole or
part-of relationship.

Composition

Class diagram showing Composition between two classes at top and Aggregation
between two classes at bottom

Generalization

Class diagram showing generalization between one super class and two subclasses
Page 17 of 200
The Generalization relationship ("is a") indicates that one of the two related
classes (the subclass) is considered to be a specialized form of the other (the
super type) and the super class is considered a 'Generalization' of the subclass.

Realization

In UML modeling, a realization relationship is a relationship between two model


elements, in which one model element (the client) realizes (implements or
executes) the behavior that the other model element (the supplier) specifies.

Q13.Describe components and how are they used? [W9] [4MKS]

Ans:

Page 18 of 200
Q14. What is meant by architectural modeling? [S16] [4MKS]

(Description 2 M; Diagram 2M)

Ans:

Architectural model is used for Visualizing, specifying, constructing, and


documenting a software-intensive system.

Architecture is the set of significant decisions about:

 The organization of a software system


 The selection of the structural elements and their interfaces by which the
system
is composed.
 Their behavior, as specified in the collaborations among those elements.
 The composition of these structural and behavioral elements into
progressively larger subsystems.
 The architectural style that guides their organization: the static and
dynamic elements and their interfaces, their collaborations, and their
composition.

a. The use case view of a system encompasses the use cases that describe the
behavior of the system as seen by its end users, analysts, and testers.

b. The design view of a system encompasses the classes, interfaces, and


collaborations that form the vocabulary of the problem and its solution.

Page 19 of 200
c. The process view of the system encompasses the threads and processes that
form the systems concurrency and synchronization mechanisms.

d. The implementation view of a system encompasses the components and files


that are used to assemble and release the physical system.

e. The deployment view of a system encompasses the nodes that form the
system’s hardware topology on which the system executes.

Page 20 of 200
Q15.i) Describe rational unified software development life cycle with its all
phases.

ii) Explain/Describe unified SDLC. [W13,W14,S15,S16] [4MKS]

(Description of software development life cycle with four correct phases and
diagram: 4M)

Ans:

The UML is largely process independent i.e it is not any particular software
development life cycle. However, to get the most benefit from the UML, you
should consider a process that is:

 use case driven


 Architecture centric
 Iterative and incremental

Below fig shows 4 phases in the SDLC:

1. Inception

It is the first phase of the process, when the seed idea for the
development is brought up.

2. Elaboration

It is the second phase of the process, when the product vision and its
architecture are defined. In this phase, the system’s requirements are
articulated, prioritized and base lined.

3. Construction

It is the third phase of the process, when the software is brought from
an executable architectural baseline to being ready to be transitioned to
the user community.

4. Transition

It is the fourth phase of the process, when the software is turned into the hands
of the user community.

Page 21 of 200
Page 22 of 200
Q16.i) Describe Architectural Meta Model. [S14,W14] [4MKS]

ii) With neat diagram explain Metamodel of UML.

Ans i: (Description - 2 Marks, Diagram – 2 Marks)

Architectural Meta model of UML: Visualizing, specifying, constructing, and


documenting a software-intensive system demands that the system be viewed
from number of perspectives.

1.Design View:

the design view of a system is structural view of the system. This view
primarily supports the functional requirements of the system. The design view of
a system includes the classes, interfaces and collaborations that from the
vocabulary of the problem and its solution. Class diagram and object diagram
from the design view of the system.

2. Process view:

The dynamic behavior of system can be seen using the process view. This view
primarily addresses the performance, scalability, and throughput of the
system. The different diagram such as the state diagram, activity diagram,
sequence diagram, and collaboration diagram are used in this view.

Page 23 of 200
3. Implementation view:

implementation view of system includes the components and files that are used
to assemble and release the physical system. The component diagram of UML
captures the implementation view.

4. Deployment view:

the deployment diagram of UML is used to identify the deployment


modules for a given system. This view primarily addresses the distribution,
delivery and installation of the parts that construct the system.

5. Use case view:

Use case diagram of UML describes the behaviours of the system as seen by the
end user, analysts and testers. Use case diagram captures the static view
of the system.

Page 24 of 200
Q17.Mention the UML diagram used for OO analysis and OO design. [W14] [4MKS]

(Any four UML diagram for OO analysis -2 Marks, Any four UML diagram for OO
design -2 Marks)

Ans:

UML diagram for OO analysis:-

1. Class Diagram
2. Object Diagram
3. Use case Diagram
4. Profile Diagram
5. Activity Diagram
6. Interaction Diagram
7. State chart Diagram

UML diagram for OO design

1. Class Diagram
2. Component Diagram
3. Composite Diagram
4. Deployment Diagram
5. Object Diagram
6. Package Diagram

Page 25 of 200
Q18. i)Describe various UML diagram. [W14] [4MKS]

(Any Eight Diagrams each – ½ Mark)

Ans:

Types of UML Diagrams:

UML defines nine types of diagrams: class (package), object, use case, sequence,
collaboration, state chart, activity, component, and deployment.

UML Diagrams used for OO analysis and OO design:

UML defines nine types of diagrams: class (package), object, use case, sequence,
collaboration, state chart, activity, component, and deployment.

Class Diagrams:

Class diagrams are the backbone of almost every object oriented method,
including UML. They describe the static structure of a system. It shows a set of
classes, interfaces and collaboration and their relationships.

Object Diagrams:

Object diagrams describe the static structure of a system at a particular time.


It shows a set of objects and their relationships. They can be used to test class
diagrams for accuracy.

Use Case Diagrams:

Use case diagrams model the functionality of system using actors and use
cases and their relationships.

Sequence Diagrams:

Sequence diagrams describe interactions among classes in terms of an exchange


of messages over time.

Collaboration Diagrams:

Collaboration diagrams represent interactions between objects as a series of


sequenced messages. Collaboration diagrams describe both the static structure
and the dynamic behavior of a system.

Page 26 of 200
State chart Diagrams:

State chart diagrams describe the dynamic behavior of a system in response to


external stimuli. It shows states, transitions, events and activities. State
chart diagrams are especially useful in modeling reactive objects whose states
are triggered by specific events.

Activity Diagrams:

Activity diagrams illustrate the dynamic nature of a system by modeling the flow
of control from activity to activity. An activity represents an operation on some
class in the system

that results in a change in the state of the system. Typically, activity diagrams
are used to model workflow or business processes and internal operation.

Component Diagrams:

Component diagrams shows the organizations and dependencies among a


set of components. It describe the organization of physical software
components, including source code, run-time (binary) code, and executables.

Deployment Diagrams:

A deployment diagram shows the configuration of run-time processing nodes and


the components that live on them. It depict the physical resources in a system,
including nodes, components, and connections.

Page 27 of 200
ii) Explain how UML diagrams are classified. [W15] [4MKS]

(Explanation of any 4 diagrams, each 1M)

Ans:

UML diagram is the graphical presentation of a set of elements. It may


contain any combination of things and relationships.

UML includes nine diagrams:

1. Class diagram

2. Object diagram

3. Use case diagram

4. Sequence diagram

5. Collaboration diagram

6. State chart diagram

7. Activity diagram

8. Component diagram

9. Deployment diagram

7. Activity diagram

1. Class diagram

It shows a set of classes, interfaces and collaborations and their


relationships Class diagram addresses the static design view of a system.

2. Object diagram

An object diagram shows a set of objects and their relationships. Object diagram
addresses the static design view of a system.

3. Use case diagram

A use case diagram shows a set of use cases and actors and their relationships.
Use case diagram addresses the static design view of a system.

Page 28 of 200
4. Sequence & Collaboration diagram

These are the kinds of interaction diagrams. An interaction diagram shows


an interaction, consisting of a set of objects and their relationships
including messages. Interaction diagram addresses the dynamic view of a system.

5. State chart diagram

A state chart diagram shows a state machine, consisting of states,


transitions, events and activities. State chart diagram addresses the dynamic
view of a system.

6. Activity diagram

An activity diagram is a special kind of a state chart diagram that shows the flow
from activity to activity within the system. Activity diagram addresses the
dynamic view of a system.

7. Component diagram

A component diagram shows the organization and dependencies among a set of


components. Component diagram addresses the static implementation view of a
system.

8. Deployment diagram

A deployment diagram shows the configuration of run-time processing nodes and


the components that live on them. Deployment diagram addresses the
static deployment view of architecture.

Page 29 of 200
iii) List and classify various UML diagrams. [S16] [4MKS]

(List 2M, Classification 2M)

Ans:

UML Diagrams are classified into Two major category as follows:

1. Structure Diagram

a. Class Diagram

b. Object Diagram

c. Deployment Diagram

d. Component Diagram

2. Behavior Diagram

a. Activity Diagram

b. Use case Diagram

c. State Machine Diagram

d. Interaction Diagram

i. Sequence Diagram

Page 30 of 200
CHP.2 CLASS MODELING
Q1. Mention and explain any four properties of objects? [S10,S15] [4MKS]

(Any 4 relevant properties/themes/features; For each- 1 Mark )

Ans: Four Properties of Objects:

Object: An object is a real-world element in an object–oriented environment that


may have a physical or a conceptual existence.

Each object has:

a. Identity that distinguishes it from other objects in the system.


b. State that determines the characteristic properties of an object as well as the values of
the properties that the object holds.
c. Behavior that represents externally visible activities performed by an object in terms of
changes in its state.
d. Objects can be modeled according to the needs of the application.
e. An object may have a physical existence, like a customer, a car, etc.; or an
intangible conceptual existence, like a project, a process, etc.

Q2. Define object and class. State how they are different and give suitable
example of each.(Definition of object-1M, Definition of class-1M, any one
difference-1M, example ½ M each) [S10,S14,S16] [4MKS]

Ans:

Definition of object:-

An object is a concept, abstraction or thing that has meaning for an application.


Object is basic run time entity.

Definition of class:-

A Class is a group of objects with similar properties (attributes), common


behavior (operation), common relationship to other objects and common
semantics.

Page 31 of 200
Difference:-

1. Class specifies properties, behavior, relationships and semantics that all


the objects of that class share where as object stores values for individual.
2. Class is a group of objects whereas object is an individual entity
with unique identity.

Example:-

Page 32 of 200
Q3.i)Which symbols are used in class diagram? Give an example diagram. [W13] [
4MKS](Minimum two symbols used in class diagram: 2 Marks, Any Example of class
diag.: 2 Marks)

Ans:

Symbols used in class diagram:

Class diagrams describe the static structure of a system or how it is structured


rather than how it behaves.

These diagrams contain the following element with their symbol.

1) Classes – It represents entities with common characteristics or features. These


features can include attributes, operations and associations. The symbol used to
denote class is rectangle with three compartments. First contains the name of
the class, second contains the attributes of the class and third contains the
operations of that class.

2) Associations – It represents relationships that relate to two or more


other classes where the relationships have common characteristics. The symbol
used to denote association is solid line.

Page 33 of 200
Example:

Page 34 of 200
ii) Explain class diagram with suitable example. [S14,S15] [4MKS]

(Class diagram Explanation-2 Marks, Example - 2 Marks )

Ans:

1. The class diagram is a static diagram. It represents the static view of


an application. Class diagram is not only used for visualizing,
describing and documenting different aspects of a system but also for
constructing executable code of the software application.
2. The class diagram describes the attributes and operations of a class
and also the constraints imposed on the system. The class diagrams are
widely used in the modeling of object oriented systems because they are
the only UML diagrams which can be mapped directly with object
oriented languages.
3. The class diagram shows a collection of classes, interfaces,
associations, collaborations and constraints. It is also known as a structural
diagram.

Values and Attributes: A value is a piece of data. An attribute is a named


property of a class that describes a value held by each object of the class..
Objects is to class as value is to attribute. Name, birth date and weight are
attributes of Person class.

Operations and Methods: An operation is a function or procedure that may be


applied to or by objects in a class. Hire() , fire() and payDividend() are operations
on class company.

Example:

Page 35 of 200
Q4. Draw class diagram for ATM system. [S14,W14,S15] [4MKS]

Ans:

Page 36 of 200
Q5. Draw and explain notations used for object diagram. [S16] [4MKS]

(Two notations: 2M each)

Ans:

1. Object: - An object is a concept, abstraction or thing that has meaning for an


application. Object is basic run time entity. In UML object is represented
with a box including its name followed by a colon and class name. Object and
class name both are written in bold face with underline.Object can have
attributes. Attributes are specified in the second part of the block. Attribute
name is followed by value.

2.Link- It is physical or conceptual connection among objects. It is used to


show relationship among objects. It is represented with a solid line
connecting two objects. Name of the link is written in italic form above line.

Page 37 of 200
Q6. State and explain notations used to draw class diagram. Draw a neat class
diagram for ATM – money withdrawal.

(Any 4 class diagram notations- each 1M, ATM -money withdrawal class diagram
with correct notation 4M)

Note: any other class diagram showing ATM -money withdrawal shall be
considered. [W15] [8MKS]

Ans:

Class diagrams describe the static structure of a system or how it is structured


rather than how it behaves. These diagrams contain the following element with
their symbol.

1) Class– It represents entity with common characteristics or features. These


features can include attributes, operations and association .The symbol used to
denote class is rectangle with three compartments .First contains the name of
the class, second contains the attributes of the class and third contains the
operations of that class.

Notation:

Page 38 of 200
2) Association – Association is a kind of a structural relationship. Objects in
association are at the same level. Association defines a relationship between two
or more classes.

Eg:- Object teacher is related to object student.

teaches

teacher student

It represents relationships that relate to two or more other classes where the
relationships have common characteristics. The symbol used to denote
association is solid line.

Notation:

Page 39 of 200
3) Multiplicity – Multiplicity gives no. of instances of one class that may relate to
single instance of an associated class.The no. of instances a class may have is
known as multiplicity. Multiplicity in an association specifies how many objects
participate in a relationship. Multiplicity decides the number of related objects.
Multiplicity is generally explained as “one” or “many,” but in general it is a
subset of the non-negative integers.

Indicator and Meaning

0..1 Zero or one

1 One only

0..* Zero or more

1..* One or more

n Only n (where n > 1)

0..n Zero to n (where n > 1)

1..n One to n where n > 1)

Notation:

Page 40 of 200
4) Association Class: An association class is an attribute of an association. It is also
a class.

Notation:

5) Generalization: It is a relationship between a class (superclass) and its


derived classes (subclasses).

Notation:

6) Qualified association: It uses the special attribute qualifier which


reduces the effective multiplicity of an association.

Notation:

Page 41 of 200
Page 42 of 200
Q7.Draw different relationship used in class diagram and draw class diagram for
ATM system.[S14] [4MKS]

(Relationships – 4 Marks (1 Mark each), Class Diagram of ATM – 4 Marks)(Note:


Consider any other valid diagram)

Ans:

Different relationships used in class diagram are:

1. Dependency

2. Generalization

3. Association

4. Aggregation

5. Realization

Class diagram for ATM System

Page 43 of 200
Q8. Explain following types of relationships with notation:

(i) Realization

(ii) Generalization

(iii) Dependency

(iv) Association

(v) Aggregation

(For each relationship- Explanation 1M, Notation 1M) [W15] [8MKS]

Ans:

i) Realization It is a semantic relationship between classifiers, wherein one


classifier classifies a contract that another classifier guarantees to carry
out. Realization relationships encounters in two places:

1. Between interfaces and the classes or components that realize them

2. Between use cases and the collaborations that realize them. Graphically, a
realization relationship is rendered as a cross between a generalization and a
dependency relationship, as in figure below:

ii) Generalization: it is a specialization / generalization relationship in which


objects of the specialized element (the child) are substitutable for objects
of the generalized element (the parent). In this way, the child shares the
structure and the behavior of the parent. Graphically, a generalization
relationship is rendered as a solid line with a hollow arrowhead pointing to the
parent, as in figure below:

Page 44 of 200
iii) Dependency It is a semantic relationship between two things in which a
change to one thing may affect the semantics of the other thing. Graphically, a
dependency is rendered as a dashed line, possibly directed, and occasionally
including a label, as in figure below:

iv) Association It is a structural relationship that describes a set of links, a link


being a connection among objects. Aggregation is a special kind of association,
representing a structural relationship between a whole and its parts.
Graphically, an association is rendered as a solid line, possibly directed,
occasionally including a label, and often containing other adornments, such as
multiplicity and role names, as in figure below:

(v) Aggregation :Aggregation is a part whole relationship where an aggregate class


connects multiple subclasses which are part of aggregate class. It is represented
with a diamond towards aggregate class.

Notation:

Page 45 of 200
Q9. Describe the term dependencies with respect to class diagram. [S9,S15]
[4MKS]

(Explanation & Diagram – 4 Marks )

Ans:

Dependency is a weaker form of bond which indicates that one class depends on
another because it uses it at some point in time. One class depends on
another if the independent class is a parameter variable or local variable of a
method of the dependent class. This is different from an association, where an
attribute of the dependent class is an instance of the independent class.
Sometimes the relationship between two classes is very weak. They are
not implemented with member variables at all. Rather they might be
implemented as member function arguments.

Page 46 of 200
Q10. i) Explain generalization and inheritance. [W14,S15,S16] [4MKS]

(Relevant explanation of Generalization and Inheritance with relevant example


4M)

Ans:

Generalization and Inheritance:

1. Generalization is a relationship between a class and one or more derived


classes of it.

2. Generalization organizes classes by their similarities & differences,


structuring the description of objects.

3. The class being derived is called as super class and its derived classes are
called as subclasses.

4. Each subclass is said to “inherit” the features of superclass. This property is


called as inheritance.

5. The super class holds common attributes, operations and association; the
subclasses add specific attributes, operations & associations

6. It is also called as is-a relationship because each instance of a subclass


is an instance of the super class as well.

Notation:

A large hollow arrowhead denotes generalization. The arrow head points to


the super class.

Page 47 of 200
Example:

Page 48 of 200
ii) State the importance of generalization in class diagram with suitable example.

(Two Importance 2 Marks ; Example -2 Marks ) [S10,S15] [4MKS]

Ans:

o A generalization is a binary taxonomic (i.e. related to classification) directed


relationship between a more general classifier (super class) and a more specific
classifier (subclass).
o Each instance of the specific classifier is also an indirect instance of the general classifier,
so that we can say "Patient is a Person", "Savings account is an Account", etc.
Because of this, generalization relationship is also informally called "Is A"
relationship.
o Generalization is owned by the specific classifier.
o A generalization is shown as a line with a hollow triangle as an arrowhead
between the symbols representing the involved classifiers. The arrowhead
points to the symbol representing the general classifier. This notation is
referred to as the "separate target style."
o Generalization relationships that reference the same general classifier can also be
connected together in the "shared target style."

Page 49 of 200
Q11. Describe qualification with appropriate example. [W9,W10,W14] [4MKS]

Ans: Qualified association: It uses the special attribute qualifier which reduces
the Effective multiplicity of an association.

Qualified association specifies relation between two object classes and a


qualifier. The qualifier is a special attribute that reduces the effective
multiplicity of an association. The qualifier distinguishes among the set of objects
at the many end of an association. A qualifier is drawn as a small box on
the end of the association line near the class it qualifies.

Notation:

Page 50 of 200
Q12. Define interface with suitable example and explain its importance.(Define
interface -1Mark, example-1Mark, Importance-2 Marks ) [S14,S15] [4MKS]

Ans:

Interface is a collection of operations that specify a service of a class or component.


An interface might represent the complete behavior of a class or component or
only a part of that behavior. An interface defines a set of operation
specifications (that is, their signatures) but never a set of operation
implementations.

Importance:-

1. An interface therefore describes the externally visible behavior of that element.


2. An interface represent the complete behavior of a class or component
or only a part of that Behavior.
3. An interface defines a set of operation specifications.

Page 51 of 200
Q13.Explain the “operation” in class diagram. [W9,W13] [4MKS]

Ans:

Operation in interface(Interface Example)

Page 52 of 200
Q14.What is realization? Explain with example. [W9,W13] [4MKS]

Ans:

Realization It is a semantic relationship between classifiers, wherein one


classifier classifies a contract that another classifier guarantees to carry
out. Realization relationships encounters in two places:

1. Between interfaces and the classes or components that realize them

2. Between use cases and the collaborations that realize them. Graphically, a
realization relationship is rendered as a cross between a generalization and a
dependency relationship, as in figure below:

Realization: In UML modeling, a realization relationship is a relationship between two model


elements, in which one model element (the client) realizes (implements or executes) the
behavior that the other model element (the supplier) specifies.

Page 53 of 200
Q15. Describe role name with example. [W9,W14,S15][ 4MKS]

Ans:

When a class participates in a association it has got a specific role which it plays
in that relationship. It can be explicitly named the role a class plays in an
association. A role names the behavior of an entity participating in a particular
context. In other words we may say that a role is the face that an abstraction
presents to the world.

Role name: - A role is one end of an association. A binary association has two
roles, each of which may have a role name. A role name is a name that
uniquely identifies one end of an association. Roles provide a way of viewing a
binary association as a traversal from one object to a set of associated objects.A
role name is written next to the association line near the class that plays the
role.

Example:

Page 54 of 200
Q16.i) What are the packages(or Define packages)? Explain with suitable
example. [S11,S12,W12,S14,W14] [4MKS]

ii) What are the packages? Describe its purpose. [S9,W14] [4MKS]

(Description of Packages – 3 Marks, Example - 1 Mark)

Ans:

Packages

 A package is a general purpose mechanism for organizing elements into


groups, structural things, behavioral things and even other grouping things may
be placed in a package

 Unlike components (which exist at run time), a package is purely


conceptual (meaning that it exists only at development time).

 When we visualize, model, document, construct and develop a number


of classes, interfaces, components, nodes diagrams and other elements it is
easier to group them into a PACKAGE .

 A package is rendered as a tabbed folder - a rectangle with a small tab


attached to the left side of the top of the rectangle. If the members of the
package are not shown inside the package rectangle, then the name of the
package should be placed inside.

Example:

Package org.hibernate

The members of the package may be shown within the boundaries of the
package. In this case the name of the package should be placed on the tab.

Page 55 of 200
Q17. Write down the advantages and disadvantages of class and advanced class
diagrams. [W13] [4MKS]

Ans:

Class Diagram:

Advantages:

1. Analysis and design of the static view of an application.

2. It provides a blueprint for maintenance programmers to get an overview


of how the application is structured before examining the actual code.

3. This may reduce maintenance time.

Disadvantages:

1. The programmer may need to learn UML to build the class diagram in the first
place.

2. The time spent building the class diagram may add to overall development
time.

Advanced Class Diagram:

Advantages:

1. It forces the programmer to think out the structure of his/her classes


and how they will interact with each other before actually writing any code.
This may lead to a more robust application.

2. Describes detail functionality of the objects in the system.

3. Easy to develop a system code.

Disadvantages:

1. Advanced class diagram is over complex, it may be difficult to correlate


with the actual code.

2. More complex difficult to design.

3. Need to understand the terms like visibility, dependency , classifier,


stereotypes, advance association, navigation, interface specifier, etc.
Page 56 of 200
Q18. Draw class diagram for:-

i)Library management system. [S12,W14] [4MKS]

Ans:

Page 57 of 200
ii) Hospital management system. [W12]

Ans:

Page 58 of 200
iii) Online bus reservation system. [W13]

Ans:

Page 59 of 200
iv) Draw neat class diagram for Railway Reservation System.

(Diagram with correct notations 6mks) [W15] [6MKS]

Note: any other class diagram showing railway reservation system shall be
considered.

Ans:

Page 60 of 200
Q19. Explain object diagram attributes and methods. [S12,S14] [4MKS]

(Correct definition of object diagram - 2 Marks, Attribute and method - 1 Mark


each)

Ans:

Object diagram

Object diagram provides a formal graphic notation for modeling objects,


classes and their relationships to one another. Object diagrams are useful both
for abstract modeling and for designing actual programs. Object diagrams are
divided into two types class diagram and instance diagram.

Attributes

It is a data value held by the objects in a class. Each attribute has a value for
each object instance. Each attribute name is unique within a class. Name, age,
weight are the attributes of person object.

Method

A method is the implementation of an operation for a class. Eg. The class file
have an operation print. Different methods are implemented to print binary
files, ASCII files. All these methods logically performs the same task of printing a
file, so they can referred by operation print. However each method may be
implemented by different piece of code

Q20. Explain Attribute. [S12,W13,S14] [4MKS]

Ans:

[Q19]

Q21. What is method? [S14] [4MKS]

Ans:

[Q19]

Page 61 of 200
Q22.Describe link in brief with appropriate example. [W9,W10,S12,W13,S14]
[4MKS]

Ans: {[2.3.5] Q1 iii) [Tm pg: 2.75]}

Q23. Describe (or Explain) association with appropriate example. [W10,S12,S14]


[4MKS]

Ans: {[2.3.6] Q1 iii) [Tm pg: 2.77]}

Page 62 of 200
Q24. Explain multiplicity with all its notations. [W10,W12,W14,S15,W15] [4MKS]

(Explanation of multiplicity with example 4M, any 4 notation: 1/2M each).

Ans: [W15] [6MKS]

Multiplicity – Multiplicity gives no. of instances of one class that may relate to
single instance of an associated class. The no. of instances a class may have is
known as multiplicity. Multiplicity in an association specifies how many objects
participate in a relationship. Multiplicity decides the number of related objects.
Multiplicity is generally explained as “one” or “many,” but in general it is a
subset of the non-negative integers.

Indicator and Meaning

0..1 Zero or one

1 One only

0..* Zero or more

1..* One or more

n Only n (where n > 1)

0..n Zero to n (where n > 1)

Notations:

1. ”1” exactly one

2. “1…*” One or more

3. “3-5” three to five

4. 0..1 zero to one

5. “2,4,18” two, four or eighteen

6. Symbol * denotes “many”.

Page 63 of 200
Example 1:

Example 2:

Page 64 of 200
Q25. What is meaning of: [S16] [4MKS]

(i) Attributes

(ii) Link attributes with reference to class and object.

(Meaning of attributes 2M, link attributes 2M)

Ans:

(i) Attributes: - An attributes is a named property of a class that describes a


value held by each object of the class. A class may have any number of
attributes or no attributes at all. An attribute represents some property of the
thing that is shared by all the objects of that class.

Attributes are listed in the second part of Class Box. Each attribute name
may be followed by optional details. Each attribute name is Unique within a
class.

For Example: Class Person has attributes Name, Birthdate and weight. Name
is string, Birthdate is Date and Weight is integer.

Page 65 of 200
(ii) link attributes with reference to class and object:- Link attribute allow adding
properties to association between two classes/objects.

For example: In the below example company and person has a link/association
between them which has link attributes as description, datehired and salary. These
attributes are placed inside the association class job. Association class is linked to
association line with dashed line.

Page 66 of 200
Q26.

1) Describe association classes and inheritance with neat diagrams.(Explanation


of Association Class with diagram: 2M, Explanation of Inheritance with
diagram: 2M) (Note: Any other suitable example shall be considered)
[W9,W15] [4MKS]

Ans:

Association Class:

1. An association class is an attribute of an association that is also a class.

2. Like the links of an association, the instances of an association class


derive identity from instances of the constitute classes.

3. An association class can have attributes and operations and participate


in associations.

4. The UML notation for an association class is a class box attached to


the association by dashed line.

Example:

In the above example Accessible By is an association class and accessPermission is


an attribute of an AccessibleBy class. The sample data at the bottom of the
example shows the value for each link.

Page 67 of 200
Inheritance:

1.Inheritance is a relationship between a class and one or more derived classes of


it.

2.The class being derived is called as super class and its derived classes are called
as subclasses.

3.Inheritance is also called as is-a relationship.

4.In inheritance each instance of a subclass is an instance of the superclass as


well.

Example:

Page 68 of 200
2) How you can use association as a class. [S14] [4MKS]

(Explanation -3 Marks, Example with diagram- 3 Marks)

Ans: Association as a class

In an association between two classes, the association itself might have


properties. Just as an object of a class is describe with attributes, the of
an association can also have a description.

For example, in an employer/ employee relationship between a Company and a


Person there is a job that represents the properties of that relationship that to
exactly one pairing of the Person and Company. It would not be appropriate to
model this situation with a Company to job association together with a job
to person association. That would not tie a specific instance of the job to
the specific paring of Company and Person.

These can be model as an association class, which is a modeling element


that has both association and class properties. An association class can be
seen as an association that also has class properties, or as a class that also has
association properties. An association class as a class symbol attached by a
dashed line to an association can be shown in figure.

Sometimes it is the same properties for several different association


classes can be used. However, we cannot attach an association class to
more than one association, since an association class is the association itself.
To achieve that effects, define a class© and then have each association class
that needs those features inherit from C or use C as the type of An attribute.

Diagram:

Page 69 of 200
Q27.Describe role name with example. [W9,W14,S15] [4MKS]

Ans: (Q15)

Q28.Describe ordering. [W12] [4MKS]

Ans:

1) Ordering decides sequence of interaction will takes place.


2) Order does not means time but it is sequence in which interaction takes
place.
3) The important purpose for which the interaction used is to model the flow
of control which characterizes the behavior of a system.
4) It involves use cases, patterns, mechanism , and framework, or the
behavior of a class or an individual operation.

Page 70 of 200
Q29.

i) Define qualification with appropriate example. [W9,W10,W14] [4MKS]

Ans: [Q11]

Qualification: - Qualification specifies relation between two object classes and a


qualifier. The qualifier is a special attribute that reduces the effective
multiplicity of an association. The qualifier distinguishes among the set of
objects at the many end of an association .A qualifier is drawn as a small box on
the end of the association line near the class it qualifies.

Example:-

ii) Define role name and qualification. [W14,S15] [4MKS]

Ans:

[Q15,Q11]

iii) Define multiplicity and qualification with appropriate example. [S16] [4MKS]

Ans:

[Q24,Q11]

Page 71 of 200
Q30. Define following terms with notations: [W15] [4MKS]

1) Object

2) Class

3) Qualified association

4) Ordered association

(Definition and Notation1 Mark each)

Ans:

1) Object:

-Objects are separate, distinguishable entities.

- They are basic run time entities.

- They are also referred as instances.

-Objects can be defined as a concept, abstraction or thing with well


defined solution for the specific problems.

- Objects serve two purposes:

i) They prompt understanding of real world.

ii) Provides a practical basis for computer implementation.

Example: mango, swati

Notation:

Page 72 of 200
2)Class:

-A Class is a group of objects with similar properties (attributes), common


behavior(operation), common relationship to other objects and common
semantics.

- A class is a collection of objects of similar types.

- Once class has been defined we can create any no. of objects belonging
to the same class.

Class – It represents entity with common characteristics or features. These


features can include attributes, operations and associations. The symbol used to
denote class is rectangle with three compartments .First contains the name of
the class, second contains the attributes of the class and third contains the
operations of that class.

Example: fruit, student

Notation:

3) Qualified association: It uses the special attribute qualifier which reduces


the Effective multiplicity of an association.

Qualified association specifies relation between two object classes and a


qualifier. The qualifier is a special attribute that reduces the effective
multiplicity of an association. The qualifier distinguishes among the set of objects

Page 73 of 200
at the many end of an association. A qualifier is drawn as a small box on
the end of the association line near the class it qualifies.

Notation:

4) Ordered association:

Usually the objects on the "many" side of an association have no explicit order,
and can be regarded as a set. Sometimes the objects on the many side of
an association have order. Writing {ordered} next to the multiplicity dot
indicates an ordered set of objects of an association.

Notation:

Page 74 of 200
Q31.

a) State the meaning of Aggregation and specialization with example. [S10]


[4MKS]
b) (Describe aggregation.) Define Aggregation. What are the properties of
aggregation.

[W12,W14] [4MKS]

(Definition – 2 Marks, Properties – 2 Marks)


Ans:
Aggregation is a strong form of association in which an aggregate object is made
of components. Components are part of aggregate. Aggregation is the „part-
whole‟ or a-part-of‟ relationship in which objects representing the
components of something are associated with an object representing the
entire assembly.

Properties:
1. Aggregation is the “Part-whole” or “a- part-of” relationship in which objects
representing the components.
2. An Aggregation is a specialized association.
3. Aggregation is tightly looped from of association with same extra semantics.
4. Example shows that a document consists of many sentences.
5. Aggregation is drawn like association, except a small diamond indicates the assembly
end of the relationship.

Example:

Page 75 of 200
Q32.

i) State the importance of generalization in class diagram with suitable example.

(Two Importance 2 Marks ; Example -2 Marks ) [S10,S15] [4MKS]

Ans:

 A generalization is a binary taxonomic (i.e. related to classification)


directed relationship between a more general classifier (super class) and a
more specific classifier (subclass).
 Each instance of the specific classifier is also an indirect instance of the general
classifier, so that we can say "Patient is a Person", "Savings account is an
Account", etc. Because of this, generalization relationship is also informally
called "Is A" relationship.
 Generalization is owned by the specific classifier.
 A generalization is shown as a line with a hollow triangle as an arrowhead
between the symbols representing the involved classifiers. The
arrowhead points to the symbol representing the general classifier. This
notation is referred to as the "separate target style."
 Generalization relationships that reference the same general classifier can also be
connected together in the "shared target style."

Page 76 of 200
ii) Explain how generalization is useful in ATM case study. [S10] [4MKS]

Ans:

Page 77 of 200
iii) a)Explain multiple inheritance with suitable example. [W12,S14] [4MKS]

Ans:

 Multiple inheritance is a relationship that exists among different classes and interface.
 One class may have multiple super classes or interfaces. Also many classes may have
many sub classes or interfaces. This is called as multiple inheritance.
 Multiple inheritance allows to establish the relationship of many classes. It allows to
share attributes and operations of the classes.
 Multiple inheritance is very useful property of object orientation. It is complicated to
understand when no. of classes are more.

Page 78 of 200
b) How will you show implementation of multiple inheritance? Explain with example
and diagram?(Correct explanation - 2 Marks, Example with diagram - 2 Marks)

Ans: [S14][4MKS]

Multiple Inheritance:

It is defined as a class which can inherit features from two or more classes.

Multiple inheritance permits a class to have more than one super class and to inherit
features from all of its parents.

The advantage of multiple inheritance is greater power in specifying classes and an


increased opportunity for reuse.

As shown in above figure Consultant Manager and Permanent Manager are inheriting
features from more than one parent.

Page 79 of 200
Q33. Explain grouping constraint with example? [S11,W13] [4MKS]

(Explanation: 4 Marks)

Ans: Grouping Construct:

Module and sheet are grouping constraints. A module is a logical grouping constructs which
capture one perspective or view of a situation. A sheet is merely a notational convenience
for fitting object models on to fixed sized pieces of paper.

Module:

A module is a logical construct for grouping classes, associations and generalization. A


module captures one perspective or view of a situation. For e.g. electrical, plumbing
and ventilation modules are different views of a building. The boundaries of a module are
somewhat arbitrary and subject to judgment. An objects model consists of one or more
modules. Modules are created by partitioning an objects model into manageable
pieces. Modules provide an intermediate unit of packaging between an entire object
module and the basic building blocks of class and association. The module name is usually
listed at the top of each sheet. There is no other special notation for modules.

Sheet:

A complex model will not fit on a single piece of paper. A sheet is the mechanism for
breaking a large object model down into a series of pages. A sheet is a single printed page.
Each module consists of one or more sheets. As a rule we never put more than one module
per sheet. A sheet is just a notational convenience, not a logical construct. Each sheet has a
title and a name or number. Each association and generalization appears on a single sheet.
Classes may appear on multiple sheets.

Page 80 of 200
Q34.Describe recursive aggregates (composition) with proper diagram and example.
[W14,S15] [4MKS]

(Correct diagram - 2 Marks, correct explanation - 2 Marks)

Ans:

Aggregation can be fixed, variable or recursive. A fixed aggregate has a fixed


structure, the member and types of subparts are predefined. A variable aggregate has
a finite number of levels, but the member of parts may vary. A recursive aggregate
contains, directly or indirectly, an instance of the same kind of aggregate; the number
of potential levels is limited. Fig. above shows examples of a computer program. A
program is an aggregation of blocks, with optionally recursive compound statements the
recursive terminates with simple statements. Blocks can be rested to arbitrary depth. In
above figure a super class and 2subclasses, one of which is An intermediate node of the
aggregate and one of which is a terminal mode of the aggregate.

Page 81 of 200
Q35. Describe propagation of operation with diagram and example.

(Explanation 2M, Example with diagram 2M) [S14,S15,W15] [4MKS]

Ans:

Propagation of Operation:

1. Propagation is also called as triggering.

2. It is the automatic application of an operation to a network of objects when the


operation is applied to some starting object.

3. As moving aggregate moves its parts, the move operation propagates to the parts.

4. Propagation of operations to parts is good indicator of aggregation.

Example/diagram:

Above diagram shows an example of propagation. A person owns multiple documents.


Each document consists of paragraph that in turn consists of characters. The copy operation
propagates from documents to paragraphs to characters. Copying a paragraph copies all
the characters in it. The operation does not propagate in the reverse direction. A
paragraph can be copied without copying the whole document. Copying a document copies
the owner link but does not spawn/generate a copy of the person who is owner.

[OR]

Propagation of Operation:

Propagation (Also called Triggering) is the automatic application of an operation to a


network of objects when the operation is applied to some starting object. Propagation of
operations to parts is often a good indicator of propagation. Propagation is very well
applicable to aggregated objects, operation carried on whole eventually changes the states
of sub objects.

Page 82 of 200
Q36.

a) Describe/Explain Abstract class and concrete class with diagram. (Description – 1 Mark
each, Diagram – 2 Marks)

[W9,S11,S12,W14] [4MKS]

Ans:

Definition

Abstract class: It cannot be used to create objects. So it cannot be instantiated. Classes that
has no direct instances, but whose descendant classes have direct instances are known as
abstract class. Abstract classes are incompletely implemented i.e. the class has interfaces
without implementations.

Concrete class: It is a class that is instantiable means it can have direct instances. A
concrete class may have abstract subclasses. It can be a leaf class in the inheritance tree.

Example:

Page 83 of 200
b) What is abstract class? What is its function? Give an example? [W13] [4MKS]

(Abstract class definition 2 Marks, with its functions and example: 6 Marks)

Ans:

Definition

Abstract class:

It cannot be used to create objects. So it cannot be instantiated. Classes that has no direct
instances, but whose descendant classes have direct instances are known as abstract
class. Abstract classes are incompletely implemented i.e. the class has interfaces without
implementations.

Function:

1) Abstract classes are useful to create an abstract super class to encapsulate classes
that participate in the same aggregation or association.

2) Some abstract classes appear naturally in the application domain. Other abstract
classes are artificially introduced as a mechanism for promoting code reuse.

3) Abstract classes organize features common to several classes. These classes are frequently
used to define methods to be inherited by subclass.

4) Abstract class can define the protocol for an operation without supplying a
corresponding method. This is called as an abstract operation. An abstract operation is
specified by a comment in braces.

Page 84 of 200
Q37.

 Describe the term: [W14,S15] [4MKS]


1) Metadata.
2) Candidate-key.
3) Constraint.

Ans: [2.6. 1),2),4)]

1) Metadata. [W9,S11,W12,W14,S15]
 Metadata is a data about data.
 Eg:- class definition could be a metadata.
 Most of the real world application have metadata.
 Computer language implementation also use metadata on huge level.
 Models are inherently metadata, since they describe the things being modeled. a
relational database management system use metadata. A person can define
information.

 Explanation of example:-Each car model has its own attributes and associations. Each car
model object also describes a set of physical cars owned by persons. Each car
receives the common attributes from car model but also own list of particular attributes
such as serial number, color and a list of options. Car Model object as a pattern, a piece of
metadata, that describes car objects.

Page 85 of 200
2) Candidate-key. [S11,S12,W14]
 The super key for which no proper subset, such a minimal super key are called as
candidate key.
 Candidate key can be single or combination of attributes.
 It is a minimal set of attributes that uniquely identifies an object or link . It means you
cannot discard an attribute from the candidate key and still distinguish all objects and
links.
 A class or association may have one or more candidate keys, each of which may have
different combinations and numbers of attributes. The object id is always a candidate key
for a class.
 One or more combinations of related objects are candidate keys for associations.
 Notation: - A candidate key is delimited with braces in an object model.

Example:-

 A many- to- many association requires both related objects to uniquely identify
each link.
 A one-to-many association has a single candidate key: the object on the many side.
 A one-to-one association has two candidate keys: either of the objects.

Page 86 of 200
3) Constraint. [S11,S12,W12,W13,W14,S15]
 A constraint is a Boolean condition involving model element such as, objects, classes,
attributes, links, associations and generalization sets.
 Constraints are commonly used for various elements on class diagrams to
express some condition or restriction. UML specification does not restrict
languages which could be used to describe constraint. Constraint must be somehow
evaluated to true by a correct design of the system.
 For a class attribute the constraint in curly braces may follow the attribute.

 Bank accounts attribute constraints - non empty owner and positive balance
 For a constraint that applies to a single element (such as a class or an association
path),the constraint string may be placed near the symbol for the element, preferably
near the name, if any.

Page 87 of 200
 What are constraints? How they are applied? [S15,S16] [4MKS]

(Description of constraint: 2M, any two constraints application 1M each)

Ans:

Constraints:

A constraint is a Boolean condition involving model element such as, objects, classes,
attributes, links, associations and generalization sets.

Constraint is a Boolean condition involving model elements such as objects, classes,


attributes, links and associations. A constraint restricts the values that entities/elements can
assume.

1. Constraints on Objects:

The structure of model expresses many constraints but sometimes it is helpful to add
explicit constraints. Examples of some constraints are:

Page 88 of 200
2. Constraints on Generalization Sets:

 Disjoint
 Overlapping
 Complete
 Incomplete

3. Constraints on Links:

Page 89 of 200
Q38.

A. List three models and explain functional model in detail. [W15] [4MKS]

(List: 2M, Explanation of Interaction Model/ Functional Model: 2M)(Note: Explanation of


Functional (E scheme) or Interaction Model (G scheme) shall be considered).

Ans: (According to E scheme syllabus)


Three Models:

1. Object Model

2. Dynamic Model

3. Functional Model

Functional model:

1. It describes the data value transformations within a system.

2. The functional model contains data flow diagram. It represents computations.

3. A data flow diagram is a graph whose nodes are processes and arcs are data flows.

Example of Data Flow Diagram:

Page 90 of 200
Three Models:

1. Class Model

2. State Model

3. Interaction Model

Interaction Model:

1. The interaction model describes interaction between objects i.e. how individual
objects collaborate to achieve the behavior of the system a s a whole.

2. The state and interaction models describe different aspects of behavior.

3. Use cases, sequence diagrams and activity diagrams document the interaction
model. Use cases document major themes for interaction between the system and outside
actors.

4. Sequence diagrams show the objects that interact and the time sequence of their
interactions.

5. Activity diagrams show the flow of control among the processing steps of a
computation.

Example of Interaction model:

Page 91 of 200
B. Give relationship among object, dynamic, and functional model. [S9] [4MKS]

Ans:

[CHP 1 (Q5)]

Q39. Explain dynamic modeling/model with suitable example. [W9] [4MKS]

Ans:

Dynamic modeling/model:

1. It gives control aspect of a system


2. It describes the aspects of a system and implements the control aspects of a system
3. It contains state diagrams
4. A state diagram is a graph whose nodes are states and arcs are transition between
states caused by events.
5. States are nothing but values of objects. Events are those which represent external
response.
6. We examine changes in the objects and their relationships over time.

Page 92 of 200
Q40. Explain functional modeling/model with suitable example. [S9,W9,W10,S14] [4MKS]

(Any explanation with minimum 4 points - 4 Marks)

Ans:

Functional Modeling

1. The functional model describes computations and specifies those aspects of the
system concerned with transformations of values - functions, mappings,
constraints, and functional dependencies.
2. The functional model captures what the system does, without regard to how or
when it is done.
3. The functional model is represented graphically with multiple data flow
diagrams, which show the flow of values from external inputs, through operations
and internal data stores, to external outputs.

Following steps are performed in constructing a functional model:

1. Identify input and output values.


2. Build data flow diagrams showing functional dependencies.
3. Describe functions.
4. Identify constraints between objects.
5. Specify optimization criteria.

Significance :

1. Function modeling is based on the concept of functions or processes, so they become


the most important element in this approach.
2. The functional model describes computations within a system, i.e., what happens.
3. The functional model specifies the result of a computation without specifying how or
when they are computed.
4. The functional model is represented graphically with multiple data flow diagrams.

Page 93 of 200
Q41. Draw object diagram for:-

1) Your college admission process. [W12] [4MKS]

Ans:

Page 94 of 200
2) Super shop management system. [W13] [4MKS]

Ans:

Page 95 of 200
Page 96 of 200
Q42. Differentiate between :-

1. Association and Aggregation.


2. Operation and Method.
3. Aggregation and Composition.
4. Functional modeling and dynamic modeling.

Ans:

[2.8. 1,2,3,4]

1. Differentiate between association and aggregation: [W14,S15,W15,S16] [4MKS]

(Any 4 points of comparison; 1 M each)

Association Aggregation
1.Association is a kind of a structural 1. Aggregation represents “has a”
relationship. relationship.

2. Object are at the same level. 2. Classes are not at the same level.

3. Association defines a relationship between 3. Aggregation is a specialized Association.


two or more classes.

4. eg :– 4. eg: –
Object teacher is related to Object student. Company and Department are classes.
Department is a part of a company.

Teacher Student Company Department

5. Notations:- 5. Notations:-
relates

Class A Class B Whole Part

Page 97 of 200
2. Operation and Method. [S9] [4MKS]

Ans:

OPERATION METHOD
1. Operations are action to be taken. 1. Methods are implementations of
operation.

2. Operation are at first stage. 2. Methods are nest to operation.

3. Operations are shown in the class 3. Methods are used in class diagram and
diagram. in interaction diagram.

4. Operations are assumed public if 4. Visibility has to be provided.


visibility is not specified.

3. Aggregation and Composition. [W10] [4MKS]

Ans:

Aggregation Composition
1. Aggregation represents “has-a 1. Composition includes who/part
“relationship. relationship.

2. Aggregation is special kind of 2. Composition is a special kind of


association. aggregation.

3. It specifies that one big class can be 3. Composition is one of the form of
related to another small class. aggregation with strong ownership and
coincident lifetime as part of the
whole.
4. Classes are not at the same level. 4. Composition shows complicated
relationships than aggregation.

Page 98 of 200
4. Dynamic modeling and functional modeling. [S11,W13,S15] [4MKS]

Dynamic Model Functional Model


It gives control aspect It gives Functional aspect of a
of a system system
It describes the aspects It describes computation within a
of a system and system and those aspects of a
implements the control system related with transformation
aspects of a system of values, functions, mapping,
restrictions and functional
dependencies.
It contains state diagrams The functional model shows how
output values are calculated from
input. Functional model contains
Data Flow Diagram.
A state diagram is a DFD is graph whose nodes are
graph whose nodes are process and arcs are data flow
states and arcs are directions.
transition between
states caused by events.
States are nothing but Functional Model captures what a
values of objects. system does without regard to how
Events are those which or when it is done
represent external
response.
We examine changes in DFD shows dependencies between
the objects and their values.
relationships over time.

Page 99 of 200
CHP.3 BASIC BEHAVIOURAL MODELING
Q1.

i) What is use case diagram? [S14] [4MKS]

Ans:

1] Use case diagram:

I. It is a pictorial representation of use cases .


II. It shows a set of use cases and relationship.
III. Actor is a special kind of a class.
IV. Application of use case diagram is to illustrate the static use case view of a system.

2] Notations for use case diagram:

1) Use case:

Labels are use with Oval to describe the function of a system.

print

2) Actor:

Actor is a special kind of a class.

Actor is referred as the user of the system.

Page 100 of 200


3) Communication line (Association):

Communications are shown with the lines.

4) System boundaries:

Rectangular box indicates the boundary of the system.

It contains use cases.

We need to place Actor outside the system.

Use
case

Use
case

Use
case
Actor

ii) State importance of use case diagram. [S16] [4MKS]

Ans:

Use case diagram:-

It shows a set of use cases and actors and their relationships. a use case is a description of a
set of sequences of actions that a system performs to get an result to tan actor. It
describe a set of sequences in which each sequence represents the interaction of the
things outside the system with the system itself. It represents functional requirements of
system. For example, for ATM system validating pin for the customer is a behavior of a
system which can be shown as use case. It addresses the static use case view of a system.
These are important in organizing and modeling the behaviors of a system.
Page 101 of 200
Common uses of use case diagram:-

 To model the context of a system:- modeling the context of a system involves drawing
a line around the system and representing actors lie outside the system and interact
with it. In use case diagram actors and the meaning of their roles is represented.
 To model the requirements of a system:-modeling the requirements of a system
involves specifying what that system should do without respect to how that system
should do it.

Notations:-

Use case: - It is shown with ellipse.

Association: - It is shown with solid line.

[OR]

IMPORTANCE OF USE CASE DIAGRAM:- [Ans i) +]

1. It represents the functional requirements.

2. It illustrates/addresses the static use case view of a system.

3. These are important in modeling and organizing the behavior of a system.

Page 102 of 200


Q2. State any two types of actors used in use case diagram.Draw a neat use case diagram for
car rental system{ considercar_details, car_agency, passenger, Bill_payment }
(Two actors-Each actor 1M, Use case diagram with correct notation -4 M)

Note: any other use case diagram showing car rental system shall be considered.

[W15] [6MKS]

Ans:

Two types of actors used in use case diagram are:

1) Primary or Principle Actor:

The primary actor of a use case is the stakeholder that calls on the system to deliver one of
its services. It has a goal with respect to the system –one that can be satisfied by its
operation. The primary actor is often, but not always, the actor who triggers the use case.

2) Supporting or Secondary Actor:

A supporting actor in a use case in an external actor that provides a service to the
system under design. It might be a high-speed printer, a web service, or humans that have to
do some research and get back to us. Use case diagram for car rental system:

Page 103 of 200


Q3.i) Explain <<include>> and <<extend>> dependencies used in use case
diagrams.(Description of <<include>> 2M, <<extend>> 2M)

ii) Describe <<include>> and <<extend>> relationships in use case diagram.(Explanation of


<<include>> relationship -2 Marks; Explanation of <<extend>>relationship-2 Marks)

Ans: [S16,W15] [4MKS]

<<include>> relationships:

Include relationship is used to include one use case within the behavior sequence of
another use case.

Include relationship is use case of indicates direct incorporation of one use case to
another.

 An include relationship between use cases means that the base case explicitly
incorporates the behavior of another use case at a location specified in the base.
 The include use case never stand alone. When an actor initiates any base use case
then base use case executes included use case.
 An include relationship as a dependency can be render with stereotyped as include. To
specify the location in a flow of events in which the base use case includes the behavior
of another, simply write include followed by the name of the use case.
 Arrow is placed near the included use case. Arrow is directed from base use case
to included use case.

Page 104 of 200


<<extend>> relationships:

It adds incremental behavior of an use case.

Extend relationship is indirect incorporation.

 A extend relationship between use cases means that the base use case
implicitly incorporates the behavior of another use case at a location specified
indirectly by the extending use case.
 The extended use case adds itself to the base use case. Most of the time, an
extend relationship has a condition attached to it. The extended use case executes
only when the condition is true.
 The base use case may stand alone, but under certain conditions, its behavior
may be extended by behavior of another use case.
 An extend relationship as a dependency can be render with stereotyped as extend.
Arrow is directed from extended use case towards base use case.

Example:

Page 105 of 200


Q4. Describe what is use case generalization in detail with example. [W15] [4MKS]

(Explanation with example-4 Marks)(Note: Students may right any appropriate example to
show use case generalization. Keywords are parent use case, child use case, sharing
specifications, abstract)

Ans:

 Generalization is used when you find two or more use cases that have
commonalities in behavior, structure, and purpose. When this happens, you can
describe the shared parts in a new use case which is child use case.
 For e.g.: Place order is main system use case which may get order from phone or
internet, so phone order and internet order are child use cases.

The use cases Phone Order and Internet Order are specializations of the abstract use case
Place Order.

 In an Order Management system, the use cases Phone Order and Internet Order
share a lot in structure and behavior. A general use case Place Order is defined
where that structure and common behavior is defined. The abstract use case Place
Order need not be complete in itself, but it provides a general behavioral framework
that the child use cases can then make complete.
 The parent use case is not always abstract.

Page 106 of 200


Example:

 The child use cases can add behavior to the structure that the parent use
case provides, and also modify behavior in the parent.
 The child use case is dependent on the structure of the parent use case. The child
use case may add additional behavior to the parent by inserting segments of
behavior into the inherited behavior, or by declaring include- and extend-
relationships to the child use case.
 The child may modify behavior segments inherited from the parent, although it must
be done with care so that the intent of the parent is preserved. The structure of the
parent use case is preserved by the child. This means that all behavior
segments, described as steps or sub flows of the parent’s flow of events, must still
exist, but the contents of these behavior segments may be modified by the child.
 If the parent is an abstract use case, it may have behavior segments that are
incomplete. The child must then complete those behavior segments and make them
meaningful to the actor.
 A parent use case need not have a relationship to an actor if it is an abstract use
case.
 If two child use cases are specializing the same parent (or base), the specializations
are independent of one another, meaning they are executed in separate use-
case instances. This is unlike the extend- or include-relationships, where several
additions implicitly or explicitly modify one use-case instance executing the
same base use case.
 Both use-case-generalization and include can be reuse behavior among use cases in
the model.

Page 107 of 200


Q5. [OR Q6) (3)]

i) Draw use case diagram for railway ticket counter (Use railway ticket counter,
booking clerk)(Correct Use case Diagram 8M; Any relevant diagram shall be considered)

Ans: [S16] [8MKS]

ii) Draw use case diagram for railway reservation.(Any relevant diagram- 8 Marks )

Ans: [W14,S15,S16] [4/8MKS] [S15-8MKS]

Page 108 of 200


Railway Reservation System is a system used for booking tickets over internet. Any
Customer Can book tickets for different trains. Customer can book a ticket only if the
tickets are available. Customer searches for the availability of tickets then if the
tickets are available he books the tickets by initially filling details in a form. Tickets can
be booked in two ways by i-ticket or by eticket booking.

Q6. Draw use case diagram for hospital management. (Any relevant use case diagram with
proper notation - 8 Marks)

Ans: [W14,S15] [4/8MKS] [S15-8MKS] [OR Q6) (4)]

Page 109 of 200


Q7. Draw a use case diagram for :- *3.1.4 (1,2,5,6…11) +

1) Online airline reservation system. [S10][4MKS]

Ans:

2) Atm system. [S10,S11][4MKS]

Ans:

Page 110 of 200


3) Railway reservation system [S19,S10,W10,S12,S14,W14,S15]

Ans:

Page 111 of 200


4) Hospital management system. [W14,S15]

Ans:

Page 112 of 200


5) Hotel(restaurant)management system.

Ans:

Page 113 of 200


6) Online library management system.

Ans:

7) Library management system. [S12][4MKS]

Ans:

Page 114 of 200


8) Fire alarm system. [W12][4MKS]

Ans:

9) “Player selection” in Indian cricket team. [W13][4MKS]

Ans:

Page 115 of 200


10) Print result from MSBTE website. [S14][4MKS]

Ans:

Page 116 of 200


11) Car rental system{ considercar_details, car_agency, passenger, Bill_payment }(Use case
diagram with correct notation -4 M) [W15][4MKS]

Ans:

Page 117 of 200


Q8. Explain sequence diagram with suitable example.(Explanation- 2 Marks, Example – 2
Marks ) [S12,W12,S15][4MKS]

Ans:

1. Sequence diagram emphasizes on time sequence of messages and collaboration


diagram emphasizes on the structural organization of the objects that send and receive
messages.
2. This diagram is a model describing how groups of objects collaborate in some behavior
over time.
3. The diagram captures the behavior of a single use case. It shows objects and the
messages that are passed between these objects in the use case.
4. A good design can have lots of small methods in different classes. Without this it can
be difficult to figure out the overall sequence of behavior.
5. This diagram is simple and visually logical, so it is easy to see the sequence of the flow
of control.
6. A sequence diagram also clearly shows concurrent processes and activations.

Purpose: Purposes of sequence diagram can be describes as:

 To capture dynamic behavior of a system.


 To describe the message flow in the system.
 To describe structural organization of the objects.
 To describe interaction among objects.

Example of Sequence Diagram:

Page 118 of 200


Q9. State and explain notations used to draw sequence diagram. Draw a neat diagram for
library management system – Book Issue.(Any 4 sequence diagram notations: each 1M,
library management system-book issue sequence diagram with correct notations 4M)Note:
Any other sequence diagram showing library management system-book issue shall be
considered. [W15][8MKS]

Ans:

Notations:

1) Object:

Class roles describe the way an object will behave in context. Use the UML object
symbol to illustrate class roles, but don't list object attributes.

2) Activation or Execution Occurrence:

Activation boxes represent the time an object needs to complete a task. When an
object is busy executing a process or waiting for a reply message, use a thin gray rectangle
placed vertically on its lifeline.

3) Messages:

Messages are arrows that represent communication between objects. Use half-
arrowed lines to represent asynchronous messages. Asynchronous messages are sent from
an object that will not wait for a response from the receiver before continuing its
tasks.
Page 119 of 200
4) Lifelines:

Lifelines are vertical dashed lines that indicate the object's presence over time.

5) Destroying Objects:

Objects can be terminated early using an arrow labeled "<< destroy >>" that points to
an X. This object is removed from memory. When that object's lifeline ends, you can place
an X at the end of its lifeline to denote a destruction occurrence.

6) Loops:

A repetition or loop within a sequence diagram is depicted as a rectangle. Place the


condition for exiting the loop at the bottom left corner in square brackets [ ].

Page 120 of 200


Q10. i)Explain synchronous and asynchronous messages with diagram.(Synchronous
Message 2 M; Asynchronous Message 2 M) [S16][4MKS]

Ans:

Synchronous Message:

A synchronous message requires a response before the interaction can continue. It's
usually drawn using a line with a solid arrowhead pointing from one object to another. If a
caller sends a synchronous message, it must wait until the message is done, such as
invoking a subroutine.

Asynchronous Message:

Asynchronous messages don't need a reply for interaction to continue. Like synchronous
messages, they are drawn with an arrow connecting two lifelines; however, the
arrowhead is usually open and there's no return message depicted. If a caller sends
an asynchronous message, it can continue processing and doesn‟t have to wait for a
response.

Page 121 of 200


ii) Explain importance of Synchronous and Asynchronous messages in sequence
diagram. Draw sequence diagram for student admission in your institute.(Explanation of
Synchronous messages -2M, Asynchronous messages-2 Marks; sequence diagram for
student admission in your institute with correct notations- 4M)(Note: any other sequence
diagram for student admission in your institute shall be considered.) [W15][8MKS]

Ans:

Synchronous Messages:

 A synchronous message is invoked when the Message Caller waits for the Message
Receiver to return from the message invocation.
 A synchronous message is used when the sender waits until the receiver has
finished processing the messages, only then does the caller continue.
 Most method calls in object-oriented programming languages are synchronous.
 A closed and filled arrowhead signifies that the message is sent synchronously. For
example in given diagram transaction between enrolment staff and enrolment method
is shown with such arrows.
 The rectangles on the lifeline are called activation and indicate that an object is
responding to a message. It start when the message is received and ends when the
object is done handling the message.
 When messages are used to represent method calls, each activation corresponds to
the period during which an activation record for its call is present on the call stack.If you
show that the receiver has finished processing the message and returns control to the
sender, draw a dashed arrow from receiver to sender, optionally, a value that the
receiver returns to the sender can be placed near the return arrow. For example
Printinvoice() is finishing message shown with dotted line.

Asynchronous Messages:

 With an asynchronous message, the sender does not wait for the receiver to finish
processing the message, it continues immediately.
 Message sent to a receiver in another process or calls that start a new thread are
example of asynchronous messages.
 An open overhead is used to indicate that a message is sent asynchronously.
 E.g. RecordConcessionFees() message is given diagram is an asynchronous message.

Page 122 of 200


Page 123 of 200
Q11. Explain with diagram create & destroy messages. (Description of create message with
diagram 2M, Description of destroy message with diagram 2M) [S16][4MKS]

Ans:

create message:

1. Objects can be created according to the requirement of the system in between the
processing of the system because they are not required for the entire duration of the
sequence diagram’s interaction.

2. If an object does not exist at the beginning of a sequence diagram then it must
be created in the system.

3. The UML shows creation by placing the object notation at the head of the arrow for the
message call that creates an object.

destroy message:

1. An object can destroy itself or it can be destroyed by other objects of the


sequence diagram because those objects may not further require during the system.

2. If the object is destroyed by itself then „X‟ is placed at the head of the call arrow that
destroys the object.

3. If the object destroys and returns control to another object then „X‟ is placed at the tail
of the return arrow.

Example:

Page 124 of 200


Q12. Explain structure control in sequence diagram for conditional and loop
execution.(Conditional Execution 3M, Loop Structure 3M OR Any Suitable Explanation 6M)

Ans: [W15][6MKS]

Structure control in sequence diagram:

It defines statements or group of statements in a diagram which determines the sequence of


execution of other instructions or statements.

1 : Conditional execution:

1. In sequence diagram conditional statements are used to check the condition.

2. Alt operator is used to check the condition in sequence diagram. The body of the
control operator is divided into multiple sub regions by horizontal dashed lines.

3. Each sub region represents one branch of a conditional. Each sub region has a guard
condition. If the guard condition for a sub region is true, the sub region is executed.

4. However, at most one sub region may be executed. If more than one guard condition is
true, the choice of sub region is nondeterministic and could vary from execution to
execution. If no guard condition is true, then control continues past the control
operator.

5. One sub region may have the special guard condition [else]. This sub region is
executed if none of the other guard conditions are true.

Example:

Page 125 of 200


2 : Loop:

1. The interaction operator loop means that the combined fragment represents a loop.

2. The loop operand will be repeated a number of times.

3. The loop construct represents a recursive application of the seq operator where the loop
operand is sequenced after the result of earlier iterations.

4. Loop could be controlled by either or both iteration bounds and a guard.

5. Loop operand could have iteration bounds which may include a lower and an
upper number of iterations of the loop.

6. If loop has no bounds specified, it means potentially infinite loop with zero as
lower bound and infinite upper bound.

7. If only min-int is specified, it means that upper bound is equal to the lower bound, and
loop will be executed exactly the specified number of times.

8. If min and max bounds for the loop are specified then loop will exactly execute that
number of times.

Page 126 of 200


Q13. Draw sequence diagram for:-

1) Printing a file.(Any relevant sequence diagram with proper notation - 8 Marks )

Ans: [W9,S15][8MKS]

Page 127 of 200


2) Placing purchase order.(Any relevant diagram - 8 Marks )

Ans: [W9,S12,S15][8MKS]

Page 128 of 200


3) Receiving and returning book in library system. [S10][4MKS]

Ans:

Page 129 of 200


4) Printing semester and exam mark sheet by student from MSBTE website. [W13][4MKS]

Ans:

5) i) Voter card Application system.

Ans:

Page 130 of 200


ii) Making a telephone call. [W14][4MKS]

Ans:

Page 131 of 200


6) Student admission.

Ans:

Page 132 of 200


7) Student registration system. [S16][4MKS]

Ans:

Page 133 of 200


8) ATM session.(Correct Sequence Diagram of ATM 4M: Any Relevant diagram shall be
considered) [S16][4MKS]

Ans:

Page 134 of 200


Q14. What is behavioral modeling.(Any relevant description of behavioral modeling 4M)

Ans: [S16][4MKS]

Behavioral modeling:

It indicates how software will respond to external events or stimuli. In behavioral model,
the behavior of the system is represented as a function of specific events and time.

To create behavioral model following things can be considered:

1. Evaluation of all use-cases to fully understand the sequence of interaction within


the system.
2. Identification of events that drive the interaction sequence and understand how
these events relate to specific classes.
3. Creating sequence for each use case.
4. Building state diagram for the system.
5. Reviewing the behavioral model to verify accuracy and consistency.

It describes interactions between objects. It shows how individual objects collaborate to


achieve the behavior of the system as a whole. In UML behavior of a system is shown with
the help of use case diagram, sequence diagram and activity diagram

1. A use case focuses on the functionality of a system i.e. what a system does for users. It
shows interaction between the system and outside actors. Ex: Student, librarians are
actors, issue book use case.
2. A sequence diagram shows the objects that interact and the time sequence of
their interactions. Ex: Student, librarians are objects. Time sequence enquires for book
check availability – with respect time.
3. An activity diagram specifies important processing steps. It shows operations required
for processing steps. It shows operations required for processing. Ex: issue book, check
availability does not show objects.

Page 135 of 200


CHP.4 ADVANCED BEHAVIORAL MODELING
Q1. Explain the following terms under activity diagram:- [W12][4MKS]

1) States

2) Branching

Ans: [4.1.1]

1) States:

2) Branching:

[same as Ans 3) ii ]

Page 136 of 200


Q2. Draw and state (explain) notations used in activity diagram.(Any 4 Notations – 1 M each)

Ans: [W15,S16][4MKS]

Notations used in activity diagram:

Page 137 of 200


Q3. i)Describe “Branching” in activity diagram. (same as below)
[W9,W13,W14,S15,S16][4MKS]

ii) Explain decision (Branching) in activity diagram.(Explanation of branching – 2 Marks,


Suitable diagram – 2 Marks) [S15][4MKS]

Ans:

Branching:

Branches are notational convenience, equivalent to multiple transitions with guards. A


branch may consist of one incoming transition and two or more outgoing transitions,
you can place a Boolean expression, which is evaluated only once on entering the
branch. Across all these outgoing transitions, guards should not overlap (otherwise, the
flow of control would be ambiguous), but they should cover all possibilities (otherwise the
flow of control would freeze.) You can use the keyword else to mark one outgoing
transition, representing the path taken if no other guard expression evaluates to true.
You can achieve the effect of iteration by using one action state that sets the value of
an iteration, another action state that increment the iteration, and a branch that evaluates
of the iteration is finished.

Page 138 of 200


iii) Explain decision making and branching in activity diagram.(Relevant explanation with
example 4M) [S16][4MKS]

Ans:

Decision Making and Branching:

1. In an activity diagram, Diamond Shape is used for Decision and branches are
represented by lines. The condition written in diamond is the decision criteria.

2. A branch may have one incoming transition and two or more outgoing ones.

3. On each outgoing transition, we place a Boolean expression, which is evaluated only once
on entering the branch.

4. We can use the keyword else to mark one outgoing transition, representing the
path taken if no other guard expression evaluate to true.

5. When two paths of control merge back together, we can also use a diamond
symbol with two input arrow and one output arrow. No guards are necessary on merge.

Notation:

Example:

Page 139 of 200


Q4. Explain decision making and branching in activity diagram. Draw activity diagram for
book return in library management system. [W15][8MKS]

(Explanation of Decision Making and Branching-4 Marks; activity diagram for book return in
library management system with correct notations-4 Marks)Note: Any other activity
diagram for book return in library management system shall be considered.

Ans:

Decision Making and Branching:

 In an activity diagram, Diamond Shape is used for Decision and branches are
represented by lines. The condition written in diamond is the decision criteria.
 A branch may have one incoming transition and two or more outgoing ones.
 On each outgoing transition, we place a Boolean expression, which is evaluated only
once on entering the branch.
 We can use the keyword else to mark one outgoing transition, representing the path
taken if no other guard expression evaluate to true.
 When two paths of control merge back together, we can also use a diamond symbol
with two input arrow and one output arrow. No guards are necessary on merge.
 We can achieve iteration by using one action that sets the values of an iterator,
another action that increments the iterator, and a branch that evaluates if the
iteration is finished.
 The UML include node types for loops, but these may often be expressed more easily
in text than in graphics.

Page 140 of 200


Activity diagram for book return in library management system:

Page 141 of 200


Q5. [W9,W13,W14,S15,W15,S16][4MKS]

i) Describe forking and joining in activity diagram. (Explanation of Join min. 2 points – 2
Marks, Explanation of Fork min. 2 points - 2 Marks) [W15][4MKS]

Ans: Join: A join may represent the synchronization of two or more concurrent flows of
control. A join can have two or more incoming transitions and one outgoing transition.
Above the join, the activities associated with each of these paths continue in parallel.
At the join, the concurrent flows synchronize, meaning that each waits until all
incoming flow have reached the join, at which point one flow of control continues below
the join. The notation for a join is a line segment with several activity edges entering it, and
only one edge leaving it.

Fork: A fork can represent the splitting of a single flow of control into two or more
concurrent flows of control. A fork can have one incoming transition and two or more
outgoing transitions, each of which represents an independent flow of control. Below the
fork, the activities associated with each of these paths continue in parallel i.e.
concurrently.The notation for a fork is a line segment with a single activity edge entering it,
and two or more edges leaving it.

Joins and forks should always balance. It means that the number of flows that are going out
from a fork should match the number of flows that are coming into its corresponding join.

E.g. Join and Fork:

Page 142 of 200


ii) Describe Join and Fork operations in activity diagram with example. [W15][4MKS]

(Explanation with example of Join 2M, Explanation with example of Fork 2M)Note: Any
other example showing join and fork operations in activity diagram shall be considered

Ans:

Join in Activity diagram:

1. A join in Activity diagram represents the synchronization of two or more concurrent


flows of control.

2. A join may have two or more incoming transitions and one outgoing transition.

3. Above the join, activities associated with each of these paths continue in parallel.

4. At the join, the concurrent flows synchronize, means each waits until all incoming flows
have reached at the join, at which point one flow of control continues on below the join.

Fork in Activity diagram:

1. A fork in activity diagram represents the splitting of a single flow of control into two or
more concurrent flows of control.

2. A fork may have one incoming transition and two or more outgoing transitions, each of
which represents an independent flow of control.

3. Below the fork, the activities associated with each of these paths continue in
parallel.

Example:

Page 143 of 200


In the above example there are two forks and two joins. Joins and forks should balance,
meaning that the number of flows that leave a fork should match the number of flows that
enter its corresponding join.

iii) Explain forking and joining with diagram.(Relevant explanation of forking with diagram
2M, joining with diagram 2M) [S16][4MKS]

Ans:

Forking in Activity diagram:

1. A fork in activity diagram represents the splitting of a single flow of control into two or
more concurrent flows of control.

2. A fork may have one incoming transition and two or more outgoing transitions, each of
which represents an independent flow of control.

3. Below the fork, the activities associated with each of these paths continue in parallel.

Joining in Activity diagram:

1. A join in Activity diagram represents the synchronization of two or more


concurrent flows of control.

2. A join may have two or more incoming transitions and one outgoing transition.

3. Above the join, activities associated with each of these paths continue in parallel.

4. At the join, the concurrent flows synchronize, means each waits until all incoming flows
have reached at the join, at which point one flow of control continues on below the join.

Example:

[same as above]

Page 144 of 200


Q6. Explain the swim lane activity diagram with one example.

(Explanation 2M, Diagram/example 2M) [W15][4MKS]

Ans:

Swim lane:

1. In activity diagram, activity states are partitioned into groups. Each group represents the
entity responsible for those activities. Each group is called as swim lane because visually
each group is divided by a line from its neighbor.

2. A swim lane specifies a locus of activities.

3. Each swim lane has a unique name within its diagram. It represents some real world
entity.

4. Each swim lane represents a high level responsibility for part of the overall activity of an
activity diagram and each swim lane may eventually be implemented by one or more
classes.

5. In an activity diagram partitioned into swim lane, every activity belongs to exactly on
swim lane, but transitions may cross lanes.

Example:

In above diagram we can observe three groups (entities): Customer, sales and Warehouse
Customer performs request product, receive order and pay bill activity.

Page 145 of 200


Q7. Draw activity diagram for:-

1) Issuing book to student: [S11,W14][4MKS]

Ans:[4.1.3 1) ]

Page 146 of 200


2) Draw an activity diagram to print receipt of one transaction in ATM (ATM system).

(Activity Diagram to print receipt of one transaction in ATM with correct notations-4
Marks)Note: Any other Activity Diagram to print receipt of one transaction in ATM shall be
considered.

Ans: [W12,W15][4MKS]

Page 147 of 200


3) Draw activity diagram for making photocopies of Xerox machine.(Any relevant diagram -8
Marks ) [W13,S15][8MKS]

Ans:

Page 148 of 200


4) Draw activity diagram to purchase books from supplier in library(purchasing book from
library). [W15][4MKS]

(Activity diagram for purchase book from supplier in library with correct notations
4M)(Note: Any other activity diagram showing purchase book from supplier in library shall
be considered.)

Ans:

Activity diagram to purchase book from supplier in library

Page 149 of 200


5) Draw activity diagram for book return in library management system: [+ Q4) = 8mks]
[W15][8MKS]

Page 150 of 200


6) Draw activity diagram for online restaurant system for place order.(Correct activity
diagram showing process for online restaurant system for placing order-4M: Any
relevant diagram shall be considered) [S16][4MKS]

Ans:

7) Draw activity and state diagram for online reservation system.(Activity Diagram 4 M;
State Diagram 4 M; any relevant diagram shall be considered) [S16][8MKS]

Ans: 1. Activity Diagram:

Page 151 of 200


2. State Diagram for online reservation system:

8) Draw activity diagram with swimlane for online purchase order. (Correct activity diagram
for online purchase order 4M; Any Relevant diagram shall be considered) [S16][4MKS]

Ans:

Page 152 of 200


Q8. What is importance of nested activity diagram?(Explanation 2M, suitable example 2M)

Ans: [W15][4MKS]

Nested Activity diagram:

1. Nested activity diagram contains an activity diagram inside an activity.

2. Nested activity state may reference another activity diagram that shows the
internal structure of the activity state.

3. It shows the sub graph (sub activity) inside of the activity state which refers to
another diagram. Sub activity can be reused as independent activity.

4. Nested activity diagram gives the result of its activities to the activity in which it resides.

Structure:

Example:

Page 153 of 200


Q9. i) What is state diagram? Explain.(Correct explanation with minimum 4points – 4 Marks)

Ans: [S15][4MKS]

State diagram:

The name of the diagram itself clarifies the purpose of the diagram and other details.
It describes different states of a component in a system. The states are specific to a
component/object of a system. A State diagram describes a state machine. Now to clarify it
state machine can be defined as a machine which defines different states of an object and
these states are controlled by external or internal events. State diagram is one of the five
UML diagrams used to model dynamic nature of a system. They define different states of an
object during its lifetime. And these states are changed by events. So, State diagrams
are useful to model reactive systems. Reactive systems can be defined as a system
that responds to external or internal events. State diagram describes the flow of control
from one state to another state. States are defined as a condition in which an object exists
and it changes when some event is triggered. So the most important purpose of State
diagram is to model life time of an object from creation to termination. State diagrams
are also used for forward and reverse engineering of a system. But the main purpose is
to model reactive system.

Following are the main purposes of using State chart diagrams:

 To model dynamic aspect of a system.


 To model life time of a reactive system.
 To describe different states of an object during its life time.
 Define a state machine to model states of an object.

Page 154 of 200


E.g. of State Diagram:

Page 155 of 200


ii) Explain state, event, action, and activity with respect to state chart diagram. [W14][4MKS]

(Explanation of each point with example or notation - 1 Mark each)

Ans:

State:

Represents the state of object at an instant of time. State represents a discrete,


continuous segment of time wherein the object’s behavior will be stable. The object will
stay in a state until it is stimulated to change by an event. Denoted by a rectangle with
rounded corners and compartments. Changes in the system that occur background
thread while the main process is running, are called sub states.

Event:

events are those which represent external response. An event is an instant in time that may
be significant to the behavior of the objects in a class. Events can have associated
arguments.

Notation: Events are written simply as text strings.

Action:

Actions is used to specify the functional(transformational / computational) behavior of


objects in a class. An Action is the UML way to specify that some discreteamount of
work gets done as an object makes a transition. The work is expected to be a oneshot
computation
Page 156 of 200
Notation: Append “/action-name” to the “event*guard+” for every transition that has
an action.

Action states cannot be decomposed. Action states are atomic, meaning that events may
occur, but the work of an action state is not interrupted. The work of an action state as a
special case of an activity case of an activity state that cannot be further decomposed.

Activity:

An Activity is the UML way to specify that some relatively long-term amount of work gets
done while an object is in a state. - The work is continuous and interruptible (it stops when
you exit the state)

Notation: Compartmentalize the state- Include “do/activity-name” in the lower


compartment of every state that has an activity.

Activity state can be further decomposed, and their activity being represented by other
activity diagrams. Activity states are not atomic. An activity state as a composite, whose
flow of control is made up of other activity states and action states.

Page 157 of 200


iii) Write note on state chart diagram. [W14,S15][4MKS] (Correct explanation with min.
4points – 4 Marks)

Ans:

State chart diagram:

 The name of the diagram itself clarifies the purpose of the diagram and other details.
 It describes different states of a component in a system. The states are specific to a
component/object of a system.
 A State chart diagram describes a state machine. Now to clarify it state machine can be
defined as a machine which defines different states of an object and these states are
controlled by external or internal events.
 State chart diagram is one of the five UML diagrams used to model dynamic nature of
a system.
 They define different states of an object during its lifetime. And these states are
changed by events. So ,State chart diagrams are useful to model reactive systems.
Reactive systems can be defined as a system that responds to external or internal
events.
 State chart diagram describes the flow of control from one state to another state.
States are defined as a condition in which an object exists and it changes when some
event is triggered. So the most important purpose of State chart diagram is to model
life time of an object from creation to termination.
 State chart diagrams are also used for forward and reverse engineering of a system.
But the main purpose is to model reactive system.

Following are the main purposes of using State chart diagrams:

1) To model dynamic aspect of a system.


2) To model life time of a reactive system.
3) To describe different states of an object during its life time.
4) Define a state machine to model states of an object.

Page 158 of 200


E.g of State chart Diagram:

Page 159 of 200


Q10. [S12,W13,S15,W15,S16][4MKS]

i) What are the components of a state chart diagram?(Any four Components with its use 1
Mark each ) [S15,W15][4MKS]

Ans:

Page 160 of 200


Page 161 of 200
ii) Draw and state notations for the state chart diagram.(Any four notation: each 1M)

Ans: [W15][4MKS]

State chart diagram:

A state chart diagram shows flow of control from one state to another state.

Notations:

Page 162 of 200


iii) Enlist various notations in state diagram. Explain state.(Any three correct notations of
state diagram 1M each, Explanation of state 1M) [S16][4MKS]

Ans:

State:

A state is a condition or a situation in the life of an object during which it satisfies some
conditions, performs some activity or waits for some events. It is represented with a
rounded rectangle. Name of the state is written inside the rectangle.

Various notations in State diagram are:

{ [Q10) ii ] Only (listing) name and symbol }

iv) Explain transition and their types. [W12][4MKS]

Ans:

Transitions:

An arrow indicating the object to transit from state to the other. The actual trigger event
and action causing the transition are written besides the arrow separate by slash.
Transitions that occur because the state completed an activity are called trigger less
transitions. If an event has to occur after the completion of some event or action, the
event or action is called the guard condition. The transition takes event or action, the
event or action is called Guard condition. The transition takes place after the guard
condition occurs. This guard condition/event/action is depicted by square brackets [ ]
around the description of the event/action (in other word, in the form of a Boolean
express in). An action is atomic, meaning that it cannot be interrupted by an event and
therefore runs to completion. This is in contrast to an activity, which may be interrupted
by other events. Events may include signals, calla, and passing of time or change in state.

Symbol :

Page 163 of 200


Q11. i) Explain sequential sub state with example.(Explanation-2 Marks, Example – 2 Marks )

Ans: [S15][4MKS]

Sub state:

1. A sub state is a state that’s nested inside another one.


2. A state that has sub states is called a composite state.
3. A composite state may contain either concurrent (orthogonal) or sequential (disjoint) sub
states.
4. Sub states may be nested to any level.

Sequential Sub states:

1. Sequential Sub states are those sub states in which an event common to the composite
states can easily be exercised by each states inside it at any time.
2. sequential sub states partition the state space of the composite state into disjoint states.
3. Below Figure shows Sequential Sub states.
4. A nested sequential state machine may have at most one initial state and one final state.

Consider the problem of modeling the behavior of an ATM. This system might be in one of
three basic states: Idle (waiting for customer interaction), Active (handling a
customer's transaction), and Maintenance (perhaps having its cash store replenished). While
Active, the behavior of the ATM follows a simple path: Validate the customer, select a
transaction, process the transaction, and then print a receipt. After printing, the ATM
returns to the Idle state. You might represent these stages of behavior as the states
Validating, Selecting, Processing, and Printing. It would even be desirable to let the
customer select and process multiple transactions after Validating the account and before
Printing a final receipt.

Page 164 of 200


ii) Describe the concept of concurrent sub-state with respect to state diagram.(Description of
concurrent state with example 4M) [S16][4MKS]

[NESTED STATE/CONCURRENT/COMPOSITE SATE DIAGRAM ]

Ans:

Concurrent state diagram shows a set of independent behaviors of an object.


Concurrent sub states are independent and can execute in parallel. A state may be divided
into regions containing sub-states that exist and execute concurrently. UML shows
concurrency within an object by partitioning the composite / state into regions with
dotted lines.

Example:-

In the above example, concurrent sub states are shown. Maintenance is a composite state. It
is decomposed into two concurrent sub-states as testing and commanding. Each of these
concurrent sub-states is further decomposed into sequential sub-states. When control
passes from Idle to Maintenance state, control then forks to two concurrent flows.
Execution of these two concurrent sub-states continues parallel in the system. Each nested
state machine reaches its final state. If one concurrent sub state reaches its final state
before the other, then control in that sub-state waits at its final state. When both
nested state reaches their final state, control from the two concurrent sub-states joins
back into one flow.
Page 165 of 200
Q12. i) Draw and explain state chart diagram for ATM.(Any Relevant state chart diagram for
ATM with proper notation - 5 Marks & Explanation -3 Marks ) [S15][8MKS]

Ans:

Steps for Building a state chart diagram for ATM.

1. Prepare a state diagram for each object class with non-trivial dynamic behaviour
showing the events the object receives and sends.

2. Every scenario or event trace corresponds to a path through the state diagram.
State chart diagram for ATM

3. Each branch in Control flow is represented by a state with more than one exit transition.

In ATM, system might be in one of three basic states:

I. Idle ( Waiting for customer interaction)

II. Active ( Handling a customer’s interaction)

III. Maintenance ( Perhaps having its cash store replenished)

While Active, the behavior of the ATM follows a simple path: Validate the customer,
select transaction, process transaction & print a receipt. After printing, the ATM returns to
idle state. We represent these stages of behavior as the states Validating, Selecting,
processing & Printing. It would be desirable to let customer select & process multiple
transaction after validating the account & before Printing Final receipt.

The state of ATM changes from Idle to Active when customer enters a credit card in
machine. On entering Active state, entry action read card is performed. Starting with
initial state of substructure, control passes to validating state, then selecting state & then
to processing state.

After processing, control may return to selecting (if customer has selected another
transaction) or it may move on to printing. After printing there’s a complete transaction
back to idle state. Active state has an exit action, which ejects customer’s card.

Page 166 of 200


Page 167 of 200
ii) Draw state diagram for railway reservation system.

Ans:

Page 168 of 200


CHP.5 ARCHITECTURAL MODELING
Q1. What is meant by architectural modeling?(Description 2 M; Diagram 2M) [S16][4MKS]

Ans:

[chp1. Q14) ]

Q2. i)Describe component diagram with example. [W14][4MKS]

(Description - 2 Marks, Example - 2 Marks)

Ans:

 A component diagram shows the organization and dependencies among a set of


components.
 One can use component diagrams to model the static implementation view of a
system.
 This involves modeling the physical things that reside on a node, such as
executables, libraries, tables, files, and documents. Component diagrams are
essentially class diagrams that focus on a system's components.
 Component diagrams are not only important for visualizing, specifying, and
documenting component-based systems, but also for constructing executable systems
through forward and reverse engineering.
 With the UML, one can use component diagrams to visualize the static aspect of
these physical components and their relationships and to specify their details for
construction.
 A component diagram shows a set of components and their relationships.
 Graphically, a component diagram is a collection of vertices and arcs.

Page 169 of 200


Component diagrams commonly contain:-

1. Components

2. Interfaces

3. Dependency, generalization, association, and realization relationships

 You use component diagrams to model the static implementation view of a system. This
view primarily supports the configuration management of a system's parts, made up of
components that can be assembled in various ways to produce a running system.
 When you model the static implementation view of a system, you'll typically use
component diagrams in one of four ways.

1. To model source code

2. To model executable releases

3. To model physical databases

4. To model adaptable systems

 One example of component diagram: - Any diagram can be considered.

Page 170 of 200


ii) What are different notations used for components diagram? Explain.(listing of notations -
1Mark, Explanation notations with diagram- 2Marks, diagram- 1 Mark) [S15][4MKS]

Ans:

1.Component:

A component is a logical unit block of the system, a slightly higher abstraction than classes.
It is represented as a rectangle with tabs, usually including only its name. A component icon
is a rectangle with two smaller rectangles jutting out from left-hand side. This symbol is
visual stereotype.

2.Interface:

A component can be connected with other components through interfaces. An interface


(small circle or semi-circle on a stick) describes a group of operations used (required) or
created (provided) by components. A full circle represents an interface created or provided
by the component. A semi-circle represents a required interface, like a person's input.

Page 171 of 200


3.Dependencies:

A dependency exists between two elements if changes to the definition of one element may
cause changes to the other. It represented as dotted arrow as shown in figure.

[4,5,6 – components Q2(iii) ]

Page 172 of 200


iii) What is component? Is component replaceable? Explain why. [W15][8MKS]

Draw all notations necessary to draw component diagram.(Defining component-2 Marks,


explanation of component replacement-2Marks;Any Four Notations: 1 Mark each)

Ans:

Component:

 A component is a physical and replaceable part of a system that conforms to


and provides the realization of a set of interfaces. A component is rendered as a
rectangle with tabs.
 A component has its behavior defined in terms of provided interfaces and required
interfaces (potentially exposed via ports).
 Larger pieces of a system’s functionality may be assembled by reusing components as
parts in an encompassing component or assembly of components, and wiring
together their required and provided interfaces.
 A component is modeled throughout the development life cycle and
successively refined into deployment and run-time. A component may be
manifested by one or more artifacts.
 Indirectly instantiated component is defined at design time but does not exist
as addressable object at execution time.
 Runtime behavior of the component and its ports is defined by the runtime behavior
of classifiers or parts realizing it. Several standard stereotypes assume this attribute,
e.g., «specification», «focus», «subsystem».

Is Component Replaceable?

1. A component is replaceable. A component is substitutable-it is possible to replace a


component with another that conforms to the same interface.
2. A mechanism of inserting or replacing a component to form a run time system is
transparent to the component user and is enabled by object models that require little or
no intervening transformation or by tools that automate the mechanism.

Page 173 of 200


Notations of Component Diagram:

1. Component:

A component is a logical unit block of the system, a slightly higher abstraction than classes.
It is represented as a rectangle with tabs, usually including only its name. A
component icon is a rectangle with two smaller rectangles jutting out from left-hand side.
This symbol is visual stereotype.

2.Interface:

A component can be connected with other components through interfaces. An interface


(small circle or semi-circle on a stick) describes a group of operations used (required) or
created (provided) by components. A full circle represents an interface created or provided
by the component. A semi-circle represents a required interface, like a person's input.

Page 174 of 200


3. Dependencies:

A dependency exists between two elements if changes to the definition of one element may
cause changes to the other. It represented as dotted arrow as shown in figure.

Page 175 of 200


4. Port:

Ports are represented using a square along the edge of the system or a component. A port is
often used to help expose required and provided interfaces of a component.

5. Connector:

It is a link that specifies communication between two or more classifiers. Delegation


connector is used to connect internal parts of component with the interface provided by
component. Assembly connector shows that a component requires an interface that
another component provides.

6. Artifact:

An artifact is a physical file that executes or used by the software. It includes


executable files, library files, source files and configuration files.

Page 176 of 200


iv) What is the concept of component diagram and notations.(Concept of component
diagram-2M, any two notations-1 M each) [S16][4MKS]

Ans:

A component diagram shows the organization and dependencies among a set of


components. Component diagram addresses the static implementation view of a
system. It specifies set of components and their relationships. It involves modeling the
physical things that reside on a node are represented as component such as executables,
libraries, tables, files and documents.

Notations of Component Diagram:

[same as Q2 (iii) ]

v) Explain concept of interface and ports.(Relevant explanation of interfaces 2M, ports 2M)
[S16][4MKS]

Ans:

[Q2 (iii) 2,4 ]

Q3. Draw component diagram for:- [5.1.2 (1,2,3,4)]

i) Library management system: [W10,S12][4MKS]

Ans:

Page 177 of 200


ii) Atm system: [W13][4MKS]

Ans:

Page 178 of 200


iii) Railway reservation system: [W14][4MKS]

Ans:

Page 179 of 200


iv) Ordering processing: [S16][4MKS]

Ans:

Page 180 of 200


Q4.i) Describe deployment diagram, terms and concept. [W14][4MKS]

(Correct explanation with min. 4points – 4 Marks)

Ans: Deployment diagrams:

 Deployment diagrams are used to visualize the topology of the physical


components of a system where the software components are deployed.
 So deployment diagrams are used to describe the static deployment view of a
system.
 Deployment diagrams consist of nodes and their relationships.
 The name Deployment itself describes the purpose of the diagram. Deployment
diagrams are used for describing the hardware components where software
components are deployed.
 Component diagrams and deployment diagrams are closely related.
 So most of the UML diagrams are used to handle logical components but deployment
diagrams are made to focus on hardware topology of a system.
 Deployment diagrams are used by the system engineers.

The purpose of deployment diagrams can be described as:

1) Visualize hardware topology of a system.


2) Describe the hardware components used to deploy software components.
3) Describe runtime processing nodes.

Page 181 of 200


ii) How deployment diagram are useful? Explain with suitable example. [S10][4MKS]

Ans: [Q4)(ii), Q5(i,ii)]

Q5.i) Describe notations used for deployment diagram.(Description- 2 Marks, Notations- 2


Marks) [S15][4MKS]

Ans:

A deployment is a dependency relationship which describes allocation (deployment) of an


artifact to a deployment target. Deployment could be also defined at instance level - as
allocation of specific artifact instance to the specific instance of deployment target.

Node is a deployment target which represents computational resource upon which artifacts
may be deployed for execution.

Node is shown as a perspective, 3-dimensional view of a cube.

Application Server Node

Nodes can be interconnected with communication paths. Communication paths can be


defined between nodes such as application server and database server to define the
possible communication paths between the nodes. Specific network topologies can then be
defined through links between node instances.

Node is specialized by:

1. device
2. execution environment

Execution environment is usually part of a general node or «device» which represents the
physical hardware environment on which this execution environment resides. Execution
environments can be nested (e.g., a database execution environment may be nested in an
operating system execution environment).

Page 182 of 200


Several execution environments nested into server device.

Device

 A device is a node which represents a physical computational resource with processing


capability upon which artifacts may be deployed for execution.
 A device is rendered as a node (perspective, 3-dimensional view of a cube) annotated
with keyword «device».

Application Server device

 A communication path is association between two deployment targets, through which


they are able to exchange signals and messages.
 Communication path is notated as association, and it has no additional notation
compared to association.

 Communication path between several application servers and database servers.


Page 183 of 200
ii) Draw the symbols in deployment diagram and state use of it.(Any Four important Symbols
with its use- 4 Marks ) [S15][4MKS]

Ans:

Page 184 of 200


Page 185 of 200
Page 186 of 200
Q6. Define node. Draw notation. Explain use of deployment diagram. (Definition of node -
1M, notation-1 Marks; Use of Deployment diagram-2 Marks) [W15][4MKS]

Ans:

Node:

1. Nodes, just like artifacts, are an important building block in modeling the physical
aspects of a system.
2. A node is a physical element that exists at run time and represents a computational
resource, generally having at least some memory and often processing capability.
3. Node can be used to model the topology of the hardware on which the system
executes. A node typically represents a processor or a device on which artifacts may be
deployed.

Notation:

Usage of deployment diagrams can be described as follows:

1. To model the hardware topology of a system.


2. To model embedded system.
3. To model hardware details for a client/server system.
4. To model hardware details of a distributed application.
5. Forward and reverse engineering.

Page 187 of 200


Q7. Draw deployment diagram for:- [5.2.2 (1,2,3,4) ]

i) Internet and network connection:

Ans:

ii) To show a communication between application server and database server through IIs
server:

Ans:

Page 188 of 200


iii) ATM:

Ans:

iv) Hospital management system: [W9,S11][4MKS]

Ans:

Page 189 of 200


REMAINING IMPORTANT ANSWERS:-
Q1. Explain forward and reverse engineering.(Forward engineering explanation – 2 Marks,
Reverse engineering explanation - 2 Marks)(Any Relevant Explanation- 4 Marks)

Ans: [S14][4MKS]

Forward Engineering:

1. Forward engineering is the process of transforming a model into code through a mapping
to an implementation language.

2. Forward engineering results in a loss of information, because models written in the UML
are semantically richer than nay current object-oriented programming language. Hence
models are used in addition to the code.

3. Structural features such as collaborations and behavioral features such as interaction can
be visualized clearly in the UML but not so clearly from raw code.

Reverse Engineering:

1. Reverse engineering is the process of transforming code into a model through a mapping
from a specific implementation language.

2. Reverse engineering results in information, some of which is at a lower level of detail


than we will need to build useful models. At the same time, reverse engineering is
incomplete.

3. There is a loss of information when forward engineering models into code, and we
can’t completely recreate a model from code unless our tools encode information in
the source comments that goes beyond the semantics of the implementation language.

Page 190 of 200


Q2. How will you be modeling non-software things?(Any Relevant Explanation – 4 Marks)

Ans: [S14][4MKS]

Non software things are modeled in following ways:

1. Model the things that are abstracted as a class.

2. If we want to distinguish these things from the UML’s defined building blocks, we create
a new building block by using stereotypes to specify these new semantics and to give
a distinctive visual cue.

3. If the thing we are modeling is some kind of hardware that itself contains
software, we consider modeling it as a kind of node, as well, so that we can further expand
on its structure.

Page 191 of 200


Q3. Explain common modeling techniques used in component diagram and deployment
diagram.(Modeling techniques in component diagram – 2 Marks, Modeling techniques in
deployment diagram - 2 Marks)(Any relevant explanation - 4 Marks)

Ans: [S14][4MKS]

Common modeling techniques used in Component Diagram are:

1. Modeling Source Code : Identify the set of source code files of interest and model them as
components.

2. Modeling an Executable Release :Identify the set of components.

3. Modeling a Physical Database: Identify the classes that represent our logical database
schema.

4. Modeling Adaptable Systems : Consider the physical distribution of the components that
may migrate from node to node.

5. Forward and Reverse Engineering : Forward means the creation of code from model and
Reverse means the creation of models from code.

Common modeling techniques used in Deployment Diagram are:

1. Modeling an Embedded System: Identify the devices and nodes that are unique to a
system.

2. Modeling a Client/Server System: Identify the nodes that represent system’s client and
server processors.

3. Modeling a Fully Distributed System: Identify system’s devices and processors as for
simpler client/server systems.

4. Forward and Reverse Engineering: Forward means the creation of code from model and
Reverse means the creation of models from code.

Page 192 of 200


Q4. Explain modeling a flow control. (Any relevant Explanation- 8 Marks)

Ans: [S14][8MKS]

Modeling flow of control:

1) Modeling flow of control by time ordering:

To model a flow of control that flows through objects and roles, interaction diagram is used.
To emphasize the passing of messages sequence diagram is used.

To model flow of control by time ordering,

1. Set the context for the interaction, whether it is a system, subsystem, operation, or class,
or one scenario of a use case or collaboration.
2. Set the stage for the interaction which objects play a by identifying which objects play a
role in the interaction.
3. Set the lifeline for each object.
4. Starting with the message that initiates this interaction, lay out each subsequent message
from top to bottom between the lifelines, showing each message’s properties, as
necessary to explain the semantics of the interaction.
5. To visualize the nesting of messages adorn each object’s lifeline with it’s focus of control.
6. To specify time or space constraints, adorn each message with a timing mark and attach
suitable time or space constraints.
7. To specify flow of control more formally, attach pre and post conditions to each message.

Page 193 of 200


2) Modeling flow of control by organization:

To show the passing of messages in the context of that structure, collaboration diagram is
used.

To model a flow of control by organization,

1. Set the context for the interaction, whether it is a system, subsystem, operation, or a
class, or one scenario of a use case or collaboration.
2. Set the stage for the interaction by identifying which objects play a role in the
interaction.
3. Set the initial properties of each of these objects.
4. Specify the links among these objects, along which messages may pass. Lay out
association link first then other links next and adorn with the suitable path stereotypes.
5. Starting with the message that initiates this interaction, attach each subsequent message
to the appropriate link, setting its sequence number as appropriate. Show nesting by
using decimal numbering.
6. To specify time or space constraints, adorn each message with a timing mark and
attach suitable time or space constraints.
7. To specify flow of control more formally, attach pre and post conditions to each message.

Page 194 of 200


Q5. What are sequence diagram and collaboration diagram and explain with example.
(Minimum 6 points each points carry – 1 ½ Marks)

Ans: [S14][6MKS]

Page 195 of 200


Q6. Give an overview of CRC card method. What is the use of CRC card?(Concept of CRC
method & Card format – 3 Marks, Use of CRC card – minimum 2 points -1 Mark)

Ans: [S13,S14][4MKS]

Class Responsibility Collaboration(CRC) cards are a brainstorming tool used in the


design of object-oriented software. they were proposed by Ward Cunnigham and Kent
Beck. they are typically used when first determining which classes are needed and how
they will interact.

CRC cards are usually crated from index cards on which there are written:

1. The class name

2. Its Super and Sub classes (if applicable)

3. The responsibilities of the class.

4. The names of other classes with which the class will collaborate to fulfill its
responsibilities.

5. Author.

Page 196 of 200


With the help of clear requirement analysis you can create simple, easy to understand & use
to prepare model, UML diagrams.

 An alternative to use case modeling is to write a requirements document that declares


what the system will have to do.
 The goal of the requirement analysis is to fully specify the problem and application
domain without introducing a bias to any particular implementation. There is no absolute
line between the various design phases, nor is there any such thing as a perfect analysis.
 The requirement analysis gives proper defined data for model to be an effective
means of communication with application experts who may not be computer expert.
 CRC (Class-Responsibility-Collaborator)card modeling is a simple yet powerful object
oriented analysis technique.
 Their main purpose is to teach programmers the Object-oriented paradigm.
 CRC modeling includes the user, analysts, and developers in a modeling and design
process, bringing together the entire development ream to form a development team to
form a common understanding of an OO development project.
 It is one of many tools that should be used in the collaborative design of used in
the collaborative design of a system.

Advantages of CRC in analyzing system requirement.

1. the class, you make it easier talk through the designs.


2. use of CRC Cards helps to explore an Interaction between classes, typically to show how a
scenario is implemented. once you’ve figured out how the interaction works, you
can document it with interaction diagram.
3. Use responsibilities to help you summaries the key responsibilities of class. they are
useful in highlighting different classes.

Page 197 of 200


Q7. How will you model behavior of an element? (Any relevant explanation – 4 Marks)

Ans: [S14][4MKS]

Behavior of an element is modeled in following ways:

1. We identify actors that interact with the element. Candidate actors include groups that
require certain behavior to perform their tasks or that are needed directly or indirectly to
perform the element’s functions.
2. We organize actors by identifying general and more specialized roles.
3. For each actor, we consider the primary ways in which that actor interacts with the
element. We also consider interactions that change the state of the element or it’s
environment or that involve a response to some event.
4. We also consider the exceptional ways in which each actor interacts with that element.
5. We organize these behaviors as use cases, applying include and extend relationships to
factor common behavior and distinguish exceptional behavior.

Page 198 of 200


Q8. Mention and explain any four properties of objects?(Any 4 relevant
properties/themes/features; For each- 1 Mark )

Ans:

Four Properties of Objects.

Object: An object is a real-world element in an object–oriented environment that may have


a physical or a conceptual existence.

Each object has:

 Identity that distinguishes it from other objects in the system.


 State that determines the characteristic properties of an object as well as the values of
the properties that the object holds.
 Behavior that represents externally visible activities performed by an object in terms of
changes in its state.
 Objects can be modeled according to the needs of the application.
 An object may have a physical existence, like a customer, a car, etc.; or an intangible
conceptual existence, like a project, a process, etc.

Q9. Write any four usage of UML.(1Mark for each use of UML)

Ans: [S13][4MKS]

Unified Modeling language is a standard language for writing software blueprints.It is very
expressive language addressing all the views needed to develop & them deploy such system
UML is language use for :-

1) Visualizing

2) Specifying

3) Constructing

4) Documenting

Page 199 of 200


Q10. How OOSE is helpful in terms of reusability. Discuss.(Explanation of OOSE-2M &
reusability explaination-2M= 4M)(Since OOSE is vast topic examiner use his/her judgment
and according reward marks)

Ans: About OOSE:- [S13][4MKS]

 OOSE : OOSE has a use case driven approach - In this approach, a use case model serves
as a central model from which all other models are derived. A use case model
describes the complete functionality of the system by identifying how everything that is
outside the system interacts with the system.
 The use case model is the basis in the development phases such as analysis,
construction (design and implementation) and testing.
 The aim of analysis is to understand the system according to its functional requirements.
The objects are found, organized and object interactions are described. The operations
of objects and the internal view of objects is described as well during analysis.
 Construction encompasses design and implementation in source code. It is
important that objects in the analysis phase can be found back during construction. This
is called traceability. Besides traceability, components are important during
construction. A component is an already defined piece of source code that can be used
for implementing objects.
 In testing the system is verified, meaning that the correctness of the system is
checked according to its specifications.

Reusability :

 Using OOSE technique referred by Ivar Jaccobson, we design the system in such a way
that modules of the current system can be directly adopted in designing new system.
 OOSE combines object-oriented programming & conceptual modeling concepts.
 From object-oriented programming, OOSE mainly uses the concepts of
encapsulation, inheritance and relationships between classes and instances.
 Conceptual modeling is used to create different models of the system or organization to
be analyzed with respect to dynamic behavior.
 The building blocks or objects can be reuse for designing a model for any application.
 By organizing the analysis and design models around sequences of user interaction and
actual usage scenarios, the method produces systems that are more robust and usable,
adapting more easily to changing usage.
 For reusability, documentation of all aspects (use case, building blocks, objects, classes,
etc) is required in each phase.
Page 200 of 200