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

Ch. - 01. Principles of Object Oriented Programming(Part I)

The document covers the principles of Object Oriented Programming (OOP) including key concepts such as data abstraction, encapsulation, inheritance, and polymorphism. It contrasts OOP with Procedure Oriented Programming, highlighting differences in focus on data versus functions, and discusses the advantages and limitations of both programming paradigms. Additionally, it addresses high-level versus low-level languages and the roles of compilers and interpreters in programming.

Uploaded by

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

Ch. - 01. Principles of Object Oriented Programming(Part I)

The document covers the principles of Object Oriented Programming (OOP) including key concepts such as data abstraction, encapsulation, inheritance, and polymorphism. It contrasts OOP with Procedure Oriented Programming, highlighting differences in focus on data versus functions, and discusses the advantages and limitations of both programming paradigms. Additionally, it addresses high-level versus low-level languages and the roles of compilers and interpreters in programming.

Uploaded by

vedu yo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Ch. - 01.

Principles of Object Oriented Programming (Part I)


PART A - COMPETENCY FOCUSED QUESTIONS:
II. Fill in the blanks :
1. An act of using essential features without including background details is called __ data abstraction __
2. In an Object Oriented Programming, the stress is given on __ data items __
3. Wrapping of data and function together as a single unit is called __ Encapsulation __
4. An __ object __has unique identity through which it may differ with some characteristics and behaviour.
5. The objects may communicate with each other through __ functions __
6. In POP, the global data are loosely attached to the __ functions __
7. The process by which a class acquires the property of another class is known as __ inheritance __
8. In Object Oriented Programming, using a function for many purposes is termed as __ polymorphism __

III. State whether the given statements are TRUE or FALSE


1. A process according to which a class acquires the characteristics from another class is Encapsulation. false
2. Procedure oriented program stresses on data. false
3. C++ is also an object oriented programming language. true
4. An object is identified by its characteristics. true
5. Function is a set of objects that share the common state and behaviour. true
6. Encapsulation keeps data safe from outside interference. true

PART B - SUBJECTIVE QUESTION:


I. Write short notes with an example (if applicable):
1. Object Oriented Programming
Ans : Object Oriented Programming (OOP) is a modular approach which allows the data to be applied within a
stipulated program area. The main aim of OOP is to bind data and functions together so that no other part of the code
can access this data except that function.

2. Data Abstraction
Ans : Data abstraction is the act of representing the essential features without knowing the background details. It is
always relative to the purpose of the uses.
For example, most of us know to use the essential features of a camera to click and view pictures without knowing its
internal mechanism. Likewise, data abstraction allows us to use certain features in Java without knowing the other
background details.

3. Encapsulation
Ans : The system of wrapping data and functions into a single unit is known as Encapsulation.

4. Machine Language
Ans : Machine language is any low-level programming language with instructions for controlling the CPU. It's a
binary format of 0s and 1s. This form of binary instructions is also called machine code or object code. The computer
understand the machine code easily and execute directly.

5. Polymorphism
Ans : The term Polymorphism is defined as the process of using a functions or method for more than one purpose.
For example, the function name Volume( ) can be used by different functions to calculate the volume of a cube or the
volume of a cuboid etc. as follows:
Volume(int s)
{

}
Volume(int l, int b, int h)
{

6. Procedure Oriented Programming


Ans : Procedure oriented programming language focuses on the functions rather than the data. the data values may
keep floating throughout the program in an unrestricted and insecured manner.

Page 1 of 3
7. Inheritance
Ans : Inheritance can be defined as the process where one class acquired the properties of another class. the class
which inherits the properties of the other class is known as sub class (derived class) and the class whose properties are
inherited is known as super class (base class).
For example, consider a class ‘Vehicle’ and another class ‘Car. Assuming that the ‘Vehicle’ class is already available,
the ‘Car’ class can created by reusing many of the features of the ‘Vehicle’ class.
Base class – The existing class whose properties are inherited by another class is called as the Base class/ Super
class/Parent class.
Derived class – The class that acquires the properties from an existing class is known as Derived class/ Subclass/ Child
class.
In the above example, the ‘Vehicle’ class is the Base class and the ‘Car’ class is the Derived class.

8. Assembly Language
Ans : A language, in which the instructions are coded in term of mnemonics and op-codes(or operation codes), is
known as assembly language. the mnemonics are the abbreviated forms of the instructions, used to write a program.
Whereas, op-codes are the numeric codes of the instruction that are actually fed to the computer for execution.
Example, LD A, LD B, ADD A, B, ST C etc.

II. Distinguish between:


1. Object Oriented Programming and Procedure Oriented Programming
Procedure Oriented Programming Object Oriented Programming
 The stress is on the function rather than the data.  The stress is put on data rather than functions.
 It allows the data to flow freely throughout the program  The data is restricted to be used in a specific
 It follows top-down programming approach. program area.
 It follows bottom-up programming approach.

2. High Level Language and Low Level Language


High Level Language Low Level Language
 It is programmer friendly language.  It is a machine friendly language.
 It is a machine independent language.  It is a machine dependent language.
 It is easy to understand.  It is tough to understand.
 The error detection and correction is easier.  The error detection and correction is not easier.

3. Compiler and Interpreter


Compiler Interpreter
 It converts the whole source program into the  It convert the source program into the object
object program all at once. program one line at a time.
 It display the errors for the complete program  It display the errors, one line at a time and only
together after the compilation. after debugging that error does the control shift to
the next line.

III. Answer the following questions:


1. Enlist the features of Object-Oriented Programming.
Ans. i) The focus is on the data items rather than functions.
ii) It makes the complete program simpler by dividing it into a number of objects.
iii) The objects can be used as a bridge to have data flow from one function to another.
iv) The concept of data hiding enhances security in programs.
v) It is highly beneficial to solve complex problems.

2. Which OOP principle implements function overloading? Example.


Ans. Polymorphism. Polymorphism is the process of using a function or method for more than one purpose. This is
achieved by creating many methods or functions with the same name but different parameters.
For example, the function name Volume( ) can be used by different functions to calculate the volume of a cube or the
volume of a cuboid etc. as follows:
Volume(int s)
{
}
Volume(int l, int b, int h)
{
}
Page 2 of 3
3. Write three benefits/preferences of Object Oriented Programming.
Ans : Three benefits/preferences of Object Oriented Programming:
i) The reusability of the program code is enhanced.
ii) The software quality and performance are improved.
iii) Data traction make the software easier to handle.
iv) Software for complex tasks can easily by developed.

4. Mention two limitation of :


a) Procedure Oriented Programming
Ans: i) The data values are global to all the functions. In case of any change in the data values, you may require to
make necessary changes in all the functions.
ii) It is not suitable to solve complex problems in real situations.

b) Object Oriented Programming


Ans: i) Object Orient Programming language require intensive testing processes.
ii) Solving problems is more time consuming as compared to Procedure Oriented Programming.

5. How is in encapsulation useful in object oriented programming? Explain.


Ans : Encapsulation is helpful in object oriented programming in the following ways:
i) The source code of an object could be maintained independently.
ii) The object maintain the privacy of the data members. However, the changes that take place in the methods do not
affect the other objects.

6. What are the advantages of High Level Languages?


Ans : The following advantages of High Level Languages are :
i) It is a machine independent language.
ii) The instructions can be written using English words or phrases.
iii) It is easier to understand and develop the program logic.
iv) The error detection and correction is easier.

Page 3 of 3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy