Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views7 pages

What Are The Two Major Types of Programming Languages? Explain

The document discusses two major types of programming languages: procedural and object-oriented programming (OOP), highlighting their characteristics and examples. It explains the concepts of OOP, including data abstraction, encapsulation, inheritance, and polymorphism, along with the advantages and disadvantages of OOP. Additionally, it defines classes and objects, and describes byte code as an intermediate code generated by a compiler for Java programs, emphasizing its role in platform independence.

Uploaded by

smtpraveenpandey
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)
20 views7 pages

What Are The Two Major Types of Programming Languages? Explain

The document discusses two major types of programming languages: procedural and object-oriented programming (OOP), highlighting their characteristics and examples. It explains the concepts of OOP, including data abstraction, encapsulation, inheritance, and polymorphism, along with the advantages and disadvantages of OOP. Additionally, it defines classes and objects, and describes byte code as an intermediate code generated by a compiler for Java programs, emphasizing its role in platform independence.

Uploaded by

smtpraveenpandey
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

1. What are the two major types of programming languages? Explain.

The two major types of programming languages, based on their approach to


organizing code, are procedural and object-oriented programming.

Procedural Programming:
• This approach focuses on writing a series of instructions (procedures) for the
computer to execute in a specific order.
• It's like a recipe, where steps are executed one after the other.
• Examples include languages like C and Pascal.

Object-Oriented Programming (OOP):


• This approach organizes code around objects, which are like real-world
entities with attributes (data) and behaviors (functions).
• It promotes modular and reusable code.
• Examples include languages like Java and Python.

2. Why low-level languages considered close to the machine?

Low-level language refers to a type of programming language that is closer to


machine code and hardware than high-level languages. It provides direct
control over the computer's hardware and resources, allowing programmers to
write code at a more granular level.

3. Why High-level languages considered close to the programmer?

High-level languages are considered "close to the programmer" because they


are designed to be easier for humans to understand and write, using more
natural language-like syntax and abstractions, rather than the low-level details
of computer hardware.

4. What are programming paradigms? Give name of popular


programming paradigms.

Paradigm can also be termed as method to solve some problem or do some


task. Programming paradigm is an approach to solve problem using some
programming language or also we can say it is a method to solve a problem
using tools and techniques that are available to us following some approach.
• Procedural programming
• Modular Programming
• Object oriented programming –

5. What is OOPs? Explain its concepts.


Object-Oriented Programming or OOPs refers to languages that use objects in
programming. Object-oriented programming aims to implement real-world
entities like inheritance, hiding, polymorphism, etc in programming. The main
aim of OOP is to bind together the data and the functions that operate on them
so that no other part of the code can access this data except that function.
OOPs Concepts:
• Data Abstraction
• Encapsulation
• Inheritance
• Polymorphism

1. Data Abstraction:
Data abstraction is one of the most essential and important features of object-
oriented programming. Data abstraction refers to providing only essential
information about the data to the outside world, hiding the background details
or implementation. Consider a real-life example of a man driving a car. The
man only knows that pressing the accelerators will increase the speed of the
car or applying brakes will stop the car, but he does not know about how on
pressing the accelerator the speed is increasing, he does not know about the
inner mechanism of the car or the implementation of the accelerator, brakes,
etc in the car. This is what abstraction is.
2. Encapsulation:
Encapsulation is defined as the wrapping up of data under a single unit. It is
the mechanism that binds together code and the data it manipulates. In
Encapsulation, the variables or data of a class are hidden from any other class
and can be accessed only through any member function of their class in which
they are declared. As in encapsulation, the data in a class is hidden from other
classes, so it is also known as data-hiding.
Consider a real-life example of encapsulation, in a company, there are
different sections like the accounts section, finance section, sales section, etc.
The finance section handles all the financial transactions and keeps records of
all the data related to finance. Similarly, the sales section handles all the sales-
related activities and keeps records of all the sales. Now there may arise a
situation when for some reason an official from the finance section needs all
the data about sales in a particular month. In this case, he is not allowed to
directly access the data of the sales section. He will first have to contact some
other officer in the sales section and then request him to give the particular
data. This is what encapsulation is. Here the data of the sales section and the
employees that can manipulate them are wrapped under a single name “sales
section”.
3. Inheritance:
Inheritance is an important pillar of OOP(Object-Oriented Programming). The
capability of a class to derive properties and characteristics from another class
is called Inheritance. When we write a class, we inherit properties from other
classes. So when we create a class, we do not need to write all the properties
and functions again and again, as these can be inherited from another class
that possesses it. Inheritance allows the user to reuse the code whenever
possible and reduce its redundancy.

4. Polymorphism:
The word polymorphism means having many forms. In simple words, we can
define polymorphism as the ability of a message to be displayed in more than
one form. For example, A person at the same time can have different
characteristics. Like a man at the same time is a father, a husband, an
employee. So the same person posses different behavior in different
situations. This is called polymorphism.
6. What are Advantages and Disadvantages of OOP

Benefits of OOP
• OOP language allows to break the program into the bit-sized problems
that can be solved easily.
• The new technology promises greater programmer productivity, better
quality of software and lesser maintenance cost.

• OOP systems can be easily upgraded from small to large systems.

• It is possible that multiple instances of objects co-exist without any


interference.

• It is very easy to partition the work in a project based on objects.

• It is possible to map the objects in problem domain to those in the


program.

• The principle of data hiding helps the programmer to build secure


programs which cannot be invaded by the code in other parts of the
program.

Disadvantages of OOP

• The length of the programmes developed using OOP language is much


larger than the procedural approach. Since the programme becomes
larger in size, it requires more time to be executed that leads to slower
execution of the programme.

• We cannot apply OOP everywhere as it is not a universal language. It is


applied only when it is required. It is not suitable for all types of
problems.

• Programmers need to have brilliant designing skill and programming skill


along with proper planning because using OOP is little bit tricky.

• OOPs take time to get used to it. The thought process involved in object-
oriented programming may not be natural for some people.
• Everything is treated as object in OOP so before applying it we need to
have excellent thinking in terms of objects.

Modular programming:

• Emphasis on algorithm rather than data.


• Programs are divided into individual modules.
• Each modules are independent of each other and have their own local
data.
• Modules can work with its own data as well as with the data passed to
it.

Procedural programming:

• Programs are organized in the form of subroutines or sub programs.


• All data items are global.
• Suitable for small sized software application.
• Difficult to maintain and enhance the program code as any change in
data type needs to be propagated to all subroutines that use the same
data type.

7. Define class and Object.

1. Class:
A class is a user-defined data type. It consists of data members and member
functions, which can be accessed and used by creating an instance of that class.
It represents the set of properties or methods that are common to all objects
of one type. A class is like a blueprint for an object.
For Example: Consider the Class of Cars. There may be many cars with
different names and brands but all of them will share some common
properties like all of them will have 4 wheels, Speed Limit, Mileage range, etc.
So here, Car is the class, and wheels, speed limits, mileage are their properties.
2. Object:
It is a basic unit of Object-Oriented Programming and represents the real-life
entities. An Object is an instance of a Class. When a class is defined, no memory
is allocated but when it is instantiated (i.e. an object is created) memory is
allocated. An object has an identity, state, and behavior. Each object contains
data and code to manipulate the data. Objects can interact without having to
know details of each other’s data or code, it is sufficient to know the type of
message accepted and type of response returned by the objects.
For example “Dog” is a real-life Object, which has some characteristics like
color, Breed, Bark, Sleep, and Eats.

Object

8. Define Byte Code. How is Byte Code generated?

Byte Code
Byte Code can be defined as an intermediate code generated by the compiler
after the compilation of source code (JAVA Program). This intermediate code
makes Java a platform-independent language.
How is Byte Code generated?
Compiler converts the source code or the Java program into the Byte Code (or
machine code), and secondly, the Interpreter executes the byte code on the
system. The Interpreter can also be called JVM (Java Virtual Machine). The
byte code is the common piece between the compiler (which creates it) and
the Interpreter (which runs it).

You might also like