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

Introduction to OOP and Java

Uploaded by

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

Introduction to OOP and Java

Uploaded by

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

CH1.

INTRODUCTION TO OOP CONCEPTS

A. Define/ Write short note on the following terms:

1. Program: is a set of instructions using a programming language to perform a specific task.

2. Software: is a set of programs that are used to activate and supervise the working of various
hardware devices and also to get various tasks done for us.

3. Programming Languages: These are computer languages which are used to develop different
applications to get the work done from a computer.

4. Types of Programming Languages : The programming Languages can be broadly classified as (a) Low
Level Languages (b) High Level Languages

5. Low Level Languages : These are machine-oriented and require extensive knowledge of computer
circuitry. These were the first generation computer languages and are further divided as:
(i) Machine Language : Machine language is the one in which instructions are written using
Binary Digits (Bits - 0’s and 1’s) . The code thus written is known as Source Code and is directly
understood and executed by a computer.

(ii) Assembly Language: This is development over Machine Language in which instructions are
given using special words (known as Mnemonics). These words are to be converted to
machine code using a translator known as Assembler.

6. High Level Languages : These are user-friendly programming languages in which instructions are
written using simple English-like statements. However , we need to use special translators like
Compiler / Interpreter to convert them to machine readable form.

7. Different Generations of Programming Languages :


i) First Generation Programming Language (1GL) : is a machine language that consisted of 0’s
and 1’s. The advantage is that the program runs very fast and efficiently.

ii) Second Generation Programming Language (2GL) : is a term that refers to some form of
assembly language. It requires use of an assembler to convert the Mnemonics to Machine
Code(Object Code)

iii) Third Generation Programming Language (3 GL ): is a programming language designed to be


easier for a human to understand, using normal language like words such as if, repeat, while
etc., They use a translator like Compiler or Interpreter or even both

iv) Fourth Generation Programming Language (4 GL) : is designed to be closer to natural


language than a Third Generation Language and are non-procedural in nature. They are
designed to reduce-programming effort, time and cost of software development.

v) Fifth Generation Programming Language (5 GL) : is based around solving problems using
constraints entered by the programmer, which the computer uses to solve the given problem.
These are mostly used in Artificial Intelligence research. Eg: Prolog, Mercury
8. Programming Paradigm : It is an approach to programming. It refers to organising principle of a
program. Some of the paradigms available are – Procedural programming, Modular programming,
structural programming, Object oriented programming

9. Procedure Oriented Programming (POP) : In this approach, program is viewed as a sequence of


instructions. Concentration is on CODE i.e. how to solve a problem. Code maintenance is relatively
complex. Eg: C, Pascal

10. Modular Programming : is a program that consists of a number of modules that work independently
of all others. Each module can work with its own data as well with data passes to it.

11. Object Oriented Programming (OOP) : In this approach, a program is viewed as a collection of object
with variables and related methods: The concentration is on DATA i.e. what to do rather than how to
do. Code maintenance is simple due to the modularity feature. Eg: C++, Java, Small Talk, Simula, Eiffel
etc..

12. Concepts of OOP : Class – Object – Abstraction- Message Passing- Data hiding

a) Class : is a prototype or blueprint that defines objects of a particular type with similar state and
behavior. It is a logical construct and doesn't occupy any memory. It is termed as an Object
factory as it is used to create objects. It is considered user efined/derived/reference/composite
data type as it is created out of objects with different types of variables and related methods.

b) Object : is a physical entity with its own state and behavior. An object requires memory for
storage. The state is implemented through the variables and behavior is implemented through
methods. All objects of a particular class will exhibit similar traits.. As all the objects of a given
class share the similar characteristics, object is called as an instance of class.

c) Abstraction : It is the process of hiding the implementation details/complexity of a system. It


helps the user to concentrate what to do rather than how to do. It is implemented using
Encapsulation.

d) Message passing : Objects communicate with each other by passing a request and providing a
reply thus making the java programs dynamic. The communication happens using
Parameters/Arguments.

e) Modularity : the process of dividing the entire code into smaller and controllable blocks. It is a
block of instructions that can be independently maintained for other objects.

f) Information hiding : It is one of the advantages provided by Encapsulation. It protects data from
unnecessary changes and damages.

13. Principles of OOP : Encapsulation - Inheritance – Polymorphism

a) Encapsulation The wrapping up of data and functions/code into a single unit called class. It is a
way to implement Data Abstraction. It acts as a protective layer from DATA being mishandled and
helps in DATA HIDING.
b) Inheritance the property by which an object of a class derives the properties of another class
while retaining its own features is known an Inheritance. It helps in code reusability and reducing
the code redundancy as well as complexity.

c) Polymorphism it is the ability of an object to behave differently at various instances. It helps to


use the existing modules with different data types. It is implemented using Overloading of
methods.
14. Two advantages and two limitations of OOP :

a) Advantages : (i) Existing Code can be reused an d(ii) Easy redesign and extension

b) LImitatations : (i) Proper planning is needed for design and (ii) classes tend to be generalised.

15. Differentiate between the following :

a) POP and OOP

POP OOP
1. Focus is on CODE i.e. how to do 1. Focus is on DATA i.e. what to do
2. Program is viewed as a series of 2. Program is viewed as a set of
instructions instructions
Eg: Pascal, C Eg: C++, Java

b) Class and Object :

Class Object
1. Is a logical construct and 1. Is a physical entity that occupies
doesn’t occupy any memory memory
2. Is a collection of objects and is 2. Is an instance of class as it is created
known as Object factory out of a class

c) Base class/Parent Class and Derived Class/Child class :

Base/ Parent Class Derived / Child Class


1. Is a class from which other 1. Is a class that is derived out of a base class
classes derive their
features.
2. It exhibits its own features 2. It may retain its own features while
deriving the features of base class.

*** End of Chapter 1 ***


Ch 2. Introduction to Java and BlueJ

You might also like