Delhivery Data Science Interview Questions & Answers
Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Delhivery hiring for Data Science roles
Delhivery is an Indian logistics and supply chain company that provides parcel delivery, freight, warehousing and fulfilment services for e-commerce and enterprise clients. It runs a large network of hubs and uses technology for route planning, tracking and automation. It hires software engineers, data scientists, data analysts and operations professionals.
For Data Science roles, this Delhivery practice set focuses most on Python for Data Science (6), Machine Learning (5), Deep Learning and NLP (5), Feature Engineering (5). It has 3 easy, 29 medium, 8 hard questions, so you can start easy and work up to the harder ones.
Company type
E-commerce & consumer tech
Headquarters
Gurugram, India
Main India offices
Gurugram, Bengaluru
Delhivery Data Science interview process
Online coding or analytics assessment
Technical round 1
Technical round 2 (design or case)
Hiring manager round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for DelhiveryStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
Use the IQR rule (below Q1-1.5 IQR or above Q3+1.5 IQR), z-scores beyond 3, box plots or model-based methods such as Isolation Forest, then decide whether to cap, remove or keep them.
02
You are building defect detection for a factory line where only 1 in 1,000 images shows a defect. How do you approach it?
With so few defects, a plain classifier will learn to say no defect. Collect every defect image possible and oversample them or use class-weighted or focal loss. Consider anomaly detection trained only on good parts, which flags anything unusual. Use augmentation that mimics real variation in lighting and position. Evaluate with recall at a fixed false alarm rate, since missing a defect usually costs far more than a manual recheck.
It applies Bayes' theorem assuming features are independent given the class. The assumption is rarely true but the model is fast and works well for text.
04
Write Python code to calculate the sample size per group needed to detect a lift from 5 percent to 5.5 percent conversion.
Heterogeneous treatment effects mean the change helps some segments more than others, for example new users but not repeat users. Finding them can guide targeting. The risk is that slicing by many segments creates false discoveries, and each segment has less power, so differences may be noise. Pre-register key segments, correct for multiple comparisons, and validate any surprising segment effect in a follow-up test before acting on it.
06
How do one-stage and two-stage object detectors differ?
Two-stage detectors, like Faster R-CNN, first propose candidate regions and then classify and refine each one, which gives strong accuracy, especially for small objects, but is slower. One-stage detectors, like YOLO and SSD, predict boxes and classes directly over a dense grid in a single pass, making them fast enough for real-time video. Modern one-stage models have closed most of the accuracy gap, so they dominate edge and video use cases.
07
Write scikit-learn code to calibrate a gradient boosting classifier's probabilities and check the result.
Common causes are a learning rate that is too high, exploding gradients, bad input values, and unstable maths like log of zero. I would check the input data for NaN or infinite values, lower the learning rate, add gradient clipping, and make sure the loss uses the stable built-in version with logits. With mixed precision, I would check the loss scaler. Logging gradient norms per step helps find the exact point it breaks.
10
Write Python code to find the top 3 most similar documents to a query using cosine similarity on embeddings.
The join key is probably not unique on the right side, so each left row matches several right rows and the result multiplies. Check with right['key'].duplicated().sum(). Other causes are null or blank keys matching each other after cleaning, or joining on the wrong column. Fix it by deduplicating or aggregating the right table first, and use merge(..., validate='many_to_one') so Pandas raises an error when the assumption breaks.
12
What are lambda functions and where are they useful?
Situation: leadership believed a discount campaign drove a sales spike. Task: I was asked to measure its impact. Action: I compared similar regions with and without the campaign and found the spike matched a festival week in both. I shared the method, the charts and the limits openly. Result: they cut the next discount budget by half and moved it to retention. I learned to present surprising results with clear evidence and calm framing.
14
Write SQL to find the top 3 products by revenue in each category.
WITH rev AS (
SELECT category, product_id, SUM(price * qty) AS revenue
FROM order_items
GROUP BY category, product_id
), ranked AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) AS rn
FROM rev
)
SELECT category, product_id, revenue
FROM ranked
WHERE rn <= 3;
Keep notebooks for exploration and reporting only. Move reusable logic into a Python package with modules for data loading, features, training and evaluation, and import it into notebooks. Keep settings in config files, write unit tests for feature functions, and use pre-commit with a formatter and linter. Track experiments in a tool like MLflow. A clear folder template and code reviews keep the team consistent as the project grows.
18
The business asks you to pick a decision threshold for a churn model. How do you choose it?
The default 0.5 is rarely right. I would get the cost of each outcome: the value of saving a churner, the cost of a retention offer, and the team's capacity to contact customers. Then I compute expected profit or precision and recall at many thresholds on validation data and pick the one that maximises value within capacity. I would also check that the chosen threshold stays stable over recent months.
19
A new checkout converts better on both mobile and desktop, but worse overall. How is that possible?
Simpson's paradox happens when a trend in several groups reverses when the groups are combined. Example: a new checkout converts better on both mobile and desktop, but worse overall, because most of its traffic came from mobile, which has lower conversion anyway. The mix of groups, not the treatment, drives the total. The lesson is to check segment-level results and confounding variables before drawing conclusions from aggregated numbers.
20
After joining orders with a promotions table, total revenue doubled. What went wrong?
The join created duplicate order rows, because some orders match more than one promotion row, so each amount is counted several times. Check by comparing COUNT(*) with COUNT(DISTINCT order_id) after the join. Fix it by aggregating the promotions table to one row per order first, picking one promotion with ROW_NUMBER, or summing revenue before the join. Always check row counts after every join.
21
Write Python code to compute the haversine distance between customer and store locations.
Use internal metrics: the silhouette score compares how close a point is to its own cluster versus the nearest other cluster, and the Davies-Bouldin index measures cluster overlap. The elbow method looks at within-cluster variance. But the real test is usefulness: are clusters stable across random seeds and samples, can the business describe them, and do they behave differently on outcomes like spend or churn?
23
How do you pull large data from a SQL database into Pandas efficiently?
Push as much work as possible into SQL: filter, aggregate and select only needed columns before pulling. Use pd.read_sql with a SQLAlchemy engine and chunksize to stream large results. For very large extracts, export to Parquet from the warehouse and read that, which is much faster than row-by-row transfer. Set dtypes like category early, and never use SELECT star on a big table from a notebook.
It predicts from the k nearest labelled points. It is simple but slow at prediction time, sensitive to scaling and irrelevant features, and weak in high dimensions.
25
Tell me about a time you had to learn a new deep learning framework or tool quickly.
Situation: my internship project used PyTorch, but I had only used Keras. Task: build a text classifier within two weeks. Action: I followed the official tutorials for two days, rebuilt a small Keras model in PyTorch to compare, and asked a senior to review my training loop. Result: I delivered the model on time with 88 percent F1. I learned that rebuilding something familiar is the fastest way into a new tool.
26
Tell me about a time you had to explain a deep learning model's mistake to a client or stakeholder.
Situation: our document classifier mislabelled several legal notices, and the client was upset. Task: explain clearly and restore confidence. Action: I showed the misclassified examples, explained that they used a format absent from training data, and avoided jargon. I proposed adding those samples, a confidence threshold for human review and weekly error reports. Result: errors on that format fell sharply and the client extended the project.
27
What is hierarchical forecasting and why is reconciliation needed?
Hierarchical forecasting produces forecasts at several levels, such as SKU, store, city and national totals. If you forecast each level independently, the store forecasts will not add up to the city forecast. Reconciliation adjusts them to be consistent. Bottom-up sums the lowest level, top-down splits the total by proportions, and methods like MinT combine all levels optimally. Consistent numbers matter because finance, supply chain and stores plan from different levels.
28
Write Python code to decompose a monthly series into trend, seasonal and residual parts with STL.
g = df.groupby('customer_id')['amount']
total = g.transform('sum')
count = g.transform('count')
# Leave-one-out mean; NaN when it is the customer's only order
df['avg_other_orders'] = (total - df['amount']) / (count - 1)
df.loc[count == 1, 'avg_other_orders'] = float('nan')
# For time-aware features, use only earlier orders instead
31
How do you engineer features for a time series forecast without leaking future information?
Every feature must use only data available before the forecast time. Use lags and rolling windows that shift past the current point, and respect the forecast horizon: for a 7-day-ahead forecast, the most recent usable lag is 7 days. Compute scalers and encodings inside each training fold. Use known-future features only when truly known, like holidays or planned promotions. Validate with rolling-origin backtests that mimic production.
32
Pandas: find the top 3 products by revenue in each region.
An ID has no real meaning, so high importance means the model is memorising individual customers. It often happens when the same customers appear in both train and test, or when IDs were assigned in time order and act as a proxy for date or signup cohort. I would drop the ID, use a group-based split by customer, and if timing matters, add an explicit feature like account age instead.
34
Your detector finds large objects well but misses small objects like distant people. How do you improve it?
Small objects lose detail after downsampling. Train and infer at higher input resolution, or tile large images into overlapping crops. Use a backbone with a feature pyramid so detection happens on high-resolution maps. Tune anchors or assignment settings for small sizes, and oversample images with small objects. Check labelling quality for tiny boxes too. Measure mAP on small objects separately to confirm improvement.
35
Write SQL to find the median order value per city.
SELECT city,
PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY amount) AS median_amount
FROM orders
GROUP BY city;
-- PERCENTILE_CONT interpolates; PERCENTILE_DISC returns an actual value
For each request, log a request ID, timestamp, model version, input features or a hash of them, the prediction and score, and latency. Log errors and fallback use separately. Do not log raw personal data unless needed and allowed; mask it. Aggregate these logs into dashboards for traffic, latency percentiles, error rate and score distribution. Joining logged predictions with later outcomes gives the data for monitoring and retraining.
38
Tell me about a time you deployed a model under a tight deadline.
Situation: a pricing model had to go live before a sale in ten days. Task: deploy safely in that window. Action: I cut scope to batch scoring instead of real-time, reused our standard Docker and Airflow template, wrote tests for the key features and set up a dashboard for score distribution. Result: it went live two days early and ran without incidents during the sale. Real-time scoring followed a month later.
39
You target-encoded a city column and validation AUC jumped from 0.72 to 0.95. What do you suspect?
Target encoding replaces each category with the average target value for that category, for example the churn rate per city. It handles high-cardinality columns compactly. The main risk is leakage: if a row's own target is included in its encoding, the model sees the answer and overfits. Prevent it with out-of-fold encoding, smoothing toward the global mean for rare categories, and fitting only on training data.
40
Write Pandas code to read a large CSV in chunks and compute total sales per city.
# process 1 million rows at a time
import pandas as pd
totals = {}
for chunk in pd.read_csv('sales.csv', usecols=['city', 'amount'], chunksize=1_000_000):
part = chunk.groupby('city')['amount'].sum()
for city, amt in part.items():
totals[city] = totals.get(city, 0) + amt
result = pd.Series(totals).sort_values(ascending=False)
Tips to crack the Delhivery Data Science interview
Learn logistics basics such as first mile, last mile, hub operations and shipment tracking to discuss the domain.
Practise optimisation-style problems and graph algorithms, which connect well to routing and network planning work.
For analyst roles, revise SQL and Excel, and prepare to analyse delivery delays or cost per shipment in a case.
Keep a one-minute story ready for every project on your CV: problem, your part, tools, result.
Practise the hard questions on this page aloud; Delhivery interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Delhivery Data Science interview?
Candidates usually go through 4 stages: Online coding or analytics assessment; Technical round 1; Technical round 2 (design or case); Hiring manager round. The exact rounds change with the role, team, location and your experience, so confirm the process with the recruiter.
Which topics should I prepare for the Delhivery Data Science interview?
This practice set leans on Python for Data Science (6), Machine Learning (5), Deep Learning and NLP (5), Feature Engineering (5). Revise those first, then practise explaining one or two of your own projects end to end, because most Delhivery interviewers ask you to walk through real work.
Are these the exact questions asked at Delhivery?
No. These are curated practice questions that match the skills and difficulty usually tested in e-commerce & consumer tech interviews like Delhivery's. They are not a leaked or verified list of past questions.
Where does Delhivery hire Data Science professionals in India?
Delhivery has large teams in Gurugram, Bengaluru. Openings and locations change often, so check the Delhivery careers page and filter by city and experience.