• Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard
CSEstack

What do you want to Learn Today?

  • Programming
    • Tutorial- C/C++
    • Tutorial- Django
    • Tutorial- Git
    • Tutorial- HTML & CSS
    • Tutorial- Java
    • Tutorial- MySQL
    • Tutorial- Python
    • Competitive Coding Challenges
  • CSE Subject
    • (CD) Compiler Design
    • (CN) Computer Network
    • (COA) Computer Organization & Architecture
    • (DBMS) Database Management System
    • (DS) Data Structure
    • (OS) Operating System
    • (ToA) Theory of Automata
    • (WT) Web Technology
  • Interview Questions
    • Interview Questions- Company Wise
    • Interview Questions- Coding Round
    • Interview Questions- Python
    • Interview Questions- REST API
    • Interview Questions- Web Scraping
    • Interview Questions- HR Round
    • Aptitude Preparation Guide
  • GATE 2022
  • Linux
  • Trend
    • Full Stack Development
    • Artificial Intelligence (AI)
    • BigData
    • Cloud Computing
    • Machine Learning (ML)
  • Write for Us
    • Submit Article
    • Submit Source Code or Program
    • Share Your Interview Experience
  • Tools
    • IDE
    • CV Builder
    • Other Tools …
  • Jobs

Object Oriented Programming Concepts | Asked in Many Interviews

Heena Rajpal/20772/2
C / C++CodeJAVA

“The most basic concept of object-oriented programming, as the name suggests, is an object. Since the concept of object-oriented programming came into the picture, programming could be closer to the real world.

Here, the objects are analogous to real-life objects.

Major Concepts of Object Oriented Programming:

The major concepts of object-oriented programming include:

  • Class and Object
  • Encapsulation
  • Abstraction
  • Inheritance
  • Polymorphism

Class and Object

“Object is a real-world entity.”

You may look around to find various objects like pen, table, fan etc. In fact, you are also an object.

Every object has three basic characteristics:

  • Identity
  • State
  • Behavior
Identity uniquely identifies an object.
For e.g.: your roll number uniquely identifies you.

The current condition of an object is called its state.
For e.g.: a fan can have two states, on and off.

The things that can be done by an object are called its behaviors.
For e.g.: a pen can write, so writing is its behavior.

A formal definition of an object says – “Object is an instance of the class.”

This brings us to the second concept of object-oriented programming – ‘Class’. If we group a number of similar objects into one unit, we obtain a class.

For e.g.: a group of people like you can form a class called 'Student'. 
In other words, Student class has various instances (or objects) and one of them is you.

Every student has certain properties like name, roll no., class etc. 
Also, students can perform various operations 
like 'get fee structure', 'pay fee', 'get result' etc.

These properties are attributes of a class and the operations are methods or behavior of a class.

If you are preparing for placement, you will come across many interview questions on object-oriented programming concepts. Here are some basic questions.

What is Encapsulation?

The process of grouping these attributes and behaviors into a single unit is known as encapsulation.

Wha is Abstraction?

Now, a student can have many attributes like name, age, DOB, address, contact no., gender, height, weight, complexion, favorite food etc.

But an educational institution won’t ask for all these attributes from a student. It will ask for only necessary attributes like name, age, DOB, address, contact no. and gender. It has nothing to do with your height, weight, complexion, food preferences etc. This process of sustaining only essential and relevant information and discarding the rest is known as abstraction.

Abstraction Programming in Detail

  • Abstraction in Java

What is Inheritance?

When one class acquires the properties of another class, it is known as inheritance. The class that gives the properties is called superclass and the class that acquires the properties is called subclass.

For e.g. Animal can be a super class. 
Its subclasses can be Herbivores, Carnivores and Omnivores. 
The common properties like 4 legs can be placed in Animal class. 

The behavior 'eats grass' is only for Herbivores, so it cannot be kept in Animal class. 
However, if Herbivores inherits Animal class, 
the property that Herbivores have 4 legs does not need to be redefined.

The major benefit of inheritance is reusability of code.

Inheritance Programming in Detail:

  • Inheritance in C++
  • Inheritance in Java

What is Polymorphism?

The last major concept of object oriented programming is Polymorphism. ‘Poly’ means many and ‘morph’ means forms. This means it has statements that have many forms.

For e.g.: "greet" is a behavior. 

If you ask an Indian to greet, he will say "Namaste". 
An American may say "Hello". 
And in France, you'll come across "Salut".

This means that ‘greet’ means different things to different people. This is the concept of polymorphism.

There are two types of polymorphism:

  • Static/ Compile-time polymorphism
  • Dynamic/ Run-time polymorphism

The type depends on whether the meaning of the message is determined at compile time or run time.

These object oriented concepts are followed by most of the object oriented programming languages like C++, Java…

If you have any doubt, please ask in the comment section before proceeding for further programming tutorial.

OOPs ConceptProgramming
Heena Rajpal
Heena Rajpal is pursuing Computer Science Engineering from Indore. She has a knack for writing and an inquisitive outlook towards Computer Science fields like Database Management Systems, Object Oriented Programming and languages like C, C++, JAVA, Python, HTML etc.

Your name can also be listed here. Got a tip? Submit it here to become an CSEstack author.

Comments

  • Reply
    Swapnil jain
    August 8, 2016 at 5:04 pm

    Thanks a lot Mam as I was really facing some issue in understanding this particular concept. It would be great if you can write more about java and python.

  • Reply
    Shivangi Vaidya
    August 9, 2016 at 1:57 pm

    This language and the examples used, truly helped me clear my concepts. Madam, kindly inform me if you take any private tuition classes. I am very much interested.

Leave a Reply Cancel reply

C Programming

  1. C- Introduction
  2. C- Compile & Execute Program
  3. C- Data Types
  4. C- if-else statement
  5. C- While, do-while, for loop
  6. C- Array
  7. C- Function (Types/Call)
  8. C- strlen() vs sizeof()
  9. C- Nested Switch Statement
  10. C- Recursion
  11. C- Dynamic Programming
  12. C- Storage Classes
  13. C- Creating Header File
  14. C- Null Pointer
  15. C- Stack and Queue
  16. C- Implement Stack using Array
  17. C- Implement Linked List in C
  18. C- File Handling
  19. C- Makefile Tutorial

Object Oriented Concepts in C++

  • C++: C vs OOPs Language
  • C++: Introduction to OOPs Concepts
  • C++: Inheritance

Sorting Algorithms

  • Different Types of Sorting Algo
  • Selection Sort
  • Bubble Sort
  • Quick Sort

Programming for Practice

  1. Online C/C++ Compiler

String Handling:

  1. Remove White Spaces from String
  2. Implement strstr Function in C
  3. Convert String to Int – atoi()
  4. Check if String is Palindrome
  5. Check if Two Strings are Anagram
  6. Split String in using strtok_r()
  7. Undefined reference to strrev

Array:

  1. Check if Array is Sorted

Bit Manipulation:

  1. Count Number of 1’s in Binary

Linked List:

  1. Reverse a Linked List Elements

Number System:

  1. Program to Find 2’s Complement
  2. Convert Decimal to Binary in C

Tricky Questions:

  1. Add Two Numbers without Operator
  2. Find Next Greater Number
  3. Swap values without temp variable
  4. Print 1 to 100 without Loop

Interview Coding Questions

  • 50+ Interview Coding Questions

© 2022 – CSEstack.org. All Rights Reserved.

  • Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard