Thoughtworks Data Science Interview Questions & Answers
Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Thoughtworks hiring for Data Science roles
Thoughtworks is a global technology consultancy known for agile software delivery, continuous delivery and its Technology Radar publication. It works on custom software, data platforms and digital transformation for enterprise clients. In India it hires for developers, quality analysts, data engineers and data scientists. Teams usually work closely with client engineers.
For Data Science roles, this Thoughtworks practice set focuses most on Machine Learning (7), Python for Data Science (6), SQL for Data Science (5), MLOps and Model Deployment (5). It has 5 easy, 29 medium, 6 hard questions, so you can start easy and work up to the harder ones.
Company type
Consulting
Headquarters
Chicago, Illinois, USA
Main India offices
Pune, Bengaluru, Chennai, Gurugram, Hyderabad
Thoughtworks Data Science interview process
Online coding assessment
Code pairing round
Technical interview
Cultural fit or social change round
Leadership round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for ThoughtworksStart 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
A Pandas merge suddenly returns many more rows than the left table had. What happened?
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.
02
Write SQL to compute a running total of spend for each user.
SELECT user_id, order_date, amount,
SUM(amount) OVER (
PARTITION BY user_id
ORDER BY order_date
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
) AS running_spend
FROM orders
ORDER BY user_id, order_date;
03
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.
04
What are naive and seasonal naive forecasts, and why should you always compute them?
A naive forecast predicts that the next value equals the last observed value. A seasonal naive forecast predicts the value from the same period last season, such as last Monday for next Monday. They take seconds to build and are surprisingly hard to beat on many business series. Always report your model's error relative to these baselines; if a complex model cannot beat seasonal naive, it is not adding value.
05
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;
06
Your sales forecast scores well in k-fold cross-validation but fails in production. What could be wrong with the validation?
Random k-fold mixes future and past rows, so the model trains on data from after the period it predicts. That leaks information and inflates scores. Use time-based splits instead: train on an expanding or rolling window and validate on the next period, like TimeSeriesSplit in scikit-learn. Leave a gap between train and validation when features use lagged values, so the test reflects real forecasting conditions.
07
What is the difference between mean, median and mode?
Situation: my demand forecasting model had 8 percent error offline, but 20 percent in the first month live. Task: find out why quickly. Action: I compared live inputs with training data and found a promotions feature arrived a day late in production, so the model saw zeros. I added a data freshness check and a fallback. Result: error returned to 9 percent. Since then I always test with production-like pipelines before launch.
09
Users say your internal chatbot gives outdated policy answers. What is the likely cause and fix?
The knowledge index probably still holds old document versions, or the model is answering from its training data instead of retrieved context. Fix the ingestion pipeline to re-index on document change and remove superseded versions. Store effective dates in metadata and filter or boost the latest. Instruct the model to answer only from provided context and show the source with its date, so users can verify it.
10
What is interference or a network effect in experiments, and why does it break standard A/B tests?
Standard A/B analysis assumes one user's outcome does not depend on another user's assignment, the SUTVA assumption. In social or messaging products, a treated user's new feature affects their untreated friends, so control is contaminated and the effect is biased. Solutions include cluster randomisation, where connected groups of users are assigned together, ego-network designs and comparing results across different cluster sizes to estimate the spillover.
11
Your LLM app takes 8 seconds to respond and users complain. What do you do?
Break down where the time goes: retrieval, model time to first token and generation length. Stream tokens so users see output immediately. Cut prompt and output length, run retrieval and other calls in parallel, and cache frequent answers. Use a smaller or faster model for simple requests, and avoid chains of several LLM calls where one would do. Set a latency budget per step and monitor p95, not just averages.
BERT is an encoder-only transformer that reads text in both directions at once. It was pretrained with masked language modelling, where about 15 percent of tokens are hidden and the model predicts them, plus next sentence prediction in the original version. This gives contextual embeddings, so a word's vector depends on its sentence. You fine-tune BERT with a small task head for classification, NER or question answering.
Transformers use self-attention to process all tokens in parallel and capture long-range context, making them faster to train and more scalable than sequential RNNs.
14
Write a scikit-learn ColumnTransformer that preprocesses numeric and categorical columns.
Scheduled retraining, like monthly, is simple and predictable but may be too late after a sudden change or wasteful when nothing changed. Trigger-based retraining runs when monitoring shows drift or a performance drop, which reacts faster but needs reliable monitoring. Many teams combine both: a regular schedule plus triggers for big shifts. Either way, a retrained model must pass the same evaluation gate before replacing the current one.
16
Train accuracy is 95% but test accuracy is 70%. What do you do?
This is overfitting. Check for data leakage, simplify the model, add regularization, get more data or augment it, use cross-validation, early stopping and feature selection.
An AI agent is an LLM that works in a loop: it plans a step, calls a tool, reads the result and decides the next step until the goal is met. For example, it might query a database, run Python on the result and write a summary. Agents handle multi-step tasks but are less predictable, slower and costlier than a single call. Good designs limit tools and steps, log every action and keep a human check for risky actions.
18
What is the difference between a function and a method?
NULL means unknown, so any comparison with NULL, even NULL = NULL, gives unknown and the row is filtered out. Use IS NULL or IS NOT NULL instead. Aggregates like SUM, AVG and COUNT(column) skip NULLs, so AVG may be computed over fewer rows than you expect. NOT IN with a subquery that contains a NULL returns no rows. COALESCE replaces NULLs with a default value.
21
Tell me about a time you had to deliver data under an urgent deadline.
Situation: the leadership team needed festive-sale numbers by city for a 9 am review, and the dashboard pipeline had failed overnight. Task: deliver accurate numbers in three hours. Action: I queried the raw orders tables directly, reused validated logic from the dashboard SQL, cross-checked totals with finance's daily figure and flagged two cities with partial data. Result: the review went ahead on time, and I later added pipeline failure alerts.
22
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.
23
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.
First rule out data issues: tracking changes, pipeline delays, missing partitions or a changed metric definition. Then compare with the same week last year and look for holidays or seasonality. Check normal weekly variation to see if 8 percent is unusual. Break the drop down by platform, region, app version and user type to find where it is concentrated. Finally, check releases, campaigns or outages that happened that week.
SVM finds the maximum-margin separating hyperplane. Kernels such as RBF compute similarity in a higher-dimensional space implicitly, so non-linear boundaries are possible.
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.
28
Pandas: find customers whose monthly spend increased for three consecutive months.
Semantic segmentation gives each pixel a class, such as road or car, but does not separate two cars. Instance segmentation separates individual objects of countable classes, giving each car its own mask. Panoptic segmentation combines both: every pixel gets a class, and countable objects also get an instance ID, while background stuff like sky stays semantic. Autonomous driving and robotics often need panoptic or instance output.
Use grid search, random search or Bayesian optimisation with cross-validation, starting with a coarse random search and narrowing the promising ranges.
32
What is CUPED and how does it reduce variance in experiments?
CUPED uses a pre-experiment covariate, usually the same metric for each user in the weeks before the test, to remove predictable variation. The adjusted metric is Y minus theta times (X minus the mean of X), where theta is cov(X, Y) divided by var(X). Because randomisation makes X balanced across groups, the estimate stays unbiased while variance can drop by 30 to 50 percent, letting tests reach significance faster with the same traffic.
33
Pandas: find the top 3 products by revenue in each region.
The ADF test checks whether a series has a unit root, which means it is non-stationary. The null hypothesis is that a unit root exists. A small p-value, say below 0.05, lets you reject the null and treat the series as stationary. It is often paired with the KPSS test, whose null is the opposite, stationarity. Using both gives a more reliable conclusion before choosing how much to difference.
36
What do kernel size, stride and padding mean in a convolution layer?
The kernel is a small learnable filter, such as 3x3, that slides over the image and computes a weighted sum at each position. Stride is how many pixels it moves each step; stride 2 halves the output size. Padding adds border pixels so the output can keep the same size and edge pixels get processed. Output size equals (input minus kernel plus 2 times padding) divided by stride, plus one.
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.
39
What are precision and recall trade-offs in practice?
Raising the threshold improves precision but lowers recall. Fraud detection leans to recall, while spam filters often prefer precision; choose by the cost of each error.
40
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.
Tips to crack the Thoughtworks Data Science interview
Practise pair programming with test-driven development, since Thoughtworks interviews often include coding together with an interviewer.
Read the latest Thoughtworks Technology Radar and form opinions on a few tools or techniques it lists.
Prepare to discuss social and economic justice values, which Thoughtworks openly includes in its culture discussions.
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; Thoughtworks interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Thoughtworks Data Science interview?
Candidates usually go through 5 stages: Online coding assessment; Code pairing round; Technical interview; Cultural fit or social change round; Leadership 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 Thoughtworks Data Science interview?
This practice set leans on Machine Learning (7), Python for Data Science (6), SQL for Data Science (5), MLOps and Model Deployment (5). Revise those first, then practise explaining one or two of your own projects end to end, because most Thoughtworks interviewers ask you to walk through real work.
Are these the exact questions asked at Thoughtworks?
No. These are curated practice questions that match the skills and difficulty usually tested in consulting interviews like Thoughtworks's. They are not a leaked or verified list of past questions.
Where does Thoughtworks hire Data Science professionals in India?
Thoughtworks has large teams in Pune, Bengaluru, Chennai, Gurugram, Hyderabad. Openings and locations change often, so check the Thoughtworks careers page and filter by city and experience.