Urban Company Data Science Interview Questions & Answers
Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Urban Company hiring for Data Science roles
Urban Company is an Indian technology platform that connects customers with trained professionals for home services such as cleaning, beauty, appliance repair, plumbing and painting. It handles booking, pricing, partner training and quality control through its app. It hires software engineers, data analysts, product managers and operations roles, and also operates in a few international markets.
For Data Science roles, this Urban Company practice set focuses most on Generative AI and LLMs (7), Python for Data Science (5), MLOps and Model Deployment (4), Feature Engineering (4). It has 2 easy, 26 medium, 12 hard questions, so you can start easy and work up to the harder ones.
Company type
Product
Headquarters
Gurugram, India
Main India offices
Gurugram
Urban Company Data Science interview process
Online coding or analytics assessment
Technical round 1
Technical round 2 (design or case)
Hiring manager and culture round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for Urban CompanyStart 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.
✓ 3 questions free • Unlock the rest in seconds
01
Your LLM assistant confidently quotes a policy clause that does not exist. Why does this happen and how do you reduce it?
Hallucination is when a model produces confident text that is false or not supported by any source. It happens because the model generates plausible tokens rather than checking facts. Reduce it by grounding answers in retrieved documents, asking the model to cite sources and say I do not know when context is missing, using low temperature, and validating outputs with rules or a second checking step. Measure it with a labelled evaluation set.
02
What is the difference between list, tuple, set and dict in Python?
List: ordered and mutable. Tuple: ordered and immutable (hashable, slightly faster). Set: unordered, unique items, fast membership checks. Dict: key–value pairs with fast lookup by key.
03
Write a Python function to split a long text into overlapping chunks by word count for a RAG index.
SGD updates weights using the gradient times a fixed learning rate, often with momentum. Adam keeps running averages of gradients and their squares, giving each parameter its own adaptive step size. Adam converges fast with little tuning and is the default for transformers. Well-tuned SGD with momentum sometimes generalises better on vision tasks. AdamW, which decouples weight decay, is the common choice for modern deep learning.
05
Write a FastAPI endpoint that serves predictions from a saved scikit-learn model.
Read in chunks or use usecols and dtypes, convert strings to category, avoid apply with row loops in favour of vectorised ops, and consider Polars, Dask or Parquet storage.
07
Tell me about the most challenging machine learning project you have worked on.
Situation: I built a lead scoring model where only 3 percent of leads converted and labels came 60 days late. Task: deliver a useful ranking for the sales team. Action: I set up a clean time-based validation, engineered activity features, used gradient boosting with class weights and measured lift in the top decile. Result: the top 10 percent of scored leads converted 3.5 times better than average. The hardest part was building trust in the labels.
A decorator wraps a function to add behaviour such as logging, timing or caching without changing its code. It is applied with the @name syntax above the function.
Evaluate retrieval and generation separately. For retrieval, build a set of real questions with known relevant documents and measure recall at k and mean reciprocal rank. For generation, measure faithfulness to retrieved context, answer correctness and relevance, using human review on a sample and an LLM-as-judge with a clear rubric at scale. Track latency and cost too. Rerun the same evaluation set after every change to prompts, chunking or models.
Define churn and the prediction window → build usage and billing features → handle imbalance → train gradient boosting → evaluate with PR-AUC and lift → explain with SHAP → deploy as batch scoring or an API → monitor drift → hand top-risk users to the retention team.
11
Write NumPy code to compute the Dice coefficient between a predicted and a true binary mask.
Use the provider's structured output or JSON schema mode when available, which constrains the output to your schema. Otherwise, describe the exact schema in the prompt with an example, and use low temperature. Always parse and validate the response in code, for example with Pydantic, and on failure retry with the error message included. Keep schemas small and flat, and use enums for fields with fixed values.
13
What is positional encoding in transformers and why is it needed?
Self-attention treats input tokens as a set, so without extra information it cannot tell word order: dog bites man and man bites dog look the same. Positional encoding adds position information to each token embedding. The original transformer used fixed sine and cosine patterns; BERT learned position embeddings; many modern LLMs use rotary embeddings, which encode relative positions and extend better to longer contexts.
14
Your test shows a 2 percent lift in conversion, but revenue per user went down. What do you do?
Do not ship on conversion alone. Check whether the change shifted buyers to cheaper items, increased discount usage or pulled in low-value orders. Break down revenue into conversion times average order value, look at item mix, and confirm the revenue drop is statistically meaningful rather than noise. Then go back to the agreed primary metric and guardrails; if revenue is the business goal, it should guide the decision.
15
You assign values to a filtered DataFrame and Pandas shows a SettingWithCopyWarning. What is going on and how do you fix it?
The warning appears when you assign values to something that may be a copy of a slice instead of the original DataFrame, for example df[df.age > 30]['flag'] = 1. The original may not change. Fix it by using a single .loc call, like df.loc[df.age > 30, 'flag'] = 1, or by taking an explicit .copy() when you really want a separate DataFrame. Copy-on-write in newer Pandas versions makes this behaviour more predictable.
16
Halfway through a test you discover a bug that broke the treatment for Android users. What do you do?
Stop or pause the affected part, fix the bug and restart the test with fresh data, since mixing broken and fixed periods biases results. Do not simply drop Android users from analysis afterwards, because that can break randomisation balance if the bug affected behaviour or logging. Document the incident, and add pre-launch checks such as running the variant through QA on every platform and monitoring guardrails in the first hours.
17
Write scikit-learn code to get precision, recall and a confusion matrix at a custom threshold of 0.3.
Situation: on an insurance claims model, my first features gave average results. Task: improve fraud detection. Action: I sat with two claim investigators for a day and asked what made them suspicious. They mentioned claims filed soon after policy start and repeated garage names. I turned these into features and checked them with the team. Result: recall at the same precision rose by 12 points. Experts often know signals the data hides.
19
Tell me about a time you had to build a model when the requirements were unclear.
Situation: a sales head asked for a model to find good leads but could not define good. Task: turn this into a clear target. Action: I met the team, looked at past deals, and proposed converted within 60 days as the label, with expected revenue as a secondary view. I shared a quick baseline in a week to get feedback. Result: the definition was agreed, and the final model raised conversion in the top decile.
20
Your product image classifier works on studio catalogue photos but fails on photos users take with their phones. Why, and what do you do?
This is domain shift: user photos have clutter, blur, poor lighting and odd angles that the model never saw. Collect and label a sample of real user photos and evaluate on them separately. Add augmentation for blur, noise, colour jitter, rotation and random crops, and fine-tune on a mix of studio and real images. Monitor accuracy on user photos in production, since that is the distribution that matters.
21
Write Python code to find the top 3 most similar documents to a query using cosine similarity on embeddings.
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.
23
How would you build a churn prediction model end to end?
Define churn and the prediction window, build behavioural features, split by time, train and compare models, evaluate with recall and lift, explain drivers and monitor drift after deployment.
24
Write Python code to compute a 95% bootstrap confidence interval for the mean.
WITH monthly AS (
SELECT DATE_TRUNC('month', order_date) AS month, SUM(amount) AS revenue
FROM orders
GROUP BY 1
)
SELECT month, revenue,
LAG(revenue) OVER (ORDER BY month) AS prev_revenue,
ROUND(100.0 * (revenue - LAG(revenue) OVER (ORDER BY month))
/ NULLIF(LAG(revenue) OVER (ORDER BY month), 0), 2) AS mom_pct
FROM monthly;
27
Explain exponential smoothing and the Holt-Winters method.
Simple exponential smoothing forecasts with a weighted average of past values where weights decay exponentially, so recent points matter more. Holt's method adds a smoothed trend component. Holt-Winters adds a seasonal component as well, either additive or multiplicative. Each component has a smoothing parameter between 0 and 1 that is fitted to the data. These models are fast, easy to explain and strong baselines for retail and demand data.
The probability of seeing a result at least as extreme as the observed one if the null hypothesis were true. A small p-value is evidence against the null, not proof that the alternative is true.
29
Describe a time you had to push back on or prioritise many ad-hoc data requests.
Situation: as the only analyst for three teams, I received 15 ad-hoc SQL requests a week and my model work stalled. Task: protect focus without upsetting stakeholders. Action: I grouped requests, built a self-serve dashboard covering the 5 most common questions, and set up a simple weekly priority review with the managers. Result: ad-hoc requests dropped by 60 percent and the model shipped a month later as planned.
30
Write SQL to show each customer's first order date, last order date and the gap between them in days.
SELECT
customer_id,
MIN(order_date) AS first_order,
MAX(order_date) AS last_order,
MAX(order_date) - MIN(order_date) AS days_between,
COUNT(*) AS orders
FROM orders
GROUP BY customer_id
ORDER BY days_between DESC;
-- PostgreSQL: DATE minus DATE gives days; use DATEDIFF in other engines
31
How do you handle personal data when sending customer text to an external LLM API?
First check the data processing agreement, data residency and retention terms, and India's DPDP Act requirements with legal. Minimise what is sent: mask or tokenise names, phone numbers, Aadhaar and card numbers before the call, and restore them afterwards if needed. Use enterprise endpoints with no training on your data, log access, and consider a self-hosted open model for highly sensitive workloads.
32
What are anchor boxes, and why have anchor-free detectors become popular?
Anchor boxes are predefined boxes of several sizes and aspect ratios placed at each grid location; the detector predicts offsets from them and a class score. They need careful tuning to match object shapes in your data and create many redundant predictions. Anchor-free detectors, such as FCOS-style or centre-point methods, predict object centres and box sizes directly. They have fewer hyperparameters, generalise better to unusual shapes and simplify the pipeline.
Bias occurs when the sample does not represent the population. Reduce it with random or stratified sampling, higher response rates and by checking sample demographics against the population.
34
Write Pandas code to cap outliers at the 1st and 99th percentile.
# fit limits on training data only, then apply to test
low, high = train['income'].quantile([0.01, 0.99])
train['income_capped'] = train['income'].clip(low, high)
test['income_capped'] = test['income'].clip(low, high)
35
Write a Python function to compute MASE for a seasonal forecast.
Define the hypothesis and one primary metric, calculate sample size from the baseline, minimum detectable effect, α and power, randomise users, run for full business cycles, check for sample-ratio mismatch, then test both statistical and practical significance.
37
Marketing wants to measure the impact of a TV and outdoor campaign that cannot be randomised at user level. How do you design the measurement?
Plan a geo experiment: select comparable cities or regions, randomly assign some to run the campaign and keep others as control, matching them on past sales trends. Measure the difference in sales during and after the campaign, using methods like difference-in-differences or synthetic control to build a counterfactual. Run a pre-period check that test and control regions track each other, and include enough regions for reasonable power.
38
Your fraud model's true labels arrive 30 days late. How do you monitor it in production?
Since accuracy cannot be measured quickly, monitor proxies. Track input data drift with PSI per feature, prediction score distribution, the share of transactions flagged, and data quality like missing values. Watch early signals such as chargeback complaints or manual review outcomes on a sample. Set alerts on sudden shifts. When labels arrive, compute real precision and recall by cohort and compare them with the proxy alerts to tune them.
39
What is chunking in RAG and how do you choose a chunk size?
Chunking splits documents into smaller pieces before embedding them, so retrieval returns focused passages that fit in the prompt. Small chunks, like 200 tokens, are precise but lose context; large chunks, like 1,000 tokens, keep context but add noise and cost. Split on natural boundaries such as headings and paragraphs, add some overlap, and keep metadata like title and section. Then tune chunk size using retrieval metrics on real questions.
40
What are quantile and power transforms such as Box-Cox and Yeo-Johnson, and when do you use them?
Power transforms reshape a skewed feature to look more normal. Box-Cox needs strictly positive values, while Yeo-Johnson also handles zero and negative values; both learn a lambda parameter from training data. A quantile transform maps values to a uniform or normal distribution by rank, which is robust to outliers. They help linear models, distance-based methods and neural networks, but tree models rarely need them.
Tips to crack the Urban Company Data Science interview
Practise DSA and low-level design for engineering roles, such as designing a booking or slot allocation system.
For analyst roles, prepare marketplace metrics like fill rate, repeat rate and partner earnings, and practise related SQL queries.
Understand the two-sided marketplace model of customers and service partners, and discuss how both sides stay satisfied.
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; Urban Company interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Urban Company 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 and culture 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 Urban Company Data Science interview?
This practice set leans on Generative AI and LLMs (7), Python for Data Science (5), MLOps and Model Deployment (4), Feature Engineering (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Urban Company interviewers ask you to walk through real work.
Are these the exact questions asked at Urban Company?
No. These are curated practice questions that match the skills and difficulty usually tested in product interviews like Urban Company's. They are not a leaked or verified list of past questions.
Where does Urban Company hire Data Science professionals in India?
Urban Company has large teams in Gurugram. Openings and locations change often, so check the Urban Company careers page and filter by city and experience.