Back to Tech Interviews

Python Backend Interview Master

200+ Python interview questions covering GIL internals, memory management, garbage collection, generators, decorators, asyncio, and backend patterns.

Total: 200 QuestionsLearned: 0 / 200 (0%)
Difficulty Filters

Tools & Options
Showing 200 of 200 questions
Beginner
What is Python?

Python is a high-level, interpreted, general-purpose programming language. It is known for its simplicity, readability, and vast library support, making it ideal for web development, data science, and automation.

Beginner
What is the difference between list and tuple?

Lists are mutable (can be changed) and use square brackets []. Tuples are immutable (cannot be changed) and use parentheses (). Lists are generally slower than tuples.

Beginner
What is PEP 8?

PEP 8 is the official Style Guide for Python Code. It provides guidelines on how to format code to improve readability and consistency across the Python community.

Beginner
How is memory managed in Python?
Beginner
What are Python namespaces?
Beginner
What is the difference between 'is' and '=='?
Beginner
What are Python decorators?
Beginner
Explain list comprehension.
Beginner
What is a docstring?
Beginner
What are *args and **kwargs?
Beginner
What is the difference between deep copy and shallow copy?
Beginner
How do you handle exceptions in Python?
Beginner
What is the purpose of 'self' in classes?
Beginner
What is a lambda function?
Beginner
Explain the 'with' statement.
Beginner
What is 'pass' in Python?
Beginner
What is the difference between range and xrange?
Beginner
How do you reverse a list?
Beginner
What are global and local variables?
Beginner
Explain the use of 'yield' keyword.
Beginner
What is a dictionary in Python?
Beginner
How do you comment in Python?
Beginner
What is the difference between break, continue, and pass?
Beginner
How do you find the length of a string?
Beginner
What is slicing in Python?
Beginner
Explain map() function.
Beginner
Explain filter() function.
Beginner
Explain reduce() function.
Beginner
What is an init method in Python?
Beginner
What is the difference between a set and a list?
Beginner
How do you create a function in Python?
Beginner
What is a module in Python?
Beginner
What is a package in Python?
Beginner
Explain the use of 'global' keyword.
Beginner
Explain 'nonlocal' keyword.
Beginner
What is an iterable in Python?
Beginner
What is an iterator?
Beginner
What is a generator?
Beginner
How do you convert a string to an integer?
Beginner
How do you check the type of an object?
Beginner
What is the use of 'dir()' function?
Beginner
What is 'help()' in Python?
Beginner
How do you read input from a user?
Beginner
What is the difference between append() and extend()?
Beginner
What is 'join()' method in strings?
Beginner
What is 'split()' method?
Beginner
Explain 'getattr' and 'setattr'.
Beginner
What is the difference between sorted() and sort()?
Beginner
What is a Boolean in Python?
Beginner
How do you open a file for writing?
Experience
Explain the Python Global Interpreter Lock (GIL).
Experience
How do you bypass the GIL?
Experience
What is the difference between Threading and Multiprocessing?
Experience
Explain 'Monkey Patching'.
Experience
What are 'Class Methods' and 'Static Methods'?
Experience
Explain 'MRO' (Method Resolution Order).
Experience
What is 'super()'?
Experience
What are 'Metaclasses'?
Experience
Explain 'Abstract Base Classes' (ABCs).
Experience
What is 'Pickling' and 'Unpickling'?
Experience
What is a Context Manager?
Experience
How do you create a custom Context Manager?
Experience
Explain 'Duck Typing'.
Experience
What is 'F-strings' in Python?
Experience
Explain 'Property' decorator.
Experience
What is 'Descriptor' in Python?
Experience
What is 'slots' in Python classes?
Experience
Explain 'Walrus Operator' (:=).
Experience
What is the difference between 'asyncio' and 'threading'?
Experience
Explain 'Coroutine'.
Experience
What is 'FastAPI'?
Experience
What is 'Django'?
Experience
What is 'Flask'?
Experience
What is 'WSGI' vs 'ASGI'?
Experience
Explain 'Pydantic'.
Experience
What is 'Celery'?
Experience
What is 'Alembic'?
Experience
Explain 'SQLAlchemy'.
Experience
What is 'Unit Testing' in Python?
Experience
What is 'Mocking' in testing?
Experience
Explain 'Pytest' fixtures.
Experience
What is 'Virtual Environment'?
Experience
What is the 'PyPi'?
Experience
Explain 'Pipenv' and 'Poetry'.
Experience
What is 'Gunicorn'?
Experience
What is 'Uvicorn'?
Experience
Explain 'CORS' in web APIs.
Experience
What is 'JWT' in Python?
Experience
Explain 'Session' vs 'Token' based authentication.
Experience
What is 'Middleware' in Django/FastAPI?
Experience
Explain 'Nginx' role in deployment.
Experience
How to handle 'Recursive Queries' in ORM?
Experience
Explain 'N+1 Query Problem'.
Experience
What is 'Redis' used for in Python backends?
Experience
Explain 'WebSockets' in Python.
Experience
How to perform 'Profiling' in Python?
Experience
What is 'Circular Import' and how to fix it?
Experience
Explain 'Weakref'.
Experience
What is 'Itertools' module?
Experience
What is 'Functools' module?
Advanced
How does Python's Garbage Collector work?
Advanced
Explain 'Bytecode' vs 'Machine Code'.
Advanced
What is 'JIT' Compilation in Python?
Advanced
Explain 'Frame Objects' in Python.
Advanced
What is 'Introspection' in Python?
Advanced
How to optimize Python for performance?
Advanced
Explain 'descriptors' deep dive.
Advanced
What is 'Zero-copy' in Python?
Advanced
Explain 'Memoryview'.
Advanced
Security: What is 'SQL Injection' and how to prevent it?
Advanced
Security: What is 'XSS' in Python web apps?
Advanced
Explain 'Microservices' communication in Python.
Advanced
What is 'gRPC' in Python?
Advanced
Explain 'Saga Pattern' in distributed transactions.
Advanced
What is 'CAP Theorem'?
Advanced
Explain 'Horizontal' vs 'Vertical' Scaling.
Advanced
What is 'Serverless' in Python backend?
Advanced
Explain 'Clean Architecture' in Python.
Advanced
What is 'Twelve-Factor App' methodology?
Advanced
Explain 'Consistent Hashing'.
Advanced
What is 'Database Sharding'?
Advanced
Explain 'Rate Limiting' algorithms.
Advanced
What is 'Circuit Breaker' in Python microservices?
Advanced
How to handle 'Distributed Tracing'?
Advanced
Explain 'Event Sourcing'.
Advanced
What is 'CQRS'?
Advanced
Deep Dive: 'asyncio' event loop internals.
Advanced
What is 'Contextvars'?
Advanced
Explain 'Data Classes' vs 'NamedTuple'.
Advanced
What is 'Type Checking' in Python production?
Advanced
Explain 'Cython'.
Advanced
What is 'Numba'?
Advanced
How to implement 'Custom Import Hooks'?
Advanced
Explain 'interning' in Python strings.
Advanced
What is 'object.__new__'?
Advanced
Explain 'Python Object Model'.
Advanced
What is 'C3 Linearization'?
Advanced
How to handle 'Heavy Background Jobs' in Django?
Advanced
Explain 'Optimistic' vs 'Pessimistic' Locking.
Advanced
What is 'Query Optimization' techniques?
Advanced
Explain 'Blue-Green' vs 'Canary' deployment.
Advanced
What is 'Sidecar Pattern' in K8s (Python context)?
Advanced
How to secure 'Sensitive Config'?
Advanced
Explain 'Zero-Downtime' migrations.
Advanced
What is 'Thundering Herd' problem in Cache?
Advanced
Explain 'GraphQL' in Python Backend.
Advanced
What is 'Web Scraping' ethical/technical considerations?
Advanced
Explain 'Observability' vs 'Monitoring'.
Advanced
How to implement 'Multi-tenancy'?
Advanced
What is 'Chaos Engineering' in Python backend?
Beginner
Fibonacci sequence generator.
Beginner
Check if a string is a palindrome.
Beginner
Find duplicate items in a list.
Beginner
Sort a list of dictionaries by a key.
Beginner
Read a file line by line.
Experience
Flatten a nested list.
Experience
Group list items by frequency.
Experience
Implement a simple decorator.
Beginner
Merge two dictionaries.
Beginner
Factorial using recursion.
Beginner
Check if all items in list are unique.
Beginner
Convert list of tuples to dictionary.
Beginner
Find the intersection of two lists.
Experience
Implement a Singleton pattern.
Beginner
Filter even numbers from a list.
Beginner
Reverse words in a sentence.
Beginner
Find the most common element in a list.
Experience
Measure execution time of a function.
Experience
Convert snake_case to CamelCase.
Beginner
Get the last N items of a list.
Experience
Implement Binary Search.
Experience
Chunk a list into smaller pieces.
Beginner
Remove whitespace from string.
Experience
Generate a random string.
Beginner
Check if a variable is an integer.
Beginner
Remove None values from a list.
Beginner
Get current date and time.
Beginner
Format a date string.
Experience
Exception chaining.
Experience
Deep clone an object.
Beginner
Check for prime numbers.
Experience
Find missing number in array.
Beginner
Implement a stack.
Beginner
Implement a queue.
Experience
Map function to nested list.
Experience
Intersection of two dictionaries.
Beginner
How to read environment variables.
Beginner
Zip two lists into a dictionary.
Experience
Create a temporary file.
Beginner
Check for anagrams.
Beginner
Find the GCD of two numbers.
Beginner
Convert integer to binary string.
Experience
Implement a simple timer class.
Experience
Sort list using custom comparator.
Experience
Get memory usage of an object.
Experience
How to capture stdout.
Beginner
Parse JSON string.
Beginner
Check if file exists.
Experience
Simple async function loop.
Beginner
Check if string starts with prefix.

Technical Interview Mastery Blueprint

Proven methodologies and frameworks to succeed in technical and architecture rounds.

1. The Engineering STAR Technique

When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.

2. Defending Architectural Trade-Offs

Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.

3. Clean Code & Edge-Case Proactivity

In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.

4. Antipatterns to Avoid

Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.

Continuous learning: Practice daily, mark completed questions as learned, and revisit difficult concepts.Explore All Interview Tracks →

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Related Tools