Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

1.

what is the difference between Procedural approach and


Object-Oriented Programming approach?
ANS.

Procedural approach Object-Oriented Programming


approach
I. In Procedural programming language I. In object-oriented programming the
Large programs are divide into smaller program is divided into small parts
program is called functions. called methods.
II. In Procedural programming program is II. In object-oriented programming the
written as a sequence of procedure. program is start from the class.
III. Each procedure `contains a series of Object oriented has access
instructions for performing a specific specifiers like public, private,
task. protected etc.
IV. During the program execution each III. Each object-oriented programming
procedure can be called by the other uses the concept of data
procedures. To call a Procedure we have abstraction.so it is more secure.
to write procedure name only. IV. Code reusability present in the
V. The major emphasis of these languages object-oriented programming.
is in the procedures & not on the data. V. In object -oriented programming,
Procedure programming language allow data is more important than
the data to move freely around the functions. Adding new data and
system. function is easy. Object oriented
VI. Top down program design approach is programming is used for designing
used by procedural programming large and complex programs.
language. VI. Object oriented programming
follows a bottom up approach.

2.What is the difference between compiler and interpreter?


Ans.

COMPILER INTERPRETER
I. Reads Entire Program and I. Reads program Line by Line
Lists All Errors Afterwards. and stops execution on
II. Memory required is more Encountering error.
due to Intermediate object II. Memory Efficient is less as
code. no intermediate code is
generated.
III. Conditional control III. Conditional control
Statements are Executes statements are executing
faster. slower because as after
every statements interpreter
IV. Debugging is difficult as you checks for errors.
have to compile Every time IV. Debugging is easy as the
you correct an error. interpreter immediately
indicates the errors.
V. The compiler is used by the V. An interpreter is used by
language such as c, c++. language such as java,
python.

3. Which one is better compiler or interpreter? Explain.


Ans. Interpreter is better because it converts programming language
code into binary format step by step, line by line compilation take place.
When the first error is occurred, it stops compilation. Each time program
is executed every line is checked for the syntax error & then converted
into equivalent machine code. It is good for easy debugging because it
indicates error immediately.
4. What are the difference between c and c++ languages?
Ans.
C Language C++ Language
I. C was developed by Dennis I. C++ was developed by Bjarne
Ritchie between the year 1969 Stroustrup in 1979.
and 1973 at AT&T Bell Labs. II. C++ supports polymorphism,
II. C does no support encapsulation, and inheritance
polymorphism, encapsulation, because it is an object-oriented
and inheritance which means programming language.
that C does not support object- III. C++ is known as hybrid
oriented programming. language because C++ supports
III. For the development of code, C both procedural and object-
supports procedural oriented programming
programming. paradigms.
IV. Data and functions are IV. Data and functions are
separated in C because it is a encapsulated together in form
procedural programming of an object in C++.
language. V. Data is hidden by the
V. C does not support information Encapsulation to ensure that
hiding. data structures and operators
VI. Function and operator are used as intended.
overloading are not supported VI. Function and operator
in C. overloading are supported by
VII. Header file used by C is C++.
<stdio.h>. VII. Header file used by C++ is
VIII. scanf () and printf () functions <iostream.h>
are used for input/output in C... VIII. cin and cout are used for
input/output in C++.

You might also like