Python is the primary language for backend development at many Indian startups (Swiggy's data platform, Razorpay's internal tooling, most fintech and healthtech startups), and the dominant language for data engineering and machine learning roles across the Indian tech ecosystem. This guide covers the most important Python concepts tested in Indian tech interviews, Django and FastAPI questions at product companies, Python coding problems, and how Python interviews differ between web development and data engineering roles.
Core Python Concepts Tested in Indian Interviews
Core Python interview concepts: (1) Python data model and internals: mutable vs immutable types (list vs tuple vs frozenset), Python's reference counting and garbage collection (cyclic GC), id() and object identity vs equality (is vs ==). (2) Data structures: list comprehensions and generator expressions (when to use each), dict comprehensions and defaultdict, heapq for priority queues, collections.Counter for frequency counting, deque for O(1) append/pop from both ends. (3) Functions and closures: args and *kwargs, decorators (how they work under the hood, functools.wraps), closures and the LEGB rule for variable scoping. (4) OOP in Python: dunder methods (_init, repr, str, eq, hash_), class vs instance variables, @classmethod vs @staticmethod vs instance method, abstract classes via ABC, multiple inheritance and MRO. (5) Concurrency: GIL (Global Interpreter Lock) and its implications, threading (for I/O-bound tasks), multiprocessing (for CPU-bound tasks), asyncio (async/await for I/O-bound tasks: how event loop works, coroutines vs threads).
Django and FastAPI Interview Questions
Django interview questions: (1) 'Explain Django's MVT architecture and how it differs from MVC.' (2) 'How does Django ORM work? Explain QuerySets.' (lazy evaluation: QuerySets don't hit the database until iterated or sliced). (3) 'What is the N+1 problem in Django ORM and how do you fix it?' (fix with selectrelated() for ForeignKey/OneToOne, prefetchrelated() for ManyToMany). (4) 'How do you handle database migrations in Django?' (5) 'How do you implement rate limiting in a Django REST API?' (throttling in DRF: AnonRateThrottle, UserRateThrottle, ScopedRateThrottle). FastAPI questions: (1) 'How does FastAPI handle concurrency?' (async def route handlers use asyncio; blocking code should run in a thread pool via runinexecutor). (2) 'How do you validate request bodies in FastAPI?' (Pydantic models: BaseModel with type annotations; FastAPI generates JSON Schema automatically). (3) 'How does FastAPI dependency injection work?' (@Depends decorator; dependencies are resolved per request; supports database sessions, auth, etc.).
Python Coding Questions
Python coding questions: (1) Easy-medium: 'Find all pairs in a list that sum to a target' (two-pointer on sorted list or hash set for O(n)). 'Implement a function to flatten a nested list' (recursion or stack-based iteration). 'Count the frequency of each word in a paragraph' (collections.Counter). (2) String problems: 'Find the longest palindromic substring' (expand around centre approach). 'Check if a string has all unique characters without using additional data structures' (bit manipulation for ASCII). (3) Functional Python: 'Rewrite this for loop using a list comprehension and explain the performance difference.' 'Implement a memoisation decorator.' (4) Data engineering focus: 'Read a CSV file with 1 million rows and compute the top 10 most frequent values in column X efficiently' (csv module + Counter, or pandas groupby; discuss memory trade-offs). 'Write a generator function to read a large file line by line without loading it into memory.' (5) OOP: 'Implement a class hierarchy for a vehicle rental system with appropriate dunder methods for comparison and string representation.'
Practise Python developer interview questions with HireStepX's AI voice interviewer and get instant scored feedback on your technical explanations. First 2 sessions free.
Practice freeWeb Development vs Data Engineering Python Interviews
Python interview differences by role: Web development (Django/FastAPI roles at product companies): Core Python depth (OOP, decorators, closures, asyncio for FastAPI). Django ORM and database optimisation. REST API design (idempotency, versioning, authentication strategies). Caching (Redis integration). System design at medium scale. Data engineering (data pipeline, ETL, analytics roles at fintech, edtech, e-commerce): Pandas (groupby, merge, apply, window functions, handling large datasets). SQL (complex joins, window functions like ROW_NUMBER, RANK, LAG/LEAD; query optimisation). Data processing frameworks (Apache Spark for big data; PySpark basics). Distributed computing concepts (partitioning, shuffling). Pipeline design (Airflow for orchestration; Kafka for real-time ingestion). Data science/ML roles: Scikit-learn API (fit, transform, pipeline). Model evaluation metrics (precision, recall, F1, AUC-ROC). PyTorch or TensorFlow basics for ML engineering roles.
Frequently asked questions
Explore more