Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About UBS hiring for Data Science roles
UBS is a Swiss global financial services firm known for wealth management, investment banking, asset management and Swiss retail banking. It acquired Credit Suisse in 2023. In India it runs large business solutions and technology centres that hire software engineers, data analysts, risk and finance professionals, and operations roles supporting its global businesses.
For Data Science roles, this UBS practice set focuses most on Machine Learning (7), Deep Learning and NLP (6), SQL for Data Science (5), Python for Data Science (4). It has 5 easy, 32 medium, 3 hard questions, so you can start easy and work up to the harder ones.
Company type
Banking & finance
Headquarters
Zurich, Switzerland
Main India offices
Pune, Mumbai, Hyderabad
UBS Data Science interview process
Online assessment (aptitude + coding)
Technical interview
Managerial or business round
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for UBSStart 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 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.
02
How does linear regression work and what are its assumptions?
It fits a line minimising squared error. Assumes linearity, independent errors, constant variance (homoscedasticity), normally distributed residuals and no strong multicollinearity.
03
Your credit model has good overall AUC but performs much worse for applicants from one region. What do you do?
First confirm with per-segment metrics and enough samples, since small groups are noisy. Then check why: fewer training examples from that region, different feature distributions, missing data or labels that reflect past biased decisions. Fixes include collecting more data, reweighting, segment-aware features or a separate calibration. Also review fairness and regulatory requirements, and agree with risk and compliance teams on acceptable performance gaps before launch.
04
What are lambda functions and where are they useful?
RNNs process sequences with a hidden state but struggle with long dependencies. LSTMs add gates that control what to remember or forget, easing the vanishing gradient.
06
Write Pandas code to encode hour of day as a cyclical feature.
import numpy as np
# hour 23 and hour 0 should be close, so use sin and cos
df['hour_sin'] = np.sin(2 * np.pi * df['hour'] / 24)
df['hour_cos'] = np.cos(2 * np.pi * df['hour'] / 24)
07
Write torchvision transforms for training and validation of an image classifier using ImageNet normalisation.
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.
09
What is the difference between hard voting and soft voting in ensembles?
In hard voting each model predicts a class and the majority wins. In soft voting each model gives class probabilities, they are averaged, and the class with the highest average wins. Soft voting usually works better because it uses each model's confidence, but it needs calibrated probabilities from all models. Hard voting is simpler and works even with models that only output labels.
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.
A forest averages many trees trained on bootstrapped rows and random feature subsets, which cuts variance and overfitting at the cost of interpretability.
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.
Gradients shrink as they pass through many layers (for example with sigmoid), so early layers barely learn. ReLU, residual connections and good initialisation help.
14
What is the difference between a star schema and a snowflake schema?
A star schema has a central fact table, like sales with amounts and foreign keys, surrounded by denormalised dimension tables such as product, customer and date. A snowflake schema normalises dimensions further, for example product links to a separate category table. Star schemas need fewer joins and are faster and simpler for analysts. Snowflake schemas save storage and reduce duplication but make queries more complex.
15
A query on a 200 million row table takes 20 minutes. How do you speed it up?
Start with EXPLAIN to see the plan and find full scans, bad joins or spills. Filter as early as possible and select only needed columns. Make sure the table is partitioned or clustered on the date column and that the query filters on it. Check join keys for type mismatches and duplicates that explode rows. Pre-aggregate into a summary table if the query runs daily, and replace correlated subqueries with joins or window functions.
16
Tell me about a time an experiment result changed a product decision.
Situation: the team was confident a redesigned home page would increase orders. Task: I owned the experiment design and analysis. Action: I set conversion as primary and session length and refunds as guardrails, ran it for two full weeks and found no lift in orders but a drop for older app versions. Result: we fixed the performance issue, retested, and shipped a version that raised orders by about 1.5 percent.
17
What is Bayesian A/B testing and how are its results reported?
Bayesian A/B testing starts with a prior on each variant's metric, updates it with observed data and produces a posterior distribution. Instead of a p-value, you report things like the probability that treatment beats control, say 94 percent, and the expected loss if you choose the wrong variant. Business teams find this easier to interpret. Priors must be chosen sensibly, and continuous monitoring still needs discipline about decision rules.
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.
As the number of independent trials grows, the sample average converges to the true expected value, which is why larger samples give more stable estimates.
20
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.
21
Pandas: find customers whose monthly spend increased for three consecutive months.
A baseline is the simplest reasonable prediction, such as predicting the most common class, last week's value or a basic logistic regression. It sets the minimum score any real model must beat. Without it, a 75 percent accuracy can look good when predicting the majority class already gives 80 percent. Baselines also catch pipeline bugs early and show whether extra complexity is worth it.
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.
24
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.
25
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.
26
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.
27
A deep network you built from scratch does not learn at all; the loss stays flat from the first epoch. Could weight initialisation be the reason?
If weights start too large, activations and gradients explode; if too small, they vanish, and training stalls. If all weights are equal, every neuron learns the same thing. Good schemes keep the variance of activations stable across layers: Xavier or Glorot initialisation for tanh and sigmoid, and He initialisation for ReLU. Frameworks use sensible defaults, but it matters when building custom layers or very deep networks.
28
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.
29
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'
);
30
Write Python code to compare revenue per user between two groups using Welch's t-test.
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.
Continuous integration runs automatic checks on every code change: unit tests for feature code, data validation, linting and a quick training run on sample data. Continuous delivery packages the model and service, for example as a Docker image, and deploys it through staging to production after evaluation gates, such as the new model beating the current one on a holdout set. Some teams add continuous training, which retrains on new data automatically.
34
Write Python code to evaluate a forecasting model with expanding-window time series cross-validation.
import numpy as np
from sklearn.model_selection import TimeSeriesSplit
from sklearn.metrics import mean_absolute_error
tscv = TimeSeriesSplit(n_splits=5, test_size=28)
scores = []
for tr, te in tscv.split(X):
model.fit(X.iloc[tr], y.iloc[tr])
pred = model.predict(X.iloc[te])
scores.append(mean_absolute_error(y.iloc[te], pred))
print(np.mean(scores), scores)
35
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.
36
Tell me about a time your analysis contradicted what leadership expected.
Situation: leadership believed a discount campaign drove a sales spike. Task: I was asked to measure its impact. Action: I compared similar regions with and without the campaign and found the spike matched a festival week in both. I shared the method, the charts and the limits openly. Result: they cut the next discount budget by half and moved it to retention. I learned to present surprising results with clear evidence and calm framing.
Use filter methods (correlation, chi-square), wrapper methods (RFE), embedded methods (Lasso, tree importance) and domain knowledge, validating each choice with cross-validation.
38
You need to use a device_id column with millions of unique values in a streaming model. How would feature hashing help?
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.
Bootstrapping estimates the uncertainty of a statistic by resampling your data with replacement many times, computing the statistic on each resample, and looking at the spread of results. It gives confidence intervals for things with no simple formula, like the median, a ratio or a model metric such as AUC. It needs no normality assumption, but it relies on the sample being representative and can be slow on very large data.
IoU measures how well a predicted box or mask overlaps the ground truth. It is the area of their intersection divided by the area of their union, giving a value from 0 for no overlap to 1 for a perfect match. In detection, a prediction usually counts as correct if IoU is at least 0.5 with a ground truth box of the same class. IoU is also used inside non-maximum suppression.
Tips to crack the UBS Data Science interview
Revise DSA, Java or Python, SQL and OOP concepts, and be ready to explain your code clearly in interviews.
Learn basics of wealth management, investment banking and financial markets to show interest in the business side.
Prepare examples of attention to detail and handling pressure, since banking technology roles demand reliability and accuracy.
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; UBS interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the UBS Data Science interview?
Candidates usually go through 4 stages: Online assessment (aptitude + coding); Technical interview; Managerial or business 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 UBS Data Science interview?
This practice set leans on Machine Learning (7), Deep Learning and NLP (6), SQL for Data Science (5), Python for Data Science (4). Revise those first, then practise explaining one or two of your own projects end to end, because most UBS interviewers ask you to walk through real work.
Are these the exact questions asked at UBS?
No. These are curated practice questions that match the skills and difficulty usually tested in banking & finance interviews like UBS's. They are not a leaked or verified list of past questions.
Where does UBS hire Data Science professionals in India?
UBS has large teams in Pune, Mumbai, Hyderabad. Openings and locations change often, so check the UBS careers page and filter by city and experience.