Question:medium

Which of the following programming language uses objects, classes, inheritance, and polymorphism?

Show Hint

Four pillars of Object-Oriented Programming:
• Encapsulation
• Abstraction
• Inheritance
• Polymorphism Among the given options, C++ is the language that supports all these OOP features.
  • BASIC
  • C++
  • FORTRAN
  • COBOL
Show Solution

The Correct Option is B

Solution and Explanation


Step 1:
Understand the concept of a Class.
A class acts as a blueprint for creating objects. For example: \[ \text{Class } = \text{Student} \] Objects created from this class may represent individual students.

Step 2:
Understand Inheritance.
Inheritance allows one class to acquire the properties and methods of another class. This promotes:
• Code reusability
• Reduced development effort
• Better software organization

Step 3:
Understand Polymorphism.
Polymorphism allows the same function name or interface to perform different tasks depending on the context. It is one of the most powerful features of object-oriented programming.

Step 4:
Analyze the given options.

• BASIC – Primarily procedural.
• FORTRAN – Mainly used for scientific computation.
• COBOL – Designed for business applications.
• C++ – Fully supports classes, objects, inheritance, encapsulation, and polymorphism.

Step 5:
Identify the correct language.
Since C++ provides all major object-oriented programming features, it satisfies the requirements stated in the question. \[ {\text{C++}} \] Therefore, the correct answer is option (B).
Was this answer helpful?
0


Questions Asked in Karnataka PGCET exam