🚀
Q1. What is the GIL?
A. In CPython, the Global Interpreter Lock allows only one thread to execute Python bytecode at a time (affects CPU-bound threading).
Advanced
🚀
Q2. When to use multiprocessing vs asyncio?
A. multiprocessing for CPU-bound parallelism; asyncio for high-concurrency I/O-bound tasks.
Advanced
🚀
Q3. What are descriptors?
A. Objects implementing __get__/__set__/__delete__ that customize attribute access (property uses descriptors).
Advanced
🚀
Q4. What is MRO?
A. Method Resolution Order defines how Python resolves methods in multiple inheritance (C3 linearization).
Advanced
🚀
Q5. Monkey patching risks?
A. Runtime modification can break assumptions, complicate debugging, and cause subtle side effects across modules.
Advanced
🚀
Q6. What is a decorator used for?
A. A function that wraps another to add behavior (logging, caching, auth) without changing its code.
Advanced
🚀
Q7. How do you prevent SQL injection?
A. Use parameterized queries / ORM binding; never string-concatenate untrusted input into SQL.
Advanced
🚀
Q8. What is safe serialization?
A. Prefer JSON for interoperability; avoid untrusted pickle (can execute code).
Advanced