Basic Concepts of OOP

Unit 1 Β· Topic 1.3⏱ 10 min read❓ 5 MCQs

Introduction

The basic concepts of OOP are: Objects, Classes, Abstraction, Encapsulation, Inheritance, Polymorphism, Dynamic binding, and Message passing.

Definition

Object: A runtime entity combining data and functions. Class: A blueprint for objects.

C++ Illustration

class Employee {
    int id; string name;
public:
    void set(int i,string n){id=i;name=n;}
    void show(){cout<<id<<" "<<name<<endl;}
};

Important Questions

Short Questions

  1. Define object.
  2. Define class.
  3. What is abstraction?
  4. What is encapsulation?

Long Questions

  1. Explain the basic concepts of OOP.
  2. Differentiate class and object.

MCQ Practice

1. A class is a:

  • Blueprint
  • Instance
  • Variable
  • Function
Answer: blueprint.

2. An object is:

  • Instance of class
  • Blueprint
  • Keyword
  • Operator
Answer: instance.

3. Message passing means:

  • Objects communicate via methods
  • Passing variables
  • Inheritance
  • Compilation
Answer: objects communicate via methods.

4. Dynamic binding occurs at:

  • Compile time
  • Run time
  • Link time
  • Never
Answer: run time.

5. Which is NOT a basic OOP concept?

  • Inheritance
  • Polymorphism
  • Compilation
  • Abstraction
Answer: compilation.

Quick Revision

  • Object = data + functions.
  • Class = blueprint.
  • 8 core concepts.