Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Mastek hiring for Data Science roles
Mastek is an Indian IT services and digital engineering company with a strong presence in the United Kingdom public sector, healthcare, retail and financial services markets. It delivers application development, cloud migration, Oracle and Salesforce implementations, data and testing services. In India it hires developers, quality engineers, data analysts and cloud engineers who work with global delivery teams on long-running client programmes.
For Data Science roles, this Mastek practice set focuses most on Python for Data Science (9), Machine Learning (7), Feature Engineering (6), Generative AI and LLMs (4). It has 13 easy, 27 medium questions, so you can start easy and work up to the harder ones.
Company type
IT services
Headquarters
Mumbai, India
Main India offices
Mumbai, Pune
Mastek Data Science interview process
Online assessment (aptitude + technical MCQs)
Technical interview
Managerial round
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for MastekStart 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
What is the difference between one-hot, label and ordinal encoding?
One-hot encoding creates a binary column per category and suits nominal data like city for linear models. Label encoding maps categories to integers arbitrarily; it is fine for tree models but implies a false order for linear models. Ordinal encoding also uses integers but in a meaningful order, like low, medium, high mapped to 0, 1, 2. Choose based on whether categories have a natural order and which model you use.
02
Your model's most important feature is customer_id. What is wrong?
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.
The rule that lets arrays of different shapes operate together by virtually stretching the smaller one, for example adding a scalar or a (3,) vector to a (4,3) matrix.
A range built from sample data that would contain the true parameter in a stated percentage (for example 95%) of repeated samples. It is not the probability that the parameter lies inside this one interval.
05
What are type hints in Python and why do data teams use them?
Type hints annotate expected types, for example def clean(df: pd.DataFrame, cols: list[str]) -> pd.DataFrame. Python does not enforce them at runtime, but tools like mypy and IDEs use them to catch mistakes early and give better autocomplete. In data teams they make shared pipeline code easier to read and review. They matter most in production code and libraries, less in quick exploratory notebooks.
06
What is an Overall Evaluation Criterion (OEC) in experimentation?
An OEC is a single agreed metric, or a weighted combination of metrics, that represents long-term business value and is used to judge experiments. Good OECs are sensitive enough to move within a test's duration yet aligned with long-term goals; for example, sessions per user with penalties for churn rather than raw clicks. Having an OEC prevents teams from each optimising their own metric and makes ship decisions consistent across the organisation.
07
What is MAPE and when is it a poor metric for forecast accuracy?
MAPE is the mean of absolute errors divided by actual values, expressed as a percentage. It is easy to explain to business teams, but it breaks when actuals are zero or near zero, because the percentage explodes. It also penalises over-forecasts more than under-forecasts and weights small items heavily. For intermittent or low-volume series prefer MAE, weighted MAPE or MASE, which compares error to a naive baseline.
08
What is mean Average Precision (mAP) in object detection?
For each class, detections are ranked by confidence and a precision-recall curve is computed, where a detection is a true positive if its IoU with an unmatched ground truth box passes a threshold. Average Precision is the area under that curve. mAP is the mean across classes. mAP@0.5 uses IoU 0.5, while mAP@0.5:0.95 averages over thresholds from 0.5 to 0.95 and rewards tighter boxes.
09
Write Python code to compute the haversine distance between customer and store locations.
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.
11
What is the difference between a function and a method?
Regularization adds a penalty on weights to reduce overfitting. L1 (Lasso) adds |w| and can push features to exactly zero. L2 (Ridge) adds w² and shrinks weights smoothly.
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
How would you build RFM features for a customer churn model?
RFM stands for recency, frequency and monetary value. From the transactions table, for each customer as of a cut-off date: recency is days since the last purchase, frequency is the number of orders in the last 90 days, and monetary is total or average spend in that window. Compute them using only data before the cut-off, add trends like spend this month versus last, and the label from the period after.
A system prompt is the instruction message placed before user messages that sets the model's role, tone, rules and output format, for example 'You are a support assistant; answer only from the provided policy and reply in JSON'. It shapes every response in the conversation. Keep it clear and specific, version it like code, and do not rely on it alone for security, since users can try to override it through prompt injection.
16
What should you log for a production prediction service?
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.
17
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.
18
What is the difference between supervised and unsupervised learning?
Supervised learning trains on labelled data to predict a target; unsupervised learning finds structure such as clusters or components in unlabelled data.
19
Explain precision vs recall. When would you prefer recall?
Precision = TP / (TP + FP). Recall = TP / (TP + FN).
Prefer recall when missing a positive is costly — for example disease screening or fraud detection.
It models the log-odds of a binary outcome as a linear function and passes it through a sigmoid to give probabilities, trained by maximising likelihood.
22
What is a t-test and when do you use a paired t-test?
A t-test compares means when the population variance is unknown. A two-sample t-test compares two independent groups, such as users in control and treatment. A paired t-test is used when the same units are measured twice, such as the same students before and after training. Pairing removes variation between individuals, so it is more powerful. Welch's t-test is preferred when the two groups have unequal variances.
Use grid search, random search or Bayesian optimisation with cross-validation, starting with a coarse random search and narrowing the promising ranges.
24
Write Python code to calculate the sample size per group needed to detect a lift from 5 percent to 5.5 percent conversion.
A function using yield that produces values lazily, one at a time. It saves memory when processing large files or streams because the full sequence is never held in RAM.
26
How do you deal with high-cardinality categorical features?
All three number rows within a window ordered by some column. ROW_NUMBER gives unique numbers even for ties: 1, 2, 3. RANK gives tied rows the same rank and skips the next numbers: 1, 1, 3. DENSE_RANK gives ties the same rank without gaps: 1, 1, 2. Use ROW_NUMBER to pick exactly one row per group, and DENSE_RANK for questions like the second highest distinct salary.
L1 (Lasso) adds absolute weights and can shrink some to zero, giving feature selection. L2 (Ridge) adds squared weights and shrinks them smoothly without removing features.
29
Write Python code to find the top 3 most similar documents to a query using cosine similarity on embeddings.
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.
A forest averages many trees trained on bootstrapped rows and random feature subsets, which cuts variance and overfitting at the cost of interpretability.
32
What is the difference between iterators and iterables in Python?
An iterable can produce an iterator (it has __iter__); an iterator has __next__ and remembers its position. A for-loop calls iter() on the iterable and then next() repeatedly.
33
What is the difference between parametric and non-parametric tests?
def flatten(items):
out = []
for x in items:
if isinstance(x, list):
out.extend(flatten(x))
else:
out.append(x)
return out
print(flatten([1, [2, [3, 4]], 5])) # [1, 2, 3, 4, 5]
During training it randomly switches off a fraction of neurons so the network cannot depend on any single unit, acting as a regulariser against overfitting.
36
Write SQL to find customers who ordered in January 2026 but not in February 2026.
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'
);
37
Write SQL to find the second highest salary in an employees table.
SELECT MAX(salary) AS second_highest
FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);
-- alternative with window function
SELECT DISTINCT salary
FROM (SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk
FROM employees) t
WHERE rnk = 2;
38
What are lambda functions and where are they useful?
Categories that appear only a few times give unreliable signals and create many sparse columns. A common fix is to group all categories below a frequency threshold, like 1 percent, into an Other bucket. You can also use frequency encoding or smoothed target encoding. Make sure the encoder handles unseen categories at prediction time, for example with handle_unknown set to ignore.
Revise programming basics, SQL joins and software testing concepts, as these are commonly checked in Mastek technical discussions.
Show comfort working with overseas clients by preparing examples of clear written communication and teamwork from college or internships.
Read about Mastek's UK government and healthcare work and its Evosys Oracle cloud business before the interview.
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; Mastek interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Mastek Data Science interview?
Candidates usually go through 4 stages: Online assessment (aptitude + technical MCQs); Technical interview; 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 Mastek Data Science interview?
This practice set leans on Python for Data Science (9), Machine Learning (7), Feature Engineering (6), Generative AI and LLMs (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Mastek interviewers ask you to walk through real work.
Are these the exact questions asked at Mastek?
No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Mastek's. They are not a leaked or verified list of past questions.
Where does Mastek hire Data Science professionals in India?
Mastek has large teams in Mumbai, Pune. Openings and locations change often, so check the Mastek careers page and filter by city and experience.