OOP (Object-Oriented Programming)
- What are the four pillars of OOP?
- Difference between class and object?
- What is inheritance? Types of inheritance in Python?
- Explain polymorphism with an example.
- What is encapsulation and how is it implemented in Python?
- What is method overriding and method overloading in Python?
Loops
- Difference between for and while loop?
- What is the use of break, continue, and pass?
- How can you loop through a dictionary or list?
If-Else
- How does if __name__ == '__main__' work?
- Can you use if-else in one line? (Ternary operator)
- How to handle nested if-else logic in a clean way?
Arrays
- Difference between list and array in Python?
- How do you access elements in an array?
- How to perform slicing in an array?
- Which module is used for arrays in Python?
Python Modules
- What are Python modules and how do you create one?
- Difference between import module and from module import function?
- What is the purpose of __init__.py?
Functions
- What are default arguments, *args, **kwargs?
- What is the difference between a function and a method?
- What is a lambda function?
File Handling
- How to read and write files in Python?
- Difference between read(), readline(), and readlines()?
- What is the use of with open()?
List Comprehension
- What is list comprehension? Give an example.
- Can you include if-else in list comprehension?
- How do you convert a nested loop into list comprehension?
Most Asked ML Libraries
- Difference between NumPy and Pandas?
- What is the use of scikit-learn?
- How does matplotlib differ from seaborn?
Stack and Queue
- How do you implement a stack in Python?
- How do you implement a queue in Python?
- What are deque and its advantages?
Decorators and Generators
- What is a Python decorator? How is it used?
- What is the use of @staticmethod and @classmethod?
- What are generators? How are they different from iterators?
Web Scraping
- What libraries are used for web scraping in Python?
- How do you extract data using BeautifulSoup?
- How to handle pagination in scraping?
Itertools
- What is the use of itertools in Python?
- Explain the usage of itertools.cycle, itertools.combinations, and itertools.groupby.
Multiprocessing
- What is multiprocessing? How is it different from multithreading?
- How do you create and start a process?
- What is the use of Pool and Queue?
Geopy
- What is Geopy used for?
- How do you get latitude and longitude using Geopy?
- How can you calculate the distance between two locations?
GridSearch
- What is GridSearchCV and why is it used?
- How does GridSearchCV handle cross-validation?
- What are hyperparameters?
Higher Order Functions
- What is a higher-order function in Python?
- Explain map, filter, and reduce with examples.
SimpleImputer
- What is SimpleImputer in scikit-learn?
- What strategies can be used in SimpleImputer?
- How to handle missing data using SimpleImputer?
Binary Search
- How does binary search work?
- Write a Python code for binary search.
- What is the time complexity of binary search?
Recursion
- What is recursion?
- How does tail recursion differ from normal recursion?
- Give an example of factorial using recursion.
Regex
- What is the use of regex in Python?
- Difference between match(), search(), and findall()?
- How do you validate an email or phone number using regex?
Method Overloading (OOP)
- Does Python support method overloading?
- How can you achieve method overloading in Python?
Deep Copy vs Shallow Copy
- What is the difference between deep copy and shallow copy?
- How do you perform deep copy in Python?
Exception Handling
- How does exception handling work in Python?
- What are try, except, finally, and else?
- How to raise custom exceptions?
Django
- What is Django and why is it used?
- Difference between Flask and Django?
- What is ORM in Django?
- Explain MVT architecture.
- How do you create models, views, and templates?