0% found this document useful (0 votes)
17 views30 pages

B. Tech OOPs Test Questions 2023-24

The document is an examination paper for B. Tech students at ABES Engineering College, covering Object-Oriented Programming concepts and UML. It includes various questions on topics such as OOP principles, modeling, encapsulation, inheritance, and the advantages and disadvantages of UML. The test is structured into sections with specific marks allocated to each question.

Uploaded by

Kartik Mittal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views30 pages

B. Tech OOPs Test Questions 2023-24

The document is an examination paper for B. Tech students at ABES Engineering College, covering Object-Oriented Programming concepts and UML. It includes various questions on topics such as OOP principles, modeling, encapsulation, inheritance, and the advantages and disadvantages of UML. The test is structured into sections with specific marks allocated to each question.

Uploaded by

Kartik Mittal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ABES Engineering College, Ghaziabad

B. Tech Odd Semester Sessional Test-1

Printed Pages:
Session: 2023-24
Semester:
Course Code: Roll No.:
Course Name: Time: 1.15 Hrs.
Maximum Marks:
Instructions:
1. Attempt All sections.
2. If require any missing data, then choose suitably.

Q. No. Question Marks CO KL PI

Section-A 5 Marks Questions

1 What are the main differences between procedure-oriented languages and object-oriented 5 CO1
languages?
2 What are the basic OOPs principles? 5 CO1

3 Difference between Top down and bottom up approaches for a given project? 5 CO1

4 What do you meant by static and dynamic modeling? 5 CO1


5 Why do we need OOPs? 5 CO1

6 What is abstraction? 5 CO1

7 Using diagrams, explain the following concepts as applied in Object Oriented Analysis and 5 CO1
Design. Object, class, polymorphism, encapsulation and abstraction
8 Explain about object interaction and collaboration? 5 CO1

9 What is meant by object? How are these created? 5 CO1


10 5 CO1
What is inheritance? Discuss types of inheritance with example.

11
What is the difference between Multilevel and Muliple Inheritance?
12
List the advantage offered by object-oriented systems development.
13
What is an abstract class? Is it possible that an abstract class is inherited by another class?
Ans. An abstract class is a class that is declared abstract-it may or may not include abstract
methods. Abstract classes cannot be instantiated, but they can be subclassed. Yes, we can inherit
abstract class from another abstract class.

14 When do we use the protected visibility specifier to a class member?


Ans. Protected variables allow access to the variables only from sub-classes and classes within the
same package. Protected variables can be useful if we want our data to be read-only, or when we
want to abstract our data.

15 What is information hiding?


Ans. Information hiding is the process of hiding the details of an object or function. The hiding of
these details results in an abstraction, which reduces the external complexity and makes the object
or function easier to use.
16 What do you understand by Object identity? Explain with an example.
Object identity is a property of data that is created in the context of an object data model, where an
object is assigned a unique internal object identifier, or object ID.
[Link] object identifier is used to define associations between objects and to support retrieval and
comparison of object-oriented data based on the internal identifier rather than the attribute values
of an object.
[Link] are many techniques for identifying objects in programming languages.
[Link] languages have built-in mechanisms for identifying objects. There is no need to create
explicit object identifier types.
[Link] example : In C++ an objects actual memory address serves as a unique identifier and
can be obtained by applying the '&' operator to an object or object reference.
[Link] identity can be tested by pointer comparison.

17 What do you mean by encapsulation ? How does the object-oriented concept of message
passing help to encapsulate the implementation of an object, including its data?
1. Encapsulation consists of separating the external aspects of an object, which are accessible to
other objects, from the internal implementation details of the object, which are hidden from other
objects.
[Link] prevents a program from becoming so interdependent
that a small change has massive ripple effects.
[Link] implementation of an object can be changed without affecting the applications that use it.
One may want to change the implementation of an object to improve
performance, fix a bug, consolidate code, or for porting.
[Link] understand encapsulation, let us consider the object ‘Employee’.
[Link] attributes of employees say ‘salary’ is kept hidden inside the object and may be made
accessible only through the method meant for the purpose.
[Link] method resides within the object.
For example , if getSalary() is a method of the object ‘Employee’ to get the salary of an employee,
then the salary of an employee can be obtained by no other way but by this method.
[Link] objects can also send messages to the object ‘Employee’ and get the salary of an employee
by the getSalary() method.
9. Other objects need not be concerned with the attributes and internal
structure of the object.
10. This is shown in Fig. 1.9.1. The figure shows that attributes are hidden inside the object by a
method

Using message passing to encapsulate the implementation of an object : Other parts of a system
only see an object’s interface (services it can perform and operation signatures). Internal details
including data are hidden and can only be accessed by a message that contains a valid signature
18 Explain all basic concepts of object oriented programming.
Ans. Features of object-oriented language are:
1. Encapsulation:
i. Encapsulation means that data are encapsulated inside an inviolable shell
along with the methods required to use it.

ii. The only way to reach the data is through these particular methods (see
Fig.).

iii. It is the mechanism that binds together code and the data it manipulates.

iv. This concept is also used to hide the internal representation, or state, of an
object from the outside.

2. Polymorphism:
i. Polymorphism means having many forms.
ii. Polymorphism is the ability of a message to be displayed in more than one
form.
iii. lt plays an important role in allowing objects having different internal
structure to share the same external interface.

3. Inheritance:
i. Inheritance is the ability to create classes that share the attributes and
methods of existing classes, but with more specific features.
19 What are the principles of modeling ? What is the importance of modeling ?

Principles of modeling are :


[Link] choice of what models to create has a profound influence on how a problem is attacked
and how a solution is shaped :This means choose correct model as per the requirement of
problem statement.
[Link] model may be expressed at different levels of precision :This means all the user and
developers both may visualize a system at different levels of details at different time.
[Link] best models are connected to reality :This means that the model must have things that are
practically possible. They must satisfy the real word scenarios.
[Link] single model is sufficient, Every non-trivial system is best approached through a small set of
nearly independent models : This means we need to have use case view, design view, process
view, implementation view and development view. Each of these views may have structural as
well as behavioral aspects. Together these views represent a system.

20 Describe the pros and cons of unified modeling language (UML).


Pros of UML :
[Link] has wide industry acceptance in comparison to previous modeling
language.
[Link] supports OOAD methodology.
[Link] bridges the communication gap between different entities of system
development (i.e., System Analyst, Developer, Client etc).
[Link] models are easy to understand, even for non-programmers.
[Link] is a unified and standardize modeling language.
Cons of UML :
[Link] is often criticized as being large and complex.
[Link] takes a lot of time to keep the diagram reasonable and synchronized
with the actual code.
[Link] cannot represent every condition in a sequence diagram.
[Link] software costs money.
[Link] to learn and takes time to master properly
21 What is UML ? List all building blocks of UML. Explain all types of
things used in UML.
UML: 1. UML stands for Unified Modeling Language.
2. UML is a pictorial language used to make software blueprints.
3. UML can be described as a general purpose visual modeling language to
visualize, specify, construct, and document software system.
4. lt is also used to model non-software systems as well.
5. UML is not a programming language but tools can be used to generate code
in various languages using UML diagrams.
6. UML has a direct relation with object-oriented analysis and design.

Building Block of UML:

Types of things used in UML: Things can be divided into several different
categories:
1. Structural things: Nouns that depicts the static behavior of a model is
termed as structural things. They display the physical and conceptual
components. They include class, object, interface, node, collaboration,
component, and a use case.
2. Behavioral things: They are the verbs that encompass the dynamic parts
of a model. It depicts the behavior of a system. They involve state machine,
activity diagram, interaction diagram, grouping things, annotation things.

3. Grouping things: It is a method that together binds the elements of the


UML model. In UML, the package is the only thing, which is used for grouping.

4. Annotational things: It is a mechanism that captures the remarks,


descriptions, and comments of UML model elements. In UML, a note is the only
Annotational thing.

22 Define an abstract class. When is it required to create an abstract


class ? Explain it with an example.

Ans.

Abstract class :

[Link] abstract class is a class that contains at least one abstract method.

[Link] abstract method is a method that is declared, but not instantiated.

When to create an abstract class :

[Link] abstract class is created when we are using the inheritance


concept since it provides a common base class implementation to derived
classes.

[Link] abstract class is used when we want to declare non-public


members.

[Link] we want to add new methods in the future, then an abstract class is used.

[Link] we want to create multiple versions of our component, we create an


abstract class.

[Link] we want to provide common, implemented functionality among all


implementations of our component, we use an abstract class

23 What do you mean by modeling? Discuss several purposes served by models with suitable
examples.
1.A model is an abstraction of something for the purpose of understanding it before building it.
[Link] a model leave out non essential detail, it is easier to manipulate them.
[Link] build hardware and software systems, the developer needs to :
[Link] different views of the system.
ii Build models using precise notations.
[Link] sure that the model satisfy the requirements of the system.
[Link] details to transform the model into an implementation.
[Link] serves the following purpose :
[Link] a physical entity before building it :
[Link] a model is cheaper. Also, it provides information that is too
inaccessible to be measured from physical model.
[Link] models are usually cheaper than building a complete system
and it enable flaws to be corrected early.
For example : Scale models of airplane and cars are tested in wind tunnels to
improve their aerodynamic.
[Link] with customers :
[Link] designers build models to show their [Link] example :
Demonstration products like mock-ups that imitate some Or all of the external
behavior of a system.
[Link] :
[Link] of movies, television shows, and advertisements allow the writers
to see how their idea flows.
[Link] models unnecessary segments can be modified before the final
development begins.
[Link] of complexity :
[Link] helps in understanding the systems that are too complex to
understand directly.
[Link] reduces complexity by leaving out the non essential details

24 Define the term multiplicity and quantification with suitable


examples.
Ans. Multiplicity:
1. Multiplicity is a definition of cardinality -i.e., number of elements of some
collection of elements by providing an inclusive interval of non-negative
integers to specify the allowable number of instances of described element.

2. Multiplicity specifies the number of instances of one class that may relate to
a single instance of an associated class.

3. For example, UML specifies multiplicity with following notations:


Quantification:
1. Quantification is the act of counting and measuring that maps human sense
observations and experience into quantities.

2. Quantification process is subjected.

3. Once quantified, the measure is objective.

25 Importance of modeling :
Modeling help the development team better to visualize the plan of their
system and allow them to develop more rapidly by helping them build
the right thing.

26 Define link and association. Discuss the role of link and association in object modeling
with suitable example

[Link] and association in object modeling represent the relation between


objects and classes.
[Link] : Link defines the relationship between two or more objects and a
link is considered as an instance of an association.
[Link] : It is a group of links that relates objects from the same
classes.
[Link] example :
Let us take the two classes Person and Company. Now there is an
association relation between these two classes.
ii.A person may own stock in zero or more companies.
[Link] it can be related in reverse that a company may have several
persons owing its stock.
[Link] object diagram below shows the links between the objects of
person and company class.
The
class diagram below shows the association between the person
and the company class. Both link and association are represented
with a line in UML notation.

27 Explain generalization, aggregation and association in detail.


Ans. Generalization:
 i. In the generalization process, the common characteristics of
classes are combined to form a class in a higher level of
hierarchy, i.e., sub-classes are combined to form a generalized
super-class.

 ii. It represents an “is – a- kind-of” relationship. For example,


“car is a kind of land vehicle”, or “ship is a kind of water
vehicle”.

Aggregation:
1. Aggregation is a stronger form of association. It represents the has-a or
part-of relationship.

2. An aggregation association depicts a complex object that is composed ot


other objects.

3. For example, we may characterize a house in terms of its roof, floors,


foundation, walls, rooms, windows, and so on. A room may, in turn be,
composed of walls, ceiling, floor, windows, and doors, as represented in Fig.

4. Hence object aggregation helps us describe models of the real world that
are composed of other models, as well as those that are composed of still
other models.

Association:
1. Association is the semantic relationship between classes that shows how
one instance is connected or merged with others in a system.

2. The objects are combined either logically or physically. Since it connects the
object of one class to the object of another class, it is categorized as a
structural relationship.

3. Following are the constraints applied to the association relationship are:

i. implicit: Implicit constraints define that the relationship is not visible, but it
is based on a concept.

ii. ordered: It describes that the set of entities is in a particular way at one
end in an association.

iii. changeable: The changeable constraint ensures that the connections


between several objects within a system are added, improved, and detached,
as and when required.

iv. addonly: It specifies that any new connection can be added from an
object located at the other end in an association.

v. frozen: The frozen constraint specifies that whenever a link is added


between objects, it cannot be altered by the time it is activated over the
connection or given link.

28 Give the conceptual model of UML. Use some example to illustrate


the model in detail using diagram
UML :
[Link] stands for Unified Modeling Language.
[Link] is a pictorial language used to make software blueprints.
[Link] can be described as a general purpose visual modeling language to
visualize, specify, construct, and document software system.
[Link] is also used to model non-software systems as well.
[Link] is not a programming language but tools can be used to generate
code in various languages using UML diagrams.
[Link] has a direct relation with object-oriented analysis and design.
Conceptual model of UML :
1.A conceptual model is defined as a model which is made of concepts and
their relationships.
2.A conceptual model is the first step before drawing a UML diagram.
[Link] helps to understand the entities in the real world and how they interact
with each other.
[Link] conceptual model of UML has three major elements :
[Link] building blocks.
[Link] to connect the building blocks.
[Link] mechanisms of UML.
5.A domain model, often referred to as a conceptual model, might berepresented
by a particular kind of UML class diagram.
[Link] model explains the structure of the application domain rather than
the application structure itself.
[Link] focuses on the domain concepts, rather than on the software entities.
[Link]. 1.20.1 shows the conceptual model for a library system.
29 Q. Why UML required ? What are the basic architecture of UML ?
The UML is required to help system and software developers accomplish
the following tasks :
[Link]
iiVisualization
[Link] design
[Link]
[Link] and testing
[Link]
Basic architecture of UML :
[Link] UML is defined in a circular manner, in which a subset of the language
notation and semantics is used to specify the language itself
[Link] UML is defined within a conceptual framework for modeling that consists of four
distinct layers or levels of abstraction.
[Link] framework is based on the most fundamental UML notation that concepts are
depicted as symbols, and relationships among concepts are depicted as paths (lines)
connecting symbols. Both of these types of elements may be named.
[Link] concepts introduced by the UML are organized around architectural
views to define the various diagrams.
[Link] UML diagrams are used to understand for conceptualize a problem,
solve the problem, and implement or realize the solution
30 What do you mean by a collaboration diagram ? Explain various terms and symbols
used in a collaboration diagram. How polymorphism is described using a collaboration
diagram ? Explain using an example
Collaboration diagram :
1.A collaboration diagram, also known as a communication diagram, is an illustration of
the relationships and interactions among software objects in the Unified Modeling
Language (UML).
[Link] diagrams can be used to portray the dynamic behavior of a
particular use case and define the role of each object.
[Link] diagrams are created by first identifying the structural
elements required to carry out the functionality of an interaction
Various terms used in collaboration diagram:
[Link] : Objects are shown as rectangles with naming labels inside.
The naming label follows the convention of object name; class name

[Link] : Actors are instances that invoke the interaction in the diagram. Each actor has
a name and a role, with one actor initiating the entire use case.
[Link] : Links connect objects with actors and are depicted using a
solid line between two elements. Each link is an instance where
messages can be sent.

[Link] : Messages between objects are shown as a labeled arrow placed near a
link. These messages are communications between objects that convey information
about the activity and can include the sequence number.
Polymorphism using collaboration diagram :
[Link]. 3 uses a collaboration diagram to illustrate polymorphism in a business scenario.
[Link] diagram assumes that there are different ways of calculating an employee’s pay.
[Link]-time employees are paid a salary that depends only on his or her grade; part-time
staff are paid a salary that depends in a similar way on grade, but must also take into
account the number of hours worked; temporary staff differ in that no deductions are
made for the company pension scheme, but the salary calculation is otherwise the same
as for a full-time employee.

[Link] object-oriented system to calculate pay for these employees might include a
separate class for each type of employee, each able to perform the appropriate pay
calculation.
[Link], following the principle of polymorphism, the message signature for all
calculate pay operations is the same.
[Link] one of the outputs from this system is a print-out showing the total pay for the
current month: to assemble the total, a message is sent to each employee object, asking
it to calculate its pay.
[Link] the message signature is the same in each case, the requesting object (here
called MonthlyPayPrint) need not know that the class of each receiving object, still less
how each calculation is carried out
31
What do you mean by polymorphism ? Is this concept only
applicable to object-oriented systems ? Explain.
Polymorphim :
[Link] means having many forms.
[Link] is the ability of a message to be displayed in more
than one form.
[Link] plays an important role in allowing objects having different
internal structure to share the same external interface.
Applicability of polymorphism :
[Link] programming languages there are two types of polymorphism
ad-hoc and universal.
[Link] are two kinds of universal polymorphism: parametric and
subtyping.
[Link]-hoc polymorphism is a kind of polymorphism in which
polymorphic functions can be applied to arguments of different
types
[Link] universal (parametric) polymorphism, the polymorphic functions
are written without mention of any specific type.
[Link] ad-hoc polymorphism is applicable in both traditional and object-
ori ented prog rammi ng environm ents, wher eas univer sal
polymorphism only applies to object-oriented systems.

32 What are the three ways to apply UML?


1) UML as sketch Informal and incomplete diagrams (often hand sketched on
whiteboards) created to explore difficult parts of the problem or solution space,
exploiting the power of visual languages. 2) UML as blueprint Relatively detailed
design diagrams used either for 1) reverse engineering to visualize and better
understanding existing code in UML diagrams, or for 2) code generation
(forward engineering). If reverse engineering, a UML tool reads the source or
binaries and generates (typically) UML package, class, and sequence diagrams.
These "blueprints" can help the reader understand the bigpicture elements,
structure, and collaborations. Before programming, some detailed diagrams can
provide guidance for code generation (e.g., in Java), either manually or
automatically with a tool. It's common that the diagrams are used for some
code, and other code is filled in by a developer while coding (perhaps also
applying UML sketching). 3) UML as programming language - Complete
executable specification of a software system in UML. Executable code will be
automatically generated, but is not normally seen or modified by developers;
one works only in the UML "programming language." This use of UML requires
a practical way to diagram all behavior or logic (probably using interaction or
state diagrams), and is still under development in terms of theory, tool
robustness and usability
33 What is meant by object? How are these created?
An object is a single unit having both data and the processes that operate
on that data. For example, in object oriented programming language like
C++, the data and functions are bundled together as a self contained unit
called an object. An object is an entity which has some properties and
behavior associated with it. Objects are the basic run time entities in an
object oriented system. programming problems are analyzed in terms of
objects. The main purpose of using objects are following.
 They correspond to the real life entities.
 They provide interactions with the real world.
 They provide practical approach for the implementation of the
solution.
All the objects have a state, behavior and identity.
State of an object - The state or attributes are the built in characteristics
or properties of an object. For example, a T.V has the size, colour, model
etc.
Behaviour of the object - The behavior or operations of an object are its
predefined functions. For example, a T.V. can show picture , change
channels, tune for a channel etc. in object oriented programming
terminology the behavior is implemented through methods.
Object identity - Each object is uniquely identifiable. For example, the
fridge can not become the T.V.
Object representation
An object is represented as shown below:
An object consists of the following.
Data members - Data members are the variables. They establish the state
or attributes for the object.
Member functions - Member functions represent the code to manipulate
the data. The behaviour of the object is determined by the member
functions.

34 State which UML diagrams give a static view and which give a dynamic view
of a system.

There are two broad categories of diagrams and they are again divided into subcategories −
· Structural Diagrams
· Behavioral Diagrams
Structural Diagrams
The structural diagrams represent the static aspect of the system. These static aspects represent th
and are therefore stable.

These static parts are represented by classes, interfaces, objects, components, and nodes. The four st
· Class diagram
· Object diagram
· Component diagram
· Deployment diagram
Behavioral diagrams
Behavioral diagrams basically capture the dynamic aspect of a system. Dynamic aspect can be furthe
UML has the following five types of behavioral diagrams −
· Use case diagram
· Sequence diagram
· Collaboration diagram
· Statechart diagram
· Activity diagram

35 Write a short note on with Graphical notation:


36 Describe the UML and need of UML and explain the benefits of UML?
UML is a standard language for specifying, visualizing, constructing, and documenting the artifacts o

UML was created by the Object Management Group (OMG) and UML 1.0 specification draft was prop
Need of UML
· Identify requirements and communicate information.
· Allows focus on how system components interact.
· Allows you to see relationships among design components
· Improves communication across your team using common graphical language

Benefits of UML
· Enterprise information systems
· Banking and financial services
· Telecommunications
· Transportation
· Defence/aerospace
· Retail
· Medical electronics
· Scientific
· Distributed Web-based services

37 Elaborate the Role of UML in OO Design.


UML is a modeling language used to model software and non-software
systems. Although UML is used for non-software systems, the emphasis is
on modeling OO software applications. Most of the UML diagrams discussed
so far are used to model different aspects such as static, dynamic, etc. Now
whatever be the aspect, the artifacts are nothing but objects.
If we look into class diagram, object diagram, collaboration diagram,
interaction diagrams all would basically be designed based on the objects.
Hence, the relation between OO design and UML is very important to
understand. The OO design is transformed into UML diagrams according to
the requirement. Before understanding the UML in detail, the OO concept
should be learned properly. Once the OO analysis and design is done, the
next step is very easy. The input from OO analysis and design is the input to
UML diagrams.
Define the building blocks of UML.
The building blocks of UML can be defined as –
· Things
· Relationships
· Diagrams
Things
Things are the most important building blocks of UML. Things can be −
· Structural
· Behavioral
· Grouping
· Annotational
Relationship
Relationship is another most important building block of UML. It shows how the elements are ass
the functionality of an application.
There are four kinds of relationships available.
Dependency
Association
Generalization
Realization

Diagrams
UML diagrams are the ultimate output of the entire discussion. All the elements, relationships are u
represents a system.

The visual effect of the UML diagram is the most important part of the entire process. All the other e

UML includes the following nine diagrams, the details of which are described in the subsequent chap
· Class diagram
· Object diagram
· Use case diagram
· Sequence diagram
· Collaboration diagram
· Activity diagram
· Statechart diagram
· Deployment diagram
· Component diagram
38 Explain behavioral Diagrams and any three types of behavioral Diagrams?
Behavioral Diagrams
Any system can have two aspects, static and dynamic. So, a model is considered as complete when bo

Behavioral diagrams basically capture the dynamic aspect of a system. Dynamic aspect can be furthe
UML has the following five types of behavioral diagrams −
· Use case diagram
· Sequence diagram
· Collaboration diagram
· Statechart diagram
· Activity diagram
Use Case Diagram
Use case diagrams are a set of use cases, actors, and their relationships. They represent the use case

A use case represents a particular functionality of a system. Hence, use case diagram is used to de
their internal/external controllers. These controllers are known as actors
Sequence Diagram
A sequence diagram is an interaction diagram. From the name, it is clear that the diagram deals wit
flowing from one object to another.

Interaction among the components of a system is very important from implementation and executio
sequence of calls in a system to perform a specific functionality.
Collaboration Diagram
Collaboration diagram is another form of interaction diagram. It represents the structural organ
Structural organization consists of objects and links.

The purpose of collaboration diagram is similar to sequence diagram. However, the specific
organization of objects and their interaction.

39 Explain structural diagrams and any three types of structural diagrams?

The structural diagrams represent the static aspect of the system. These static aspects represent th
and are therefore stable.

These static parts are represented by classes, interfaces, objects, components, and nodes. The four st
· Class diagram
· Object diagram
· Component diagram
· Deployment diagram
Class Diagram
Class diagrams are the most common diagrams used in UML. Class diagram consists of classes, int
basically represent the object-oriented view of a system, which is static in nature.
Active class is used in a class diagram to represent the concurrency of the system.
Class diagram represents the object orientation of a system. Hence, it is generally used for develop
the time of system construction.
Object Diagram
Object diagrams can be described as an instance of class diagram. Thus, these diagrams are more clo

Object diagrams are a set of objects and their relationship is just like class diagrams. They also repre

The usage of object diagrams is similar to class diagrams but they are used to build prototype of a sy
40 What is modeling? What are the advantages of creating a model?What are the
different views that are considered when building an object-oriented software
system?

Modeling is a proven and well-accepted engineering technique which helps


build a model. Model is a simplification of reality; it is a blueprint of the
actual system that needs to be built. Model helps to visualize the system.
Model helps to specify the structural and behavior of the system. Model
helps make templates for constructing the system. Model helps document
the system. Normally there are 5 views. Use Case view - This view exposes
the requirements of a system. Design View - Capturing the vocabulary.
Process View - modeling the distribution of the systems processes and
threads. Implementation view - addressing the physical implementation of
the system. Deployment view - focus on the modeling the components
required for deploying the system.
41 What are Relationships? Explain a different kind of Relationships?
Relationship
Relationship is another most important building block of UML. It shows how the elements are ass
the functionality of an application.
There are four kinds of relationships available.
Dependency
Dependency is a relationship between two things in which change in one element also affects the oth

Association
Association is basically a set of links that connects the elements of a UML model. It also describes ho

Generalization
Generalization can be defined as a relationship which connects a specialized element with a gen
relationship in the world of objects.

Realization
Realization can be defined as a relationship in which two elements are connected. One element de
and the other one implements them. This relationship exists in case of interfaces.

Brief three important types of UML modelling.


Structural Modeling
Structural modeling captures the static features of a system. They consist of the following −
· Classes diagrams
· Objects diagrams
· Deployment diagrams
· Package diagrams
· Composite structure diagram
· Component diagram

Structural model represents the framework for the system and this framework is the place wher
component diagram and deployment diagrams are part of structural modeling. They all represent t

The structural model never describes the dynamic behavior of the system. Class diagram is the mos
Behavioral Modeling
Behavioral model describes the interaction in the system. It represents the interaction among t
dynamic nature of the system. They consist of the following −
· Activity diagrams
· Interaction diagrams
· Use case diagrams
All the above show the dynamic sequence of flow in a system.
Architectural Modeling

Architectural model represents the overall framework of the system. It contains both structural and
can be defined as the blueprint of the entire system. Package diagram comes under architectural m

Enumerate the graphical notations used in structural things are most widely
used in UML.
Graphical notations used in structural things are most widely used in UML. These are considered
structural things.
· Classes
· Object
· Interface
· Collaboration
· Use case
· Active classes
· Components
· Nodes
Class Notation
UML class is represented by the following figure. The diagram is
divided into four parts.
· The top section is used to name the class.
· The second one is used to show the attributes of the
class.
· The third section is used to describe the operations
performed by the class.
· The fourth section is optional to show any additional
components.

Classes are used to represent objects. Objects can be anything


having properties and responsibility.
Object Notation
The object is represented in the same way as the class. The only
difference is the name which is underlined as shown in the
following figure.
As the object is an actual implementation of a class, which is
known as the instance of a class. Hence, it has the same usage as
the class.

Interface Notation
Interface is represented by a circle as shown in the following figure.
It has a name which is generally written below the circle.
Interface is used to describe the functionality without
implementation. Interface is just like a template where you define
different functions, not the implementation. When a class
implements the interface, it also implements the functionality as
per requirement.
Collaboration Notation
Collaboration is represented by a dotted eclipse as shown in the
following figure. It has a name written inside the eclipse.

Collaboration represents responsibilities. Generally, responsibilities


are in a group.
Use Case Notation
Use case is represented as an eclipse with a name inside it. It may
contain additional responsibilities.

Use case is used to capture high level functionalities of a system.


Actor Notation
An actor can be defined as some internal or external entity that
interacts with the system.

An actor is used in a use case diagram to describe the internal or


external entities.
Initial State Notation
Initial state is defined to show the start of a process. This notation
is used in almost all diagrams.

The usage of Initial State Notation is to show the starting point of


a process.
Final State Notation
Final state is used to show the end of a process. This notation is
also used in almost all diagrams to describe the end.

The usage of Final State Notation is to show the termination point


of a process.
Active Class Notation

Active class looks similar to a class with a solid border.


Active class is generally used to describe the concurrent behavior of a system.
Active class is used to represent the concurrency in a system.
Component Notation
A component in UML is shown in the following figure with a name
inside. Additional elements can be added wherever required.

Component is used to represent any part of a system for which


UML diagrams are made.
Node Notation
A node in UML is represented by a square box as shown in the
following figure with a name. A node represents the physical
component of the system.

42 Define Class and Object with suitable example?


A class can be understood as a template or a blueprint, which contains some
values, known as member data or member, and some set of rules, known as
behaviors or functions. So when an object is created, it automatically takes
the data and functions that are defined in the class.
Therefore the class is basically a template or blueprint for objects. Also one can create as many objec

For example, first, a car’s template is created. Then multiple units of car are created based on that tem
Object
An object refers to the instance of the class, which contains the instance of the members and behavio
object is an actual entity to which a user interacts, whereas class is just the blueprint for that object.
characteristic behavior.
For example, a specific car.

43 What are the four basic relationships defined in UML? Give suitable
examples for usage of each type of relationships?

Relationships in UML are used to represent a connection between structural, behavioral, or groupin
or more things can relate to each other during the execution of a system. Type of UML Relationship a
Realization.
Lets study them in detail

Types of UML Class Diagram Relationships

Association
It is a set of links that connects elements of the UML model. It also defines how many objects are taki

Dependency

In a dependency relationship, as the name suggests, two or more elements are dependent on each ot
to a particular element, then it is likely possible that all the other elements will also get affected by th

Generalization
It is also called a parent-child relationship. In generalization, one element is a specialization of anoth
mostly used to represent inheritance.
Realization
In a realization relationship of UML, one entity denotes some responsibility which is not implemente
This relationship is mostly found in the case of interfaces.
What is class diagram in UML with example?Define the purpose of class
diagram.

Class diagram is a static diagram. It represents the static view of an application. Class diag
documenting different aspects of a system but also for constructing executable code of the softw

Class diagram describes the attributes and operations of a class and also the constraints impose
in the modeling of objectoriented systems because they are the only UML diagrams, which can b

Class diagram shows a collection of classes, interfaces, associations, collaborations, and constr

Purpose of Class Diagrams

The purpose of class diagram is to model the static view of an application. Class diagrams are
object-oriented languages and thus widely used at the time of construction.

UML diagrams like activity diagram, sequence diagram can only give the sequence flow of the a
is the most popular UML diagram in the coder community.

44. Discuss the significance of class diagrams in modeling a system and define
benefits of class diagram also

The main purpose of class diagrams is to build a static view of an application. It is the only diagr
mapped with object-oriented languages. It is one of the most popular UML diagrams. Following are t

1. It analyses and designs a static view of an application.


2. It describes the major responsibilities of a system.
3. It is a base for component and deployment diagrams.
4. It incorporates forward and reverse engineering.
Benefits of Class Diagrams
1. It can represent the object model for complex systems.
2. It reduces the maintenance time by providing an overview of how an application is structured befo
3. It provides a general schematic of an application for better understanding.
4. It represents a detailed chart by highlighting the desired code, which is to be programmed.
5. It is helpful for the stakeholders and the developers.
What is meant by a Class diagram? Write an step to draw the class digram?

The class diagram is used most widely to construct software applications. It not only represents a st
an application. A collection of class diagrams as a whole represents a system.

Some key points that are needed to keep in mind while drawing a class diagram are given below:

1. To describe a complete aspect of the system, it is suggested to give a meaningful name to the class
2. The objects and their relationships should be acknowledged in advance.
3. The attributes and methods (responsibilities) of each class must be known.
4. A minimum number of desired properties should be specified as more number of the unwanted pr

5. Notes can be used as and when required by the developer to describe the aspects of a diagram.

6. The diagrams should be redrawn and reworked as many times to make it correct before producing
45 Why modeling is important list any five advantages of
modeling?
Modeling is a central part of all activities that lead up to the deployment of good software. It is req
Importance of Modeling:

Modeling gives graphical representation of system to be built.


Modeling contributes to a successful software organization.
Modeling is a proven and well accepted engineering technique.
Modeling is not just a part of the building industry. It would be inconceivable to deploy a new
models-from computer models to physical wind tunnels models to full scale prototypes.
A model is a simplification of reality. A model provides the blueprint of a system.
A model may be structural, emphasizing the organization of the system, or it may be behavio
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 permit us to specify the structure or behavior of a system.
c. Models give us a template that guides us in constructing a system.
d. Models support the decisions we have made.
What are the 3 primary elements of collaboration diagram?
There are three primary elements of a collaboration diagram:
· Objects
· Links
· Messages

Objects
Objects participating in a collaboration come in two flavors?supplier and client. Supplier objects are the ob
therefore receive the message. Client objects call methods on supplier objects, and therefore send message

Links

The connecting lines drawn between objects in a collaboration diagram are


They enable you to see the relationships between objects. Each link represents a relationship between obje
to each other. A single link can support one or more messages sent between objects. This is different from
represent messages sent from one object to another.

Messages
Messages in collaboration diagrams are shown as arrows pointing from the Client object to the Supplier ob
operation on a supplier object.

Message icons have one or more messages associated with them. Messages are composed of message text
indicates the time-ordering of the message.

46 What is the purpose of a collaboration diagram? What are


the symbols used in collaboration diagram?
The purpose of a collaboration diagram
The collaboration diagram is used to show the relationship between the objects in a system. Both the
the same information but differently. Instead of showing the flow of messages, it depicts the architec
on object-oriented programming. An object consists of several features. Multiple objects present in t
collaboration diagram, which is also known as a communication
diagram, is used to portray the object's architecture in the system.

What are the pros and cons of collaboration diagram.


Benefits of a Collaboration Diagram
1. The collaboration diagram is also known as Communication Diagram.
2. It mainly puts emphasis on the structural aspect of an interaction diagram, i.e., how lifelines are co

3. The syntax of a collaboration diagram is similar to the sequence diagram; just the difference is tha
4. The messages transmitted over sequencing is represented by numbering each individual message

5. The collaboration diagram is semantically weak in comparison to the sequence diagram.


6. The special case of a collaboration diagram is the object diagram.
7. It focuses on the elements and not the message flow, like sequence diagrams.
8. Since the collaboration diagrams are not that expensive, the sequence diagram can be directly con

9. There may be a chance of losing some amount of information while implementing a collaboration
The drawback of a Collaboration Diagram
1. Multiple objects residing in the system can make a complex collaboration diagram, as it becomes q
2. It is a time-consuming diagram.
3. After the program terminates, the object is destroyed.
3. As the object state changes momentarily, it becomes difficult to
keep an eye on every single that has occurred inside the object of a system.
47 Describe the notation used for the collaboration diagram.
Notations of a Collaboration Diagram

Following are the components of a component diagram that are enlisted below:

Objects: The representation of an object is done by an object symbol with its name and class unde

In the collaboration diagram, objects are utilized in the following ways:

The object is represented by specifying their name and class.

It is not mandatory for every class to appear.

A class may constitute more than one object.

In the collaboration diagram, firstly, the object is created, and then its class is specified.

To differentiate one object from another object, it is necessary to name them.

1. Actors: In the collaboration diagram, the actor plays the main role as it invokes the intera
In this, one actor initiates the use case.

2. Links: The link is an instance of association, which associates the objects and actors. It port
which the messages are sent. It is represented by a solid line. The link helps an object to con
the message flows are attached to links.

3. Messages: It is a communication between objects which carries information and includes


place. It is represented by a labeled arrow, which is placed near a link. The messages a
direction must be navigable in that particular direction. The receiver must understand the m
48 Define the Similarities and difference between Sequence diagram and
Collaboration diagram
Similarities Between Sequence and Collaboration Diagram:
1. In Unified Modelling Language both the sequence diagram and collaboration diagram are us
2. Both the diagrams details about the behavioral aspects of the system.

Differences Between Sequence and Collaboration diagram:


Sequence Diagrams

The sequence diagram represents the UML,


which is used to visualize the sequence of calls The collaboration diagram also comes under
in a system that is used to perform a specific organization of the objects and their interaction
functionality.

The sequence diagram are used to represent


The collaboration diagram are used to repres
the sequence of messages that are flowing from
messages that are sent and received.
one object to another.

The sequence diagram is used when time


The collaboration diagram is used when objec
sequence is main focus.

The sequence diagrams are better suited of The collaboration diagrams are better suited
analysis activities. number of objects.

49 Define the following with suitable example:


a)Inheritance
c)Polymorphism

Inheritance
This post provides the theoretical explanation of inheritance with real-life examples
· Inheritance is the mechanism by which an object acquires the some/all properties of an
· It supports the concept of hierarchical classification.

For example: Car is a four wheeler vehicle so assume that we have a class FourWheeler and a sub cl
class FourWheeler. Other classifications could be a jeep, tempo, van etc. FourWheeler defines a clas
engine power, load carrying capacity etc. Car (termed as a sub-class) acquires these properties from
are different from other classifications of FourWheeler, such as luxury, comfort, shape, size, usage e

A car can have further classification such as an open car, small car, big car etc, which will acquire th
still have some specific properties. This way the level of hierarchy can be extended to any level.
Polymorphism
This post provides the theoretical explanation of polymorphism with real-life examplesPolymorphi
data type.
· In other words it means, one method with multiple implementation, for a certain class o
decided at runtime depending upon the situation (i.e., data type of the object)

· This can be implemented by designing a generic interface, which provides generic meth
classes, which provides the implementation of these generic methods.

Lets us look at same example of a car. A car have a gear transmission system. It has four front gears
then depending upon which gear is engaged different amount power and movement is delivered to
the type of gear the action behaves differently or you can say that it shows many forms (polymorph

Polymorphism could be static and dynamic both. Method Overloading

· Overloading in simple words means more than one method having the same method n
passed while calling the method. This called static because, which method to be invoked is decided

· Overriding means a derived class is implementing a method of its super class. The call
runtime polymorphism

50 What are the different types of Messages in Sequence Diagrams


Types of Messages in Sequence Diagrams

Synchronous Message
A synchronous message requires a response before the interaction can continue. It's usually drawn u
object to another.

Asynchronous Message
Asynchronous messages don't need a reply for interaction to continue. Like synchronous messages, t
however, the arrowhead is usually open and there's no return message depicted.

Reply or Return Message


A reply message is drawn with a dotted line and an open arrowhead pointing back to the original life

Self-Message
A message an object sends to itself, usually shown as a U-shaped arrow pointing back to itself.
Create Message
This is a message that creates a new object. Similar to a return message, it's depicted with a dashed l
representing the object created.

Delete Message
This is a message that destroys an object. It can be shown by an arrow with an x at the end.

Found Message
A message sent from an unknown recipient, shown by an arrow from an endpoint to a lifeline.

Lost Message
A message sent to an unknown recipient. It's shown by an arrow going from a lifeline to an endpoint

Sequence Diagram Examples

51 Describe synchronous and asynchronous messages used in sequence


diagram. Give notations.

Synchronous Message: A synchronous message requires a response before the interaction can cont
arrowhead pointing from one object to another. If a caller sends a synchronous message, it must wai
subroutine.
Synchronous Message

Asynchronous Message: Asynchronous messages don't need a reply for interaction to continue. Lik
connecting two lifelines; however, the arrowhead is usually open and there's no return message depi
continue processing and doesn’t have to wait for a response.
52 What are the pros and cons of sequence diagram.
Benefits of a Sequence Diagram

Sequence diagrams are used to explore any real application or a system.


Sequence diagrams are used to represent message flow from one object to another object.
Sequence diagrams are easier to maintain.
Sequence diagrams are easier to generate.
Sequence diagrams can be easily updated according to the changes within a system.
Sequence diagram allows reverse as well as forward engineering.
Drawbacks of a sequence diagram

Sequence diagrams can become complex when too many lifelines are involved in the system.
If the order of message sequence is changed, then incorrect results are produced.
Each sequence needs to be represented using different message notation, which can be a little c
The type of message decides the type of sequence inside the diagram.
53 Discuss the role of acess specifiers in inheritance and show their visibility
when they are inherited as public, private and protected.
These 3 keywords (public, protected, and private) are known as
access specifiers in C++ inheritance.

public, protected and private inheritance in C++


public, protected, and private inheritance have the following features:

public inheritance makes public members of the base class public in


the derived class, and the protected members of the base class remain
protected in the derived class.
protected inheritance makes the public and protected members of the
base class protected in the derived class.
private inheritance makes the public and protected members of the
base class private in the derived class.

Accessibility in private Inheritance


Accessibility private members protected members public members
Base Class Yes Yes Yes
Derived Class No Yes (inherited as private variables) Yes (inherited
as private variables)

54. What is Object, Class and Instance?

Object: A single thing or concept, either in a model of an application domain or in a software system that c
and identity, a member of a class that defines a set of similar objects.

Class: A class is a descriptor for a collection of objects that are logically similar in terms of their behavior

Instance: A single object, usually called an instance in the context of its membership of a particular c
55 What is object-oriented design (OOD), and how does it differ from other
approaches to software design?What Is Generalization and Specialization?

Object-oriented design, known as OOD,


focuses on using objects and the interactions
between them for software design. It uses principles
such as abstraction, encapsulation, inheritance and
polymorphism to model real-world objects, and their
behaviour in the software system. This improves
code modularity and reusability, allowing for a more
flexible and scalable design. Other design
approaches, such as structured or functional design,
focus on breaking the system into smaller modules
or functions that perform specific tasks.

Generalization: Generalization is the abstraction of common feature among elements by the creation
encapsulate common features. For example, in animal world a cat and a dog share some common fea
which encapsulates common their common feature. A cat, a dog – both are consistent with mammal

Specialization: The other face of generalization is specialization. A class is said to be specialized whe
it from its super class. For example, a cat is a mammal but it is more specialized.

Either of Q 1, 2, 4 & 5 one should be Previous Year GATE Question or company specific if applicable.

CO Course Outcomes mapped with respective question


KL Bloom's knowledge Level (K1, K2, K3, K4, K5, K6)
K1- Remember, K2- Understand, K3-Apply, K4- Analyze, K5: Evaluate, K6- Create

You might also like