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

unit 5

Class 12 computer science unit 5 notes.

Uploaded by

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

unit 5

Class 12 computer science unit 5 notes.

Uploaded by

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

Unit 5- Object Oriented Programming

Q. Write down the differences between Object Oriented Programming(OOP)


and Structured Programming Language(SPL) or Procedural Oriented
Language(POP).
OOP SPL/POP
a. OOP focuses on representing a. SPL deals with organizing the
problems using real world objects problem in a logical structure(i/p,
and their behavior. process and o/p)
b. Large programs are divided into b. Large programs are divided into
objects. functions.
c. Developing programs using OOP c. Developing program using SPL is
language is quite easier and less difficult and more time consuming.
time consuming.
d. New data and functions can be d. Adding new data and functions
easily added wherever required. are difficult & time consuming
task.
OOP SPL
e. The concept of inheritance e. Code reusability is still difficult.
provides the idea of reusability.
f. Data can be hidden, so that non g. Generally data cannot be
member function cannot access hidden.
them.
g. E.g. JAVA, Python, Smalltalk etc. f. E.g. C, QBASIC, PASCAL etc.
Q. Define OOP. Explain the characteristics or features of OOPs.
Ans: OOP is a programming paradigm(model) in which emphasis is given on
data rather than process. Currently, OOPs such as Java, C++, C#, Python and
JavaScript are popular OOP programming language.
The features of OOPs are:
i. Object: An object is an entity , thing or organization that exists in real world.
It consist of two fundamental characteristics i.e. attribute and behavior. In
OOPs, attributes are represented by data and the behaviors are represented
by functions.
E.g. Object name
data (attribute)
data 1
data 2
………..
………..
data n

function (behavior)
function 1
function 2
…………….
…………….
function n
ii. Class: A class is the collection of similar objects. It is defined as the
template to define the common attributes and behavior for all the objects of
the class.
E.g. class fruit
object1 banana
object2 apple
object3 pine apple
………………..
object n strawberry

iii. Data abstraction: Abstraction is the act of representing essential features


without including the background details like a switch board.
iv. Encapsulation: The wrapping up of data and function together into a
single unit is called encapsulation. This feature keep data safe from outside
interference (interfering) and misuse. This led to a concept of data hiding.

v. Inheritance : The process of creating a new class from an existing class in


which object of the new class inherit the attribute and behavior of the existing
class is known as inheritance.
Newly created class is called derived class/child class/ sub class and
the class from which new class is created is called base class/ parent class/
super class.
The different types of inheritance are:
a. Single inheritance: Single inheritance enables a
derived class to inherit properties and behavior from
a single parent class.
b. Multiple inheritance: Multiple inheritance is a feature of some
object-oriented computer programming languages in which an object
or class can inherit characteristics and features from more than one
parent object or parent class.
c. Hierarchical inheritance : When more than one classes are derived
from a single base class, such inheritance is known as Hierarchical
Inheritance.
d. Multi level inheritance: If we take the example of above diagram
then class C inherits class B and class B inherits class A which means
B is a parent class of C and A is a parent class of B. So in this case
class C is implicitly inheriting the properties and method of class A
along with B that's what is called multilevel inheritance.
e. Hybrid inheritance: Hybrid inheritance is a combination of multiple
inheritance and multilevel inheritance. A class is derived from two
classes as in multiple inheritance.
vi. Polymorphism: The term polymorphism is formed by the combination
of two Greek words- poly(many) and morph( forms). So, the meaning of
polymorphism is having many forms.
Q. What are the merits and demerits of OOPs?
Ans: Merits are:
a. Improved Software development productivity: It provides
improved software development productivity over traditional
procedure based programming technique.
b. Improved software maintainability: Program are not
disposable. Object oriented s/w is also easier to maintain.
c. Faster development: Reuse enables faster development.
d. Lower cost of development: The reuse of s/w also lower the
cost of development.
e. Higher quality s/w: Quality is dependent upon the
experience of the team, object oriented programming tends
to result in higher quality s/w.
Demerits are:
a. Steep (unreasonable) learning curve: It is complex to create
program based on interaction of object. Some of the key
programming techniques, such as inheritance and
polymorphism, can be challenging to comprehend( understand)
initially.
b. Larger program size: Object oriented programs typically
involve more lines of code than procedural programs.

c. Slower program: Object oriented programs are typically slower


because require more instruction to be executed.

d. Not suitable for all types of problems: There are problems


that provide themselves well to functional-programming style,
logic-programming style or procedure based programming style
in those situation will not suitable.
Q. Write short notes on data/information hiding in OOPs.

Ans: Data hiding is a software development technique specially used


in object-oriented programming (OOP) to hide internal object details
(data members). Data hiding ensures private data access to class
members and protects object integrity(accurate).
Data hiding also reduces system complexity for increased strength by
limiting interdependencies between software components.

Data hiding is also known as data encapsulation or information


hiding.
Q.3 What are the application area of object oriented language? Explain any
5 briefly. (Assignment)
Ans: The application area of OOPs are:
i. Image processing
ii. Computer Aided Design(CAD)
iii. Object oriented DBMS
iv. Internet & web based application
v. Mobile computing
vi. Digital electronics.
vii. Client-Server system
viii. Computer animation and gaming
ix. AI expert system

END of UNIT 5

You might also like