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

Chapter 1 Exercises Principles of OOP

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 (POP) and discusses the features, benefits, and limitations of both programming paradigms. Additionally, it explains the differences between high-level and low-level languages, as well as compilers and interpreters.

Uploaded by

Agam Stories
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)
7 views

Chapter 1 Exercises Principles of OOP

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 (POP) and discusses the features, benefits, and limitations of both programming paradigms. Additionally, it explains the differences between high-level and low-level languages, as well as compilers and interpreters.

Uploaded by

Agam Stories
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/ 7

Unit 1: Principles of Object Oriented Programming

Fill in the blanks


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

State whether the given statements are TRUE or FALSE

Question 1

Page | 1
UMESH COMPUTER KENDRA (PH: 9897188951)
A process according to which a class acquires the characteristics from another class is
Encapsulation.
False

Question 2

Procedure oriented program stresses on data.


False

Question 3

C++ is also an object-oriented programming language.


True

Question 4

An object is identified by its characteristics.


True

Question 5

Function is a set of objects that share the common state and behaviour.
False

Question 6

Encapsulation keeps data safe from outside interference.


True

Name the following

Question 1

Two categories of Low-Level languages

(a) Assembly Language


(b) Machine Language

Question 2

Two Procedure Oriented Languages

Page | 2
UMESH COMPUTER KENDRA (PH: 9897188951)
(a) BASIC
(b) COBOL

Question 3

Two examples of Data Abstraction in your daily life

(a) Television

(b) ATM

Question 4

Two examples of real-world objects

(a) Mobile

(b) Car

Question 5

Two basic principles of Object-Oriented Programming

(a) Encapsulation
(b) Inheritance

Write short notes with an example (if applicable)


Question 1

Object Oriented Programming

Object Oriented Programming is an approach in which stress is laid on data


rather than functions. The data values remain associated with the functions of a
particular block of the program so as to encourage data security.

Question 4

Machine Level language

For the processor to perform any computation, we need to give the instructions and
data as a sequence of 0's & 1's. This binary sequence that a processor understands
is known as its Machine Level language. Machine Level language is made up of
Page | 3
UMESH COMPUTER KENDRA (PH: 9897188951)
instructions and data that are all binary numbers. Machine Level language of a
processor differs from machine to machine. So programs written in Machine Level
language of one type of processors will not work on a different type of processor.

Question 6

Procedure Oriented Programming

Procedure Oriented Programming basically consists of a list of instructions for the


computer to follow and these are organized into groups known as functions. In
Procedure Oriented Programming, most of the functions share global data and
this data moves more freely from one function to the other function.

Question 8

Assembly Level language

In Assembly Level language, instructions are written in more English like words
knowns as mnemonics. These instructions are not understood by the processor
directly. They are converted into equivalent Machine Level instructions through a
translator program called Assembler. Assembly Level language is machine
dependent that makes it unsuitable for writing portable programs that can execute
across machines.

Distinguish between
Question 1

Object Oriented Programming and Procedure Oriented Programming

Object Oriented Programming Procedure Oriented Programming


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

Question 2

High Level language and Low-Level language


Page | 4
UMESH COMPUTER KENDRA (PH: 9897188951)
High Level language Low Level language
High Level language is machine
Low Level language is machine dependent.
independent.
Low Level language is machine friendly so
High Level language is human friendly so
it is difficult to understand for
it is easy to understand for programmers.
programmers.
High Level language needs a compiler or Low Level language might need a
interpreter for translation to machine code. assembler for translation to machine code.
Programs written in High Level language Programs written in Low Level language
are easier to modify and debug. are hard to modify and debug.

Question 3

Compiler and Interpreter

Compiler Interpreter
It converts the whole source program It converts the source program into the object
into the object program at once. program, one line at a time.
It displays the errors for the whole It displays the error one line at a time and only
program together, after the after fixing that error the control goes to the next
compilation. line.

Answer the following questions

Question 1

Enlist the features of Object-Oriented Programming.

Some of the features of Object-Oriented Programming are:

1. It gives stress on data items rather than functions.


2. It makes the complete program/problem simpler by dividing it into number
of objects.
3. The objects can be used as a bridge to have data flow from one function to
another.
4. The concept of data hiding enhances security in programs.
5. It is highly beneficial to solve complex programs.

Page | 5
UMESH COMPUTER KENDRA (PH: 9897188951)
Question 2

Which OOP principle implements function overloading? Explain

Polymorphism implements function overloading. It is the process of using a


function/method for more than one purpose. In function overloading, we write
more than one function with the same name but differing in the number and types
of their arguments to perform different tasks. This way we get different
behaviours using the same function name.

Question 3

Write three benefits of Object Oriented Programming.

Three benefits of Object Oriented Programming are:

1. The reusability of the program code is enhanced.


2. Data abstraction makes the software easier to handle.
3. Software for complex tasks can be easily developed.

Question 4

Mention two limitations of:

(a) Procedure Oriented Programming

1. No restriction on data values so managing changes is difficult as it impacts


the entire program.
2. It is not suitable to solve complex problems in real situations.

(b) Object Oriented Programming

1. Software developing using OOPs require


2. Solving problems takes more time as compared to Procedure Oriented
Programming.

Page | 6
UMESH COMPUTER KENDRA (PH: 9897188951)
Question 5

How is Encapsulation useful in Object Oriented Programming? Explain

Encapsulation restricts the free flow of data from one object to another. The data
and functions are wrapped together in an object in such a way that the data of a
particular object can only be used in associated functions. Thus, Encapsulation
helps in protecting the data from unauthorised access.

Question 6

What are the advantages of High-Level languages?

1. High Level languages are machine independent.


2. High Level languages are human readable as instructions are written using
English like words and phrases.
3. It is easier to understand and develop the program logic in High Level
languages.
4. The error detection and correction is easier.

Page | 7
UMESH COMPUTER KENDRA (PH: 9897188951)

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