..
Python Interview Questions
Questionnaire for 5 year candidate
🐍 Python Software Engineer – Evaluation Questionnaire
✅ Section 1: Core Python Knowledge
- Explain Python’s memory management model. How does garbage collection work?
- What are decorators and how do they work? Provide a real-world use case.
- Describe the difference between
@staticmethod, @classmethod, and instance methods.
- What is a generator? How does it differ from a regular function?
- Explain Python’s GIL (Global Interpreter Lock). How does it impact multi-threaded applications?
- When would you use
__slots__ in a Python class?
- What are context managers? How does the
with statement work internally?
- Explain list comprehensions vs. generator expressions. When would you prefer one over the other?
✅ Section 2: Advanced Python & Libraries
- How would you handle concurrency in Python? Compare threading, multiprocessing, and async programming.
- Given a large CSV file (5GB+), how would you process it efficiently in Python?
- What are the differences between
deepcopy() and copy()?
- Have you used Pandas or NumPy? Share a case where these libraries helped optimize performance.
- Explain how you would structure a Python package for a large-scale project.
- How do you manage dependencies and virtual environments in Python?
✅ Section 3: System Design & Architecture
- Design a RESTful API for a library management system.
- Outline the architecture, endpoints, and data model.
- Consider authentication and rate-limiting.
- How would you scale a Python web application to handle 10,000 concurrent users?
- What design patterns have you used in past projects? Share real-world examples.
- Explain the difference between monolithic and microservices architectures. When would you choose one over the other?
- Discuss the trade-offs between using SQL (PostgreSQL) vs. NoSQL (MongoDB) in a Python project.
✅ Section 4: Cloud, DevOps & Databases
- Which cloud platforms (AWS, Azure, GCP) have you worked with? Describe a Python project you deployed on the cloud.
- How would you implement CI/CD for a Python microservice?
- Have you worked with Docker or Kubernetes? How did they help in your project?
- What steps would you take to ensure security in a Python-based API (e.g., JWT, OAuth2)?
- Explain how message queues (e.g., RabbitMQ, SQS) can improve a Python application’s scalability.
- What are common performance bottlenecks in Python web applications, and how would you fix them?
✅ Section 5: Problem-Solving (Coding Challenge)
- Write a Python function that identifies duplicates in a large dataset and removes them while maintaining order.
- Given a list of API endpoints, write an asynchronous Python script to fetch data from all endpoints and combine the results.
- Implement a caching layer in Python using Redis for an API that fetches weather data.
- Write SQL queries for the following:
- Find the second highest salary in a table.
- List all customers who haven’t placed an order in the last 6 months.
- (Optional - Debugging Task): Provide a buggy code snippet and ask the candidate to debug and fix it live.
✅ Section 6: Soft Skills & Behavioral Questions
- How do you approach code reviews? What’s your strategy for giving constructive feedback?
- Describe a time when you faced a major roadblock in a project. How did you overcome it?
- Have you mentored junior developers? Share your approach.
- How do you stay updated with new Python libraries, frameworks, and best practices?
- Tell me about a project where you had to collaborate with cross-functional teams.
📊 Evaluation Rubric:
| Category |
Weight |
Rating (1-5) |
Comments |
| Core Python Knowledge |
20% |
|
|
| System Design |
20% |
|
|
| Problem-Solving |
20% |
|
|
| Cloud/DevOps (if needed) |
15% |
|
|
| Database Expertise |
10% |
|
|
| Soft Skills |
15% |
|
|
✅ Section 7: SQL & Database Design
📊 Basic SQL Queries
- Write a query to retrieve the top 5 highest-paid employees from an
employees table.
- Find the total number of orders placed in the last month from an
orders table.
- How would you select all customers who haven’t placed any orders? (Use
LEFT JOIN or NOT EXISTS)
- Explain the difference between
INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.
- What is the difference between
WHERE and HAVING clauses?
- Given a table
sales (id, product_id, quantity, sale_date), write a query to find the best-selling product for each month.
- What’s the difference between
RANK(), DENSE_RANK(), and ROW_NUMBER()? Provide examples.
- Write a query to find duplicate records in a table and remove them.
- How would you calculate the cumulative sales for each product ordered by sale date? (Use window functions)
- Explain the concept of indexing. When would you avoid using an index?
📊 Advanced SQL & Optimization
- How would you optimize a slow-running query fetching millions of rows? (Discuss indexing, query plans, etc.)
- What’s the difference between
UNION and UNION ALL? When would you use one over the other?
- Explain ACID properties in relational databases. Why are they important?
- Design a normalized schema for an e-commerce platform. (Cover customers, products, orders, and payments)
- How would you handle schema migrations in a production environment?
📊 SQL Problem-Solving Challenges
- Given tables
orders(order_id, customer_id, amount, order_date) and customers(customer_id, name):
- Find customers who have placed orders worth more than $5000.
- List customers who placed orders in January 2024 but not in February 2024.
- Write a query to find the second highest salary from an
employees table. (Without using LIMIT or OFFSET)
- How would you pivot a table in SQL to display monthly sales for each product as columns? (Use
CASE WHEN or PIVOT if supported)
- Create a recursive CTE to find the hierarchical structure of employees reporting to a specific manager.
- Given a large transaction table, how would you identify anomalies or suspicious transactions? (Discuss window functions or data mining techniques)