Lenskart Data Science Interview Questions & Answers
Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Lenskart hiring for Data Science roles
Lenskart is an Indian eyewear company that sells spectacles, sunglasses and contact lenses through its website, app and a large chain of retail stores. It combines online shopping with home eye tests, virtual try-on technology and in-house manufacturing. It hires software engineers, data analysts, product managers and retail and operations roles across its technology and business teams.
For Data Science roles, this Lenskart practice set focuses most on Machine Learning (7), MLOps and Model Deployment (5), Statistics and Probability (5), Feature Engineering (4). It has 1 easy, 30 medium, 9 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
Lenskart Data Science interview process
Online coding or analytics assessment
Technical round
Case or managerial round
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for LenskartStart 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
Write a scikit-learn ColumnTransformer that preprocesses numeric and categorical columns.
SELECT DISTINCT o.customer_id
FROM orders o
WHERE o.order_date >= '2026-01-01' AND o.order_date < '2026-02-01'
AND NOT EXISTS (
SELECT 1 FROM orders f
WHERE f.customer_id = o.customer_id
AND f.order_date >= '2026-02-01' AND f.order_date < '2026-03-01'
);
04
What is the difference between saving a model with pickle, joblib and ONNX?
pickle serialises Python objects; it is simple but tied to Python and library versions, and loading untrusted pickle files is a security risk. joblib is similar but more efficient for objects with large NumPy arrays, like scikit-learn models. ONNX is an open, language-neutral format that runs in optimised runtimes across languages and hardware, useful for fast serving. Always store library versions alongside pickle or joblib files.
05
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.
06
What are dataclasses in Python and why are they useful in data projects?
A dataclass, created with the @dataclass decorator, automatically generates __init__, __repr__ and __eq__ from annotated fields. It is a clean way to hold structured records such as a training config with learning rate, batch size and paths. Options like frozen=True make instances immutable, and default values reduce boilerplate. Compared with plain dictionaries, dataclasses give attribute access, type hints and clearer errors when a field is misspelled.
07
What is the difference between probability and likelihood?
Probability fixes the parameters and asks how likely different data are, for example the chance of 7 heads in 10 tosses if the coin is fair. Likelihood fixes the observed data and asks how plausible different parameter values are, for example which coin bias best explains 7 heads. The likelihood function is not a probability distribution over parameters. Maximum likelihood estimation picks the parameter value that maximises it.
Start with a pretrained sentence embedding model plus a simple classifier, or fine-tune a small transformer with class weights. For the rare categories, try few-shot approaches such as SetFit or an LLM with examples in the prompt, and generate or collect more examples. Merge categories that are rarely distinguishable. Report per-class F1 rather than overall accuracy, and route low-confidence predictions to a human queue.
10
What is statistical power and how can you increase it?
Power is the probability of detecting a real effect. Increase it with a larger sample, a bigger effect size, lower noise or a higher significance level.
11
How do you use groupby with multiple aggregations?
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.
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.
14
Your notebook runs on your laptop but fails on a colleague's machine. How do you make the work reproducible?
First pin the environment: a requirements.txt or conda environment file with exact versions, or a Docker image. Set random seeds for NumPy, scikit-learn and any framework you use. Remove hard-coded local paths and read them from a config file. Make sure data comes from a shared, versioned location. Finally, restart the kernel and run the notebook top to bottom, so hidden cell order bugs are caught before sharing.
15
Your power analysis says you need 200,000 users per group, but the page gets only 5,000 users a week. What are your options?
Waiting 80 weeks is unrealistic. Options: test a bolder change so the expected effect is larger; use a more sensitive metric closer to the change, like add-to-cart instead of purchase; apply CUPED to reduce variance; or move the test to a higher-traffic page. If none work, accept a larger MDE explicitly, or decide using qualitative research and a staged rollout with monitoring instead of a formal test.
16
How would you design an ML platform for a team of 20 data scientists?
I would start from the team's pain points, then provide shared building blocks: a standard project template, managed notebooks with access to the warehouse, experiment tracking and a model registry, an orchestrator like Airflow for pipelines, a feature store if real-time use cases exist, a standard serving path using containers, and default monitoring. Prefer managed services over custom builds, and add self-serve documentation so teams do not depend on one platform engineer.
17
How do you deal with high-cardinality categorical features?
In shadow deployment the new model receives real traffic and logs predictions, but users still get the old model's output; it is safe for checking latency and agreement. A canary sends a small share of traffic, like 5 percent, to the new model and expands if metrics stay healthy. An A/B test splits traffic randomly to measure business impact statistically. Teams often go shadow, then canary, then full rollout.
It computes the gradient of the loss with respect to every weight by applying the chain rule backwards through the network, so gradient descent can update them.
20
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.
21
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.
22
Write Pandas code to create lag and rolling features for each customer.
df = df.sort_values(['customer_id', 'month'])
g = df.groupby('customer_id')['spend']
df['spend_lag1'] = g.shift(1)
df['spend_lag3'] = g.shift(3)
# shift first so the current month is not included
df['spend_roll3_mean'] = g.transform(lambda s: s.shift(1).rolling(3).mean())
23
What is DBSCAN and when is it better than K-means?
DBSCAN is a density-based clustering algorithm. It groups points that have at least min_samples neighbours within distance eps, and marks isolated points as noise. Unlike K-means, it does not need the number of clusters, finds clusters of any shape, and handles outliers. It struggles when clusters have very different densities and in high dimensions. It suits location data, like finding delivery hotspots from GPS points.
24
Tell me about a time you decided an LLM was not the right solution for a problem.
Situation: a team wanted an LLM to categorise transactions into 12 fixed categories. Task: recommend an approach. Action: I benchmarked an LLM against a gradient boosting model on labelled history, comparing accuracy, latency and cost per million records. The classic model matched accuracy at a fraction of the cost and ran in milliseconds. Result: we shipped it and used the LLM only for the few low-confidence cases.
25
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.
26
Your A/B test shows a significant lift after 2 days. The product team wants to ship now. What do you say?
I would ask them to wait for the planned duration. Checking early and stopping on the first significant result, called peeking, inflates false positives. Two days also misses weekly patterns and novelty effects, where users click a new feature just because it is new. If speed matters, we can use a sequential testing method designed for early stopping. Otherwise we run the full sample size calculated before launch.
27
Write pytest unit tests for a feature function that computes days since last purchase.
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.
29
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.
30
What is the difference between Bayesian and frequentist approaches?
Frequentists treat parameters as fixed and use long-run frequencies; Bayesians treat parameters as distributions updated with data via priors and posteriors, giving direct probability statements.
The ROC curve plots true positive rate against false positive rate across thresholds. AUC is the probability that a random positive is ranked above a random negative; 0.5 is chance.
32
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.
33
Most of your products sell zero units on most days, with occasional sales. Which forecasting approach suits this?
This is intermittent demand, and standard models like ARIMA forecast a small constant that is useless for stocking. Croston's method and its SBA variant forecast the size of non-zero demand and the interval between sales separately. Alternatives are aggregating to weekly level, or using a global gradient boosting model with Tweedie or Poisson loss. Evaluate with MAE or MASE, not MAPE, because zero actuals break percentage errors.
34
Write Python code to run an ADF stationarity test and difference the series if needed.
from statsmodels.tsa.stattools import adfuller
def is_stationary(s, alpha=0.05):
p_value = adfuller(s.dropna())[1]
return p_value < alpha
series = s.copy()
d = 0
while not is_stationary(series) and d < 2:
series = series.diff()
d += 1
print('differencing order d =', d)
35
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.
36
What are the novelty effect and the primacy effect in A/B tests?
The novelty effect is when users engage more with a change simply because it is new, so early results overstate the long-term lift. The primacy effect is the opposite: existing users resist change at first, so early results understate it. Both fade with time. To detect them, plot the treatment effect by day and by user tenure, compare new users with existing users, and run the test long enough for behaviour to settle.
Calibration checks whether predicted probabilities match real frequencies (e.g. 70% predictions are right about 70% of the time). Fix with Platt scaling or isotonic regression.
38
Write Python code to apply a CUPED adjustment using each user's pre-experiment metric.
Feature hashing, the hashing trick, maps categories or tokens into a fixed number of columns using a hash function, without storing a vocabulary. It handles very high-cardinality or ever-changing values, like URLs or device IDs, with constant memory and works well in streaming systems. The trade-off is collisions, where different values share a column, and the features cannot be reversed for explanation. Choose a large enough number of buckets.
pd.pivot_table(df, index='region', columns='month', values='sales', aggfunc='sum') reshapes long data into a summary matrix; melt() does the reverse.
Tips to crack the Lenskart Data Science interview
For tech roles, practise DSA and backend basics, and be ready to discuss APIs, databases and scaling e-commerce systems.
For analyst roles, revise SQL, Excel and metrics like conversion rate, average order value and store performance.
Understand Lenskart's omnichannel model of online plus offline stores to answer business and product questions with context.
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; Lenskart interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Lenskart Data Science interview?
Candidates usually go through 4 stages: Online coding or analytics assessment; Technical round; Case or managerial round; HR 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 Lenskart Data Science interview?
This practice set leans on Machine Learning (7), MLOps and Model Deployment (5), Statistics and Probability (5), Feature Engineering (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Lenskart interviewers ask you to walk through real work.
Are these the exact questions asked at Lenskart?
No. These are curated practice questions that match the skills and difficulty usually tested in e-commerce & consumer tech interviews like Lenskart's. They are not a leaked or verified list of past questions.
Where does Lenskart hire Data Science professionals in India?
Lenskart has large teams in Gurugram, Bengaluru. Openings and locations change often, so check the Lenskart careers page and filter by city and experience.