0% found this document useful (0 votes)
3 views

Assignments1 with Answers

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignments1 with Answers

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Q1 Explain encapsulation with example.

OR

Discuss the concept of encapsulation with suitable example.

AKTU 2012-13, Marks 05

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?

AKTU 2010-11, Marks 05

Answer
Encapsulation (also information hiding) separates the external aspects of an
object, that are accessible to other objects, from the internal implementation
details, that are hidden from other objects. Encapsulation prevents portions of
a program from becoming so interdependent that a small change has massive
ripple effects.
Objects restrict the visibility of their resources (attributes and methods) to other
users. Every object has an interface, which determines how other objects can
interact with it. The implementation of the object is encapsulated, that is,
invisible outside the object itself. Consider a real-life example of encapsulation,
in a company, there are different sections like the accounts section, finance
section, sales section etc.
The object-oriented concept of message passing helps to encapsulate the
implementation of an object, including its data as 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.
Ques 10 Write short note on information hiding.

Answer:same as above

Q2 Explain object-oriented approach with its benefits.


Answer
The object-oriented approach focuses on objects that represent abstract or
concrete things in the real world. These objects are first defined by their
character and their properties, which are represented by their internal
structure and their attributes (data). The behaviour of these objects is
described by methods (functions).
Below are some of the advantages of object-oriented programming:

• Complex software systems become easier to understand since object-


oriented structuring provides a closer representation of reality than other
programming techniques.
• In a well-designed object-oriented system, it should be possible to
implement changes at class level, without having to make alterations at
other points in the system. This reduces the overall amount of
maintenance required.
• Using polymorphism and inheritance, object-oriented programming
allows you to reuse individual components.
• In an object-oriented system, the amount of work involved in revising
and maintaining the system is reduced, since many problems can be
detected and corrected in the design phase
Q3 What do you mean object modelling techniques? explain . discuss
the various stages of the object modelling techniques with some
example.

AKTU 2015-16, Marks 10

Answer
The object modeling techniques is an methodology of object oriented analysis,
design and implementation that focuses on creating a model of objects from
the real world and then to use this model to develop object–oriented software.
object modeling technique, OMT was developed by James Rambaugh. Now-
a-days, OMT is one of the most popular object oriented development
techniques. It is primarily used by system and software developers to support
full life cycle development while targeting object oriented implementations.
OMT has proven itself easy to understand, to draw and to use. It is very
successful in many application domains: telecommunication, transportation,
compilers etc. The popular object modeling technique are used in many real
world problems. The object-oriented paradigm using the OMT spans the entire
development cycle, so there is no need to transform one type of model to
another.
Phase of OMT
The OMT methodology covers the full software development life cycle. The
methodology has the following phase.

1. Analysis - Analysis is the first phase of OMT methodology. The aim of


analysis phase is to build a model of the real world situation to show its
important properties and domain. This phase is concerned with
preparation of precise and correct modelling of the real world. The
analysis phase starts with defining a problem statement which includes
a set of goals. This problem statement is then expanded into three
models; an object model, a dynamic model and a functional model. The
object model shows the static data structure or skeleton of the real
world system and divides the whole application into objects. In others
words, this model represents the artifacts of the system. The dynamic
model represents the interaction between artifacts above designed
represented as events, states and transitions. The functional model
represents the methods of the system from the data flow perspective.
The analysis phase generates object model diagrams, state diagrams,
event flow diagrams and data flow diagrams.
2. System design - The system design phase comes after the analysis
phase. System design phase determines the overall system architecture
using subsystems, concurrent tasks and data storage. During system
design, the high level structure of the system is designed. The decisions
made during system design are:

oThe system is organized in to sub-systems which are then


allocated to processes and tasks, taking into account concurrency
and collaboration.
o Persistent data storage is established along with a strategy to
manage shared or global information.
o Boundary situations are checked to help guide trade off priorities.
3. Object design - The object design phase comes after the system
design phase is over. Here the implementation plan is developed.
Object design is concerned with fully classifying the existing and
remaining classes, associations, attributes and operations necessary for
implementing a solution to the problem. In object design:
o Operations and data structures are fully defined along with any
internal objects needed for implementation.
o Class level associations are determined.
o Issues of inheritance, aggregation, association and default values
are checked.
4. Implementation - Implementation pahse of the OMT is a matter of
translating the design in to a programming language constructs. It is
important to have good software engineering practice so that the design
phase is smoothly translated in to the implementation phase. Thus while
selecting programming language all constructs should be kept in mind
for following noteworthy points.

o To increase flexibility.
o To make amendments easily.
o For the design traceability.
o To increase efficiency.

Q4. Write short notes on: Compare procedural programming with


object-oriented programming with examples.

AKTU 2012-13, Marks 05

OR

What is the difference between Procedure Based programming


language and Object-Oriented programming language?

AKTU 2013-14, Marks 05

OR

Write short notes on: Procedural v/s OOP.

AKTU 2013-14, Marks 05

Answer
Procedural based Programming Object Oriented Programming

In procedural programming, program is In object oriented programming,


divided into small parts called program is divided into small parts
functions. called objects

Procedural programming follows top Object oriented programming follows


down approach. bottom up approach.
Procedural based Programming Object Oriented Programming

Object oriented programming have


There is no access specifier in
access specifiers like private, public,
procedural programming.
protected etc.

Adding new data and function is not


Adding new data and function is easy.
easy.

Procedural programming does not Object oriented programming


have any proper way for hiding data so provides data hiding so it is more
it is less secure. secure.

In procedural programming, Overloading is possible in object


overloading is not possible. oriented programming.

In procedural programming, function is In object oriented programming, data


more important than data. is more important than function

Procedural programming is based on Object oriented programming is


unreal world. based on real world.

Examples: C, FORTRAN, Pascal,


Examples: C++, Java, Python, C# etc.
Basic etc

Ques 7 What do you understand by object-oriented technology?


Discuss the pros and cons of object-oriented technology with suitable
example.

AKTU 2011-12, Marks 10

OR

What do you mean by object-oriented techniques? Explain with some


examples.
AKTU 2012-13, Marks 10

Answer
Object-oriented technology (OOT) is a software design model in which
objects contain both data and the instructions that work on the data. It is
increasingly deployed in distributed computing.
Pros of object oriented technology:
1. It allows for parallel development.
If you’re working with programming teams, then each can work independently
of one another once the modular classes have been worked out. That allows
for a relative level of parallel development that wouldn’t be available
otherwise.
2. The modular classes are often reusable.
Once the modular classes have been created, they can often be used again in
other applications or projects. At times, little-to-no modification is necessary
for the next project as well. That gives a team more flexibility once they get
beyond the initial start-up phase.
3. The coding is easier to maintain.
With OOT, because your coding base has been centralized, it is easier to
create a maintainable procedure code. That makes it easier to keep your data
accessible when it becomes necessary to perform an upgrade. This process
also improves the security of the programming since high levels of validation
are often required.
Cons of object oriented technology:
1. It can be inefficient.
Object-oriented Technology tends to use more CPU than alternative options.
That can make it be an inefficient choice when there are technical limitations
involved due to the size that it can end up being. Because of the duplication
involved, the first-time coding can be more extensive than other options as
well.
2. It can be too scalable.
If OOT is left to run out of control, then it can create a massive amount of
bloated, unnecessary code. When that occurs, the overhead rises and that
makes it difficult to keep costs down.
3. It can cause duplication.
OOT projects tend to be easier to design than implement. That is because the
modular classes are so flexible in their application. You may be able to get
new projects up and running at a greater speed, but that comes at the cost of
having projects sometimes feel like they’ve been cloned.
Ques 8 What do you understand by object identity? Explain with an
example.

AKTU 2013-14, Marks 05

Answer
Object Identity means that data is quantized into discrete, distinguishable
entities called objects.
Object identity is a fundamental object orientation concept. With object
identity, objects can contain or refer to other objects. Identity is a property of
an object that distinguishes the object from all other objects in the application.
There are many techniques for identifying objects in programming languages,
databases and operating systems ,the most commonly used technique for
identifying objects is user-defined names for objects.
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 OID. The 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.

Q5. Describe steps of object-oriented design.


AKTU 2010-11, Marks 05
Answer
Following are the steps of object -Oriented design:
1.Analysis - Analysis is the first phase of OMT methodology. The aim of the
analysis phase is to build a model of the real-world situation to show its
important properties and domain. This phase is concerned with the
preparation of precise and correct modelling of the real world. The analysis
phase starts with defining a problem statement which includes a set of goals.
This problem statement is then expanded into three models; an object model,
a dynamic model and a functional model. The object model shows the static
data structure or skeleton of the real-world system and divides the whole
application into objects. In other words, this model represents the artefacts of
the system. The dynamic model represents the interaction between artefacts
above designed represented as events, states and transitions. The functional
model represents the methods of the system from the data flow perspective.
The analysis phase generates object model diagrams, state diagrams, event
flow diagrams and data flow diagrams.
2.System design - The system design phase comes after the analysis phase.
System design phase determines the overall system architecture using
subsystems, concurrent tasks and data storage. During system design, the
high-level structure of the system is designed. The decisions made during
system design are:

• The system is organized into sub-systems which are then allocated to


processes and tasks, taking into account concurrency and collaboration.
• Persistent data storage is established along with a strategy to manage
shared or global information.
• Boundary situations are checked to help guide trade-off priorities.
3.Object design - The object design phase comes after the system design
phase is over. Here the implementation plan is developed. Object design is
concerned with fully classifying the existing and remaining classes,
associations, attributes and operations necessary for implementing a solution
to the problem. In object design:

• Operations and data structures are fully defined along with any internal
objects needed for implementation.
• Class level associations are determined.
• Issues of inheritance, aggregation, association and default values are
checked.
4.Implementation - Implementation phase of the OMT is a matter of
translating the design into a programming language construct. It is important
to have good software engineering practice so that the design phase is
smoothly translated into the implementation phase. Thus while selecting
programming language all constructs should be kept in mind for following
noteworthy points.

• To increase flexibility.
• To make amendments easily.
• For the design traceability.
• To increase efficiency.
Ques 5 Differentiate between structured approach and object-
oriented approach.

Answer
Structured Approach Object Oriented Approach

It works with Top-down approach It works with a Bottom-up approach.

Program is divided into number of Program is divided into number of


submodules or functions submodules or functions

Function call is used. Message passing is used.

Software reuse is not possible. Reusability is possible

Structured design programming usually Object oriented design programming


left until end phases. done concurrently with other phases.

Structured Design is more suitable for It is suitable for in-house


offshoring. development.

It shows a clear transition from design Not so clear transition from design to
to implementation. implementation.

It is suitable for real time systems, It is suitable for most business


embedded systems and projects where applications, game development
objects are not the most useful level of projects, which are expected to
abstraction. customize or extended.

Class diagram, sequence diagram,


DFD & E-R diagram models the data. state chart diagram, and use cases all
contribute

In this approach, projects can be


In this, projects can be managed easily
difficult to manage due to uncertain
due to clearly identifiable phases.
transitions between phases.

Q6. What do you mean by UML? Discuss the conceptual model of


UML with the help of an appropriate example.

AKTU 2011-12, Marks 05


OR

Give the conceptual model of UML. use some example to illustrate the
model in detail using diagram.

AKTU 2012-13, Marks 05

Answer
UML, short for Unified Modeling Language, is a standardized modeling
language consisting of an integrated set of diagrams, developed to help
system and software developers for specifying, visualizing, constructing, and
documenting the artifacts of software systems, as well as for business
modeling and other non-software systems. The UML represents a collection of
best engineering practices that have proven successful in the modeling of
large and complex systems. The UML is a very important part of developing
object oriented software and the software development process. The UML
uses mostly graphical notations to express the design of software projects.
Using the UML helps project teams communicate, explore potential designs,
and validate the architectural design of the software. In this article, we will give
you detailed ideas about what is UML, the history of UML and a description of
each UML diagram type, along with UML examples.
Three Aspects of UML:

Figure – Three Aspects of UML


Note – Language, Model, and Unified are the important aspect of UML as
described in the map above.
1. Language:
• It enables us to communicate about a subject which includes the
requirements and the system.
• It is difficult to communicate and collaborate for a team to successfully
develop a system without a language.
2. Model:

• It is a representation of a subject.
• It captures a set of ideas (known as abstractions) about its subject.
3. Unified:

• It is to bring together the information systems and technology industry’s


best engineering practices.
• These practices involve applying techniques that allow us to
successfully develop systems.
A Conceptual Model:
A conceptual model of the language underlines the three major elements:
• The Building Blocks
• The Rules
• Some Common Mechanisms
Once you understand these elements, you will be able to read and recognize
the models as well as create some of them.
Figure – A Conceptual Model of the UML
Building Blocks:
The vocabulary of the UML encompasses three kinds of building blocks:
Things:
Things are the abstractions that are first-class citizens in a model;
relationships tie these things together; diagrams group interesting collections
of things.
There are 4 kinds of things in the UML:
1. Structural things
2. Behavioral things
3. Grouping things
4. Annotational things

These things are the basic object-oriented building blocks of the UML. You
use them to write well-formed models.
Relationships:
There are 4 kinds of relationships in the UML:
1. Dependency
2. Association
3. Generalization
4. Realization
These relationships are the basic relational building blocks of the UML.

Diagrams:
It is the graphical presentation of a set of elements. It is rendered as a
connected graph of vertices (things) and arcs (relationships).
1. Class diagram
2. Object diagram
3. Use case diagram
4. Sequence diagram
5. Collaboration diagram
6. Statechart diagram
7. Activity diagram
8. Component diagram
9. Deployment diagram

Rules:
The UML has a number of rules that specify what a well-formed model should
look like. A well-formed model is one that is semantically self-consistent and in
harmony with all its related models.
The UML has semantic rules for:

1. Names – What you can call things, relationships, and diagrams.


2. Scope – The context that gives specific meaning to a name.
3. Visibility – How those names can be seen and used by others.
4. Integrity – How things properly and consistently relate to one another.
5. Execution – What it means to run or simulate a dynamic model.

Common Mechanisms:
The UML is made simpler by the four common mechanisms. They are as
follows:
1. Specifications
2. Adornments
3. Common divisions
4. Extensibility mechanisms

Ques 21 Describe the pros and cons of unified modelling language


(UML).

AKTU 2012-13, Marks 05

Answer
Advantages of UML

• Most-Used and Flexible


UML is a highly recognized and understood platform for software
design. It is a standard notation among software developers. You can
safely assume that most software professionals will be at least
acquainted with, if not well-versed in, UML diagrams, thus making it the
go-to alternative to explain software design models.
• The Software Architecture Must Be Communicated Effectively
The software architecture is the blueprint of the system. It is the
framework on which the efficiency of the system and its processes
depend.
• Provides standard for software development.
• Reducing of costs to develop diagrams of UML using supporting tools.
• Development time is reduced.
• The past faced issues by the developers are no longer exists.
• Has large visual elements to construct and easy to follow.
Disadvantages of UML

• One disadvantage some developers might find when using UML is the
time it takes to manage and maintain UML diagrams. To work properly,
UML diagrams must be synchronized with the software code, which
requires time to set up and maintain
• UML places much emphasis on design, which can be problematic for
some developers and companies.
• You can't represent every condition in sequence diagram
• Complex to learn and requires time to master completely
• UML software costs money

Ques 22 Why UML required? What are the basic architecture of


UML?

AKTU 2014-15, Marks 05

Answer
Do we really need UML?

• Complex applications need collaboration and planning from multiple


teams and hence require a clear and concise way to communicate
amongst them.
• Businessmen do not understand code. So UML becomes essential to
communicate with non programmers essential requirements,
functionalities and processes of the system.
• A lot of time is saved down the line when teams are able to visualize
processes, user interactions and static structure of the system.
Structural UML Diagrams –
1. Class Diagram – The most widely use UML diagram is the class
diagram. It is the building block of all object oriented software systems.
We use class diagrams to depict the static structure of a system by
showing system’s classes,their methods and attributes. Class diagrams
also help us identify relationship between different classes or objects.

2. Composite Structure Diagram – We use composite structure


diagrams to represent the internal structure of a class and its interaction
points with other parts of the system. A composite structure diagram
represents relationship between parts and their configuration which
determine how the classifier (class, a component, or a deployment
node) behaves. They represent internal structure of a structured
classifier making the use of parts, ports, and connectors. We can also
model collaborations using composite structure diagrams. They are
similar to class diagrams except they represent individual parts in detail
as compared to the entire class.

3. Object Diagram – An Object Diagram can be referred to as a


screenshot of the instances in a system and the relationship that exists
between them. Since object diagrams depict behaviour when objects
have been instantiated, we are able to study the behaviour of the
system at a particular instant. An object diagram is similar to a class
diagram except it shows the instances of classes in the system. We
depict actual classifiers and their relationships making the use of class
diagrams. On the other hand, an Object Diagram represents specific
instances of classes and relationships between them at a point of time.

4. Component Diagram – Component diagrams are used to represent the


how the physical components in a system have been organized. We
use them for modelling implementation details. Component Diagrams
depict the structural relationship between software system elements
and help us in understanding if functional requirements have been
covered by planned development. Component Diagrams become
essential to use when we design and build complex systems. Interfaces
are used by components of the system to communicate with each other.

5. Deployment Diagram – Deployment Diagrams are used to represent


system hardware and its software.It tells us what hardware components
exist and what software components run on them.We illustrate system
architecture as distribution of software artifacts over distributed targets.
An artifact is the information that is generated by system software. They
are primarily used when a software is being used, distributed or
deployed over multiple machines with different configurations.

6. Package Diagram – We use Package Diagrams to depict how


packages and their elements have been organized. A package diagram
simply shows us the dependencies between different packages and
internal composition of packages. Packages help us to organise UML
diagrams into meaningful groups and make the diagram easy to
understand. They are primarily used to organise class and use case
diagrams.

What are the principles of modelling? What is the importance of


modelling?
AKTU 2013-14, Marks 05

OR

What are the basic principles of modelling? Explain in detail.

AKTU 2014-15, Marks 05

Answer
1. The choice of model is important
The choice of what models to create has a profound influence on how a
problem is attacked and how a solution is shaped. We need to choose your
models well.

• The right models will highlight the most critical development problems.
• Wrong models will mislead you, causing you to focus on irrelevant
issues.
For Example: We can use different types of diagrams for different phases in
software development.
2. Every model may be expressed at different levels of precision
For Example,
• If you are building a high rise, sometimes you need a 30,000-foot view
for instance, to help your investors visualize its look and feel.
• Other times, you need to get down to the level of the studs for instance,
when there's a tricky pipe run or an unusual structural element.
3. The best models are connected to reality
All models simplify reality and a good model reflects important key
characteristics.
4. No single model is sufficient
Every non-trivial system is best approached through a small set of nearly
independent models. Create models that can be built and studied separately,
but are still interrelated. In the case of a building:
Importance of Modeling

• You can study electrical plans in isolation


• But you can also see their mapping to the floor plan and perhaps even
their interaction with the routing of pipes in the plumbing plan.
• Permits you to specify the structure or behavior of a system.
• Helps you visualize a system.
• Provides template that guides you in constructing a system.
• Helps to understand complex system part by part.
• Document the decisions that you have made.

You might also like