Sonata Software Data Science Interview Questions & Answers
Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Sonata Software hiring for Data Science roles
Sonata Software is an Indian IT services company known for its work on Microsoft technologies, cloud modernisation and digital platforms. It serves clients in retail, travel, distribution, banking and healthcare with application development, Dynamics 365, data and testing services. In India it hires developers, testers, data engineers and functional consultants, and is a long-standing Microsoft partner for enterprise solutions.
For Data Science roles, this Sonata Software practice set focuses most on Machine Learning (7), Deep Learning and NLP (6), Statistics and Probability (5), Feature Engineering (4). It has 23 easy, 15 medium, 2 hard questions, so you can start easy and work up to the harder ones.
Company type
IT services
Headquarters
Bengaluru, India
Main India offices
Bengaluru, Hyderabad
Sonata Software 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 Sonata SoftwareStart 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.
*args collects extra positional arguments into a tuple; **kwargs collects extra keyword arguments into a dict. They make function signatures flexible and are common in wrappers and decorators.
Early stopping monitors a validation metric during training and stops when it has not improved for a set number of rounds, called patience. It is used in gradient boosting and neural networks to prevent overfitting and save time. The model from the best round is kept. The validation set must not be the final test set, otherwise the reported test score becomes optimistic.
03
Write Python code to compute the haversine distance between customer and store locations.
A time series is a sequence of observations recorded at ordered time steps, such as daily sales or hourly website traffic. Unlike ordinary tabular data, rows are not independent: today's value depends on yesterday's, and the order cannot be shuffled. This changes everything downstream. You must split train and test by time, build features only from the past, and check for trend and seasonality before choosing a model.
05
What is correlation and why does it not imply causation?
Correlation measures linear association between variables (-1 to 1). A third factor, reverse causality or chance can create it, so causation needs controlled experiments.
06
How do you handle rare categories in a categorical feature?
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.
07
What is the difference between a one-tailed and a two-tailed test?
A two-tailed test checks for a difference in either direction, for example whether a new page changes conversion up or down. A one-tailed test checks only one direction, such as whether it increases conversion. One-tailed tests have more power for that direction but ignore harm in the other direction. In most product experiments a two-tailed test is the safer default unless the direction was fixed before seeing data.
08
What is the difference between bagging and boosting?
Bagging trains models in parallel on bootstrap samples and averages them (reduces variance, e.g. Random Forest). Boosting trains models one after another, each fixing the previous errors (reduces bias, e.g. XGBoost).
09
Write Keras code for a small binary classifier on tabular data.
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.
12
What are polynomial features and what is the risk of using them?
Polynomial features add powers and products of existing features, like x squared and x times y, so a linear model can fit curves and interactions. The risk is that the number of features grows very fast with degree and input count, causing overfitting, slow training and multicollinearity. Use a low degree, scale features first, and add regularisation such as Ridge or Lasso to keep coefficients under control.
13
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.
Differencing replaces each value with the change from the previous value: y_t minus y_(t-1). It removes a linear trend and often makes a series stationary. Seasonal differencing subtracts the value one season back, such as y_t minus y_(t-7) for daily data with a weekly cycle. Avoid over-differencing, because it adds noise and negative autocorrelation. In ARIMA, the d parameter is the number of times you difference.
15
Write a Python function to flatten a nested list of any depth.
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]
16
Write SQL to pivot order counts by status into columns using CASE WHEN.
SELECT DATE_TRUNC('month', order_date) AS month,
SUM(CASE WHEN status = 'delivered' THEN 1 ELSE 0 END) AS delivered,
SUM(CASE WHEN status = 'cancelled' THEN 1 ELSE 0 END) AS cancelled,
SUM(CASE WHEN status = 'returned' THEN 1 ELSE 0 END) AS returned
FROM orders
GROUP BY 1
ORDER BY 1;
17
What is the difference between mean, median and mode?
Step 1: collect and label a sample of reviews, checking class balance. Step 2: build a baseline with TF-IDF and logistic regression to get a quick benchmark. Step 3: fine-tune a small pretrained transformer such as DistilBERT for better accuracy, or use a multilingual model if reviews mix languages. Step 4: evaluate with F1 per class and read wrong predictions. Step 5: handle sarcasm and neutral reviews explicitly.
20
What are primary metrics and guardrail metrics in an experiment?
The primary metric is the one the change is meant to improve and that decides success, such as checkout conversion. Guardrail metrics are ones that must not get worse, such as page load time, refund rate, unsubscribes or revenue per user. Defining both before the test prevents cherry-picking afterwards. A change that lifts the primary metric but breaks a guardrail is usually not shipped without further discussion.
21
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.
22
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.
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.
MLOps is the set of practices that take machine learning models from experiments to reliable production and keep them working. It covers versioning data and code, tracking experiments, automated training pipelines, testing, deployment, monitoring and retraining. It borrows ideas from DevOps but adds data and model concerns, because a model can fail even when the code has not changed, simply because the data has.
25
Write scikit-learn code to calibrate a gradient boosting classifier's probabilities and check the result.
import torch, torch.nn as nn
from torchvision import models
model = models.resnet18(weights=models.ResNet18_Weights.DEFAULT)
for p in model.parameters():
p.requires_grad = False # freeze backbone
model.fc = nn.Linear(model.fc.in_features, 5)
opt = torch.optim.AdamW(model.fc.parameters(), lr=1e-3)
loss_fn = nn.CrossEntropyLoss()
# train head first, then unfreeze later layers with a lower lr
27
Why do we use activation functions? Why is ReLU popular?
A CTE, common table expression, is a named temporary result defined with WITH and used in the query that follows. It breaks complex SQL into readable steps and can be referenced more than once. A recursive CTE refers to itself: an anchor query starts the result and a recursive part keeps adding rows until none are added. It is used for hierarchies like employee-manager chains or generating date series.
29
How do you choose a learning rate for a neural network?
F1 is the harmonic mean of precision and recall, so it is high only when both are high. It is useful for imbalanced classes where accuracy hides poor performance. It can mislead because it ignores true negatives and treats precision and recall as equally important. If missing a fraud case costs far more than a false alarm, use an F-beta score with beta above 1, or choose metrics based on real costs.
Reinforcement learning from human feedback aligns a model with human preferences. Humans rank several model answers to the same prompt, a reward model is trained on these rankings, and the LLM is then optimised to produce answers with higher reward, typically with PPO and a penalty for drifting too far from the original model. Simpler methods like DPO learn directly from preference pairs. It makes models more helpful and safer.
32
Write SQL to compute a 7-day rolling average of daily active users.
WITH daily AS (
SELECT activity_date, COUNT(DISTINCT user_id) AS dau
FROM events
GROUP BY activity_date
)
SELECT activity_date, dau,
AVG(dau) OVER (ORDER BY activity_date
ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS dau_7d_avg
FROM daily
ORDER BY activity_date;
33
What does the axis parameter mean in NumPy and Pandas?
axis tells an operation which direction to work along. axis=0 works down the rows, so df.sum(axis=0) gives one total per column. axis=1 works across columns, so df.sum(axis=1) gives one total per row. In df.drop, axis=1 means drop columns and axis=0 means drop rows. A simple way to remember it: the axis you name is the one that gets collapsed or removed.
Data augmentation creates new training examples by applying realistic changes to existing ones. For images this means flips, rotations, crops and brightness changes. For text it can mean synonym replacement, back-translation or random word dropping. For audio, adding noise or shifting pitch. It improves generalisation when data is limited. Changes must keep the label correct; flipping a digit 6 can turn it into a 9.
Quantisation stores model weights in lower precision, such as 8-bit or 4-bit integers instead of 16-bit floats. A 7-billion parameter model drops from about 14 GB to around 4 GB at 4-bit, so it fits on smaller GPUs or even laptops and runs faster. The cost is some loss in quality, usually small at 8-bit and noticeable on hard tasks at very low bits. Common formats include GPTQ, AWQ and GGUF.
36
How do you check whether a variable is normally distributed?
Start visually with a histogram and a Q-Q plot; points close to the straight line suggest normality. Check skewness and kurtosis values. Then use a formal test such as Shapiro-Wilk for small samples or Anderson-Darling. Remember that with very large samples, tests flag tiny harmless deviations, so judge by the plots too. If data is skewed, consider a log transform or a non-parametric method.
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.
MLE chooses model parameters that make the observed data most probable. You write the likelihood of the data as a function of the parameters, usually take the log for easier maths, and maximise it. For a coin with 7 heads in 10 tosses, the MLE of the heads probability is 0.7. Logistic regression is trained by MLE, which is the same as minimising log loss. MLE can overfit with small samples.
Word embeddings represent words as dense vectors, usually 100 to 300 numbers, so that words used in similar contexts get similar vectors. Word2Vec learns them by predicting a word from its neighbours or the neighbours from the word. Unlike one-hot or TF-IDF, embeddings capture meaning, so king and queen are close. Their limit is one vector per word, so bank has the same vector in river bank and bank loan.
40
How do you make a machine learning experiment reproducible?
Version the code with Git, the data with a tool like DVC or dated snapshots, and the environment with pinned requirements or Docker. Set random seeds for every library. Log parameters, metrics and the exact data version for each run with a tracker like MLflow. Keep preprocessing inside a pipeline rather than manual notebook steps. Then anyone should be able to rebuild the same model from a commit and a data version.
Tips to crack the Sonata Software Data Science interview
Brush up on C# or Java, SQL and basic cloud concepts, especially Microsoft Azure, since much of the work uses Microsoft stacks.
Prepare clear examples of debugging, writing test cases or building small applications from your projects or internships.
Read about Sonata's Microsoft partnership and platform modernisation focus so you can explain why the company fits your goals.
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; Sonata Software interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Sonata Software 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 Sonata Software Data Science interview?
This practice set leans on Machine Learning (7), Deep Learning and NLP (6), 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 Sonata Software interviewers ask you to walk through real work.
Are these the exact questions asked at Sonata Software?
No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Sonata Software's. They are not a leaked or verified list of past questions.
Where does Sonata Software hire Data Science professionals in India?
Sonata Software has large teams in Bengaluru, Hyderabad. Openings and locations change often, so check the Sonata Software careers page and filter by city and experience.