Q1. What is programming paradigm? List the different paradigms for problem solving.
Answer :
Programming Paradigm
A programming paradigm is defined as a pattern or model of programming that includes the complete process of programming. It provides solutions to the problems within the framework. It involves a set of conceptual patterns that helps the user to generate an appropriate solution to a problem. There exists several programming paradigms and the programming techniques provided by each paradigm differs from one another. Whenever a solution is obtained by using a programming paradigm, it is necessary to have a programming language to implement that process. Thus, every high level programming language consists of a programming paradigm.
Paradigms for Problem Solving
The following are the mostly used programming paradigms.
(a) Imperative or procedural paradigm
(b) Functional paradigm
(c) Logical paradigm
(d) Object oriented paradigm.
Q2. Write the difference between OOP and procedure oriented programming.
Answer :
Procedure-Oriented Programming
|
Object-Oriented Programming
|
1. Procedure-Oriented Programming (POP) is
an approach in which a sequence of tasks are to be done.
|
1. Object-Oriented Programming (OOP) is an
approach that modularizes the programs by creating partitioned memory area
for data and methods.
|
2. POP emphasizes on a procedure which
involves certain operations.
|
2. OOP emphasizes on data rather than
procedures.
|
3. In POP, large programs are divided into
functions.
|
3. In OOP, large programs are divided into
objects.
|
4. Data moves openly from one function to
another function in POP.
|
4. Data is hidden and is difficult for
external function to access in OOP.
|
5. In POP, functions share global data as
there are no access specifiers.
|
5. In OOP, functions are tied together in
the data structure because of access specifiers like private or public.
|
6. It is not possible to add data and
functions whenever necessary.
|
6. New data and functions can be easily
added, when required.
|