Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
Python 10 questions

Object-Oriented Programming (OOP)

Master OOP in Python. Learn inheritance, polymorphism, double underscore methods, property decorators, and classes.

More Python
Interview questions 1–10 of 10
1

What is Object-Oriented Programming (OOP) and what are its 4 pillars?

OOP is a programming paradigm based on objects and classes. The 4 pillars of OOP are: Encapsulation, Inheritan...

Read answer →
2

What is the difference between a class and an object?

AspectClassObjectDefinitionBlueprint/templateInstance of classTypeLogical entityPhysical entityCreatedOnce dur...

Read answer →
3

What are constructors and destructors in Python?

class Person: def __init__(self, name, age): print('Constructor called') self.name = name...

Read answer →
4

What are the different types of inheritance?

TypeDescriptionExampleSingleOne parent, one childclass Dog(Animal)MultipleMultiple parents, one childclass Car...

Read answer →
5

What is inheritance and how does it work in Python?

class Animal: def __init__(self, name): self.name = name def speak(self): print(f...

Read answer →
6

What is polymorphism and how does it work?

# Method Overriding (Compile-time Polymorphism) class Shape: def area(self): pass class Circle(Sh...

Read answer →
7

What is encapsulation and how do you achieve it?

class BankAccount: def __init__(self, balance): self.__balance = balance # Private (double unders...

Read answer →
8

What is abstraction and how do you implement it?

from abc import ABC, abstractmethod # Abstract class class Vehicle(ABC): @abstractmethod def start(se...

Read answer →
9

What are class methods and static methods?

TypeDecoratorReceivesUse CaseInstance@propertyselfInstance dataClass Method@classmethodclsClass dataStatic Met...

Read answer →
10

What is method overriding and method overloading?

# Method Overriding - same method name, different implementation class Parent: def method(self): p...

Read answer →