40 questions with answers for candidates with Freshers — 29 easy, 11 medium.
What interviewers expect: freshers
Interviewers expect strong fundamentals rather than production experience. You should write clean Python and Pandas code, solve basic to medium SQL, explain core statistics like p-values and distributions, and understand common ML algorithms and metrics. Your projects are the main evidence, so be ready to explain data cleaning, model choice, validation and results clearly and honestly.
This set is weighted towards Python for Data Science (8), SQL for Data Science (5), Statistics and Probability (5), Machine Learning (5).
Python and Pandas basics SQL joins and aggregations Core statistics Project walkthrough
Solved at this levelStart 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 Python code using Hugging Face transformers to run sentiment analysis on a list of reviews.
from transformers import pipeline
clf = pipeline(
'sentiment-analysis',
model='distilbert-base-uncased-finetuned-sst-2-english'
)
reviews = ['Delivery was fast and the product is great',
'Packaging was damaged and support did not reply']
for text, out in zip(reviews, clf(reviews, batch_size=16)):
print(out['label'], round(out['score'], 3), '-', text)
02
What do ACF and PACF plots tell you about a time series?
The ACF plot shows correlation between the series and its own lags, including indirect effects through intermediate lags. The PACF shows the correlation at each lag after removing the effect of shorter lags. For a stationary series, a PACF that cuts off after lag p suggests an AR(p) term, and an ACF that cuts off after lag q suggests an MA(q) term. Spikes at lag 7 or 12 reveal weekly or yearly seasonality.
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.
05
Your image classifier trained on 2,000 images memorises the training set within 5 epochs. What do you try?
With so little data, I would use transfer learning from a pretrained model like ResNet or EfficientNet and fine-tune only the top layers first. I would add data augmentation such as flips, crops and colour changes, use dropout and weight decay, and apply early stopping on validation loss. Collecting more labelled images or using a smaller model also helps. I would check for duplicate images across train and validation sets too.
06
Pandas: find the top 3 products by revenue in each region.
The binomial distribution gives the probability of getting k successes in n independent trials, each with the same success probability p. Its mean is n times p and its variance is n times p times (1 minus p). You use it for counts of yes-or-no outcomes, such as how many of 1,000 visitors convert or how many of 50 parts are defective. For large n it is well approximated by a normal distribution.
08
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.
09
Write scikit-learn code for a pipeline with scaling and logistic regression, evaluated with 5-fold cross-validation.
In an A/A test both groups get the identical experience. Since there is no real difference, results should be significant only about 5 percent of the time at alpha 0.05. Running A/A tests validates your experimentation platform: it catches broken randomisation, logging bugs, sample ratio problems and metrics whose variance is wrongly estimated. Teams often run them when launching a new platform or a new metric.
11
Tell me about a time you found a data quality issue using SQL.
Situation: during my internship I was building a monthly sales report. Task: make sure numbers were correct before sharing. Action: I compared order counts per day and noticed one day had double the usual orders. A GROUP BY on order_id showed every order that day appeared twice because a load job had run twice. Result: I reported it, the data team removed duplicates and added a uniqueness check. Now I always validate row counts.
12
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.
13
Write Python code to group a list of order dictionaries by city and sum the amounts without Pandas.
With additive seasonality the seasonal swing is a fixed amount, for example weekends always add about 500 orders regardless of the overall level. With multiplicative seasonality the swing is a percentage of the level, so as the business grows the weekend spike grows too. A quick check is to plot the series: if the peaks widen as the trend rises, use multiplicative, or take a log and model it additively.
15
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.
16
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.
17
What is standard error and how is it different from standard deviation?
Standard deviation measures how spread out individual data points are. Standard error measures how much a sample statistic, usually the mean, would vary if you repeated the sampling. For the mean, SE = SD divided by the square root of n. So with more data the standard deviation stays roughly the same, but the standard error shrinks. Confidence intervals and t-tests are built on the standard error.
18
How do one-stage and two-stage object detectors differ?
Two-stage detectors, like Faster R-CNN, first propose candidate regions and then classify and refine each one, which gives strong accuracy, especially for small objects, but is slower. One-stage detectors, like YOLO and SSD, predict boxes and classes directly over a dense grid in a single pass, making them fast enough for real-time video. Modern one-stage models have closed most of the accuracy gap, so they dominate edge and video use cases.
A symmetric bell-shaped distribution defined by mean and standard deviation, where about 68%, 95% and 99.7% of values lie within 1, 2 and 3 standard deviations.
20
What are lambda functions and where are they useful?
An index is a separate sorted structure, usually a B-tree, that lets the database find rows without scanning the whole table, like a book index. It speeds up filters, joins and sorting on the indexed columns. Indexes cost storage and slow down inserts, updates and deletes because each index must be updated. They may be ignored for low-selectivity columns or when a function is applied to the column in WHERE.
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.
23
What is the difference between mean, median and mode?
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.
25
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.
26
Write torchvision transforms for training and validation of an image classifier using ImageNet normalisation.
Information from outside the training window, such as future data or test statistics, enters training and inflates performance. Split first, then fit scalers and encoders on training data only.
Binning groups a continuous variable into ranges, like age into 18-25, 26-35 and so on. It can capture non-linear effects in linear models, reduce the impact of outliers and make results easier to explain to business teams. Bins can be equal width, equal frequency using quantiles, or chosen by domain knowledge. The downside is losing information inside each bin, and tree models usually do not need it.
29
What is a baseline model and why should you build one first?
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.
30
Your logging system was down for four days, leaving gaps in a daily series. How do you handle them before modelling?
First make the gaps explicit by reindexing to a full daily calendar so missing days appear as NaN instead of silently disappearing. For short gaps, linear or time-based interpolation is usually fine. If there is strong weekly seasonality, fill using the same weekday from neighbouring weeks or a seasonal decomposition. Add a flag column marking imputed days, and never treat missing as zero unless zero really happened.
31
When would you use MAE, MSE or RMSE for a regression model?
MAE is the average absolute error; it is easy to explain and less sensitive to outliers. MSE squares errors, so large errors are punished heavily, and it is smooth for optimisation. RMSE is the square root of MSE, so it is in the same units as the target while still punishing big misses. Use RMSE when large errors are very costly, like stock-out forecasts, and MAE when outliers should not dominate.
32
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.
33
Write a function to calculate RMSE without any library.
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.
36
What is the difference between regression and classification?
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.
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.
40
Tell me about a time you had to learn a new deep learning framework or tool quickly.
Situation: my internship project used PyTorch, but I had only used Keras. Task: build a text classifier within two weeks. Action: I followed the official tutorials for two days, rebuilt a small Keras model in PyTorch to compare, and asked a senior to review my training loop. Result: I delivered the model on time with 88 percent F1. I learned that rebuilding something familiar is the fastest way into a new tool.
Frequently asked questions
What is asked in Data Science interviews for Freshers?
Interviewers expect strong fundamentals rather than production experience. You should write clean Python and Pandas code, solve basic to medium SQL, explain core statistics like p-values and distributions, and understand common ML algorithms and metrics. Your projects are the main evidence, so be ready to explain data cleaning, model choice, validation and results clearly and honestly.
How many questions should I practise before a Data Science interview?
Work through all 40 questions here, then the company-wise sets for the employers you are targeting. Quality matters more than count: be able to explain why each answer is right.
Which topics matter most for Freshers?
Focus first on Python and Pandas basics, SQL joins and aggregations, Core statistics, Project walkthrough.