oops,fundamental,basics,database
1. Data Types:
What are the common built-in data types in Python? (e.g., int, float, string, boolean, list, tuple, dictionary)
What is the difference between a mutable and an immutable data type? (Muttable data types can be changed after creation, while immutable ones cannot)
What is the difference between a list and a tuple? (Lists are mutable, tuples are immutable)
2. Control Flow and Functions:
What are functions in Python? (Functions are blocks of reusable code)
What is a lambda function? (A small, anonymous function)
Explain list comprehension with an example. (A concise way to create lists)
How do you handle exceptions in Python? (Using try, except, else, and finally blocks)
3. Object-Oriented Programming (OOP):
What is the __init__ method in Python? (A constructor method in a class)
What is self in Python? (A reference to the instance of the class)
Explain the purpose of pass in Python. (It's a placeholder statement that does nothing)
4. Modules and Packages:
What are modules and packages in Python? (Modules are files containing Python code, and packages are collections of modules)
5. Other Concepts:
What is PEP 8? (A style guide for Python code)
How does Python manage memory? (Using reference counting and garbage collection)
What is the Global Interpreter Lock (GIL) in Python? (A mechanism that limits Python to execute only one thread at a time)
How can you remove duplicates from a list in Python? (Convert the list to a set and back to a list)
Reverse a string in Python. (e.g., using slicing: string[::-1])