Skip to content

Data Science Online Assessment Questions & Answers

40 questions for the online assessment stage — 18 easy, 22 medium.

About the online assessment round

Most companies start with an online test: aptitude and reasoning, a few MCQs on core Data Science concepts, and one or two short hands-on tasks. It filters a large number of applicants, so speed and accuracy both count.

Tips for the online assessment round

  • Practise under a timer: about one minute per MCQ and 15-20 minutes per hands-on task.
  • Read every option before answering; tests often include two nearly correct choices.
  • Use a stable internet connection, keep your camera on and avoid switching tabs in proctored tests.
  • Attempt the questions you are sure about first, then return to the harder ones.
Solved — online assessmentStart 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 to evaluate a forecasting model with expanding-window time series cross-validation.

Save to ▾
Show answer
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)
02

Write a FastAPI endpoint that serves predictions from a saved scikit-learn model.

Save to ▾
Show answer
from fastapi import FastAPI from pydantic import BaseModel import joblib import pandas as pd app = FastAPI() model = joblib.load('model.joblib') class Customer(BaseModel): tenure: int monthly_spend: float plan: str @app.post('/predict') def predict(c: Customer): X = pd.DataFrame([c.model_dump()]) return {'churn_probability': float(model.predict_proba(X)[0, 1])}
03

What is the F1 score and when can it be misleading?

Save to ▾
Show answer
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.
04

Your SQL result does not match the number on the official dashboard. How do you resolve it?

Save to ▾
Show answer
I would first align definitions: date range, time zone, filters like test users or cancelled orders, and whether the metric counts users or events. Then compare at a smaller grain, by day or by city, to find where the gap starts. I would read the dashboard's underlying query and check data refresh times. Once found, I would document the agreed definition so the same mismatch does not repeat.
05

What is the difference between a star schema and a snowflake schema?

Save to ▾
Show answer
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.
06

Correlation vs covariance?

Save to ▾
Show answer
Covariance shows the direction of a relationship but depends on units. Correlation is covariance scaled to −1…+1, so it shows direction and strength and is unit-free.
07

Why do you apply a log transform to some features?

Save to ▾
Show answer
A log transform compresses large values and spreads small ones, which reduces right skew in features like income, price or page views. This helps linear models and distance-based models that are sensitive to scale and outliers. Use log1p, which is log of 1 plus x, when the feature has zeros. For negative values, a Yeo-Johnson transform works. Tree models generally do not need it.
08

What are trend, seasonality and noise in a time series?

Save to ▾
Show answer
Trend is the long-term direction of the series, such as steady growth in monthly users. Seasonality is a pattern that repeats at a fixed period, like higher sales every weekend or every festive season. Noise is the random variation left after removing trend and seasonality. Separating these parts, through decomposition, helps you understand the data and pick a model that can capture each component properly.
09

Explain the chi-square test.

Save to ▾
Show answer
It checks whether observed category counts differ from expected counts, used for independence between two categorical variables and for goodness of fit.
10

What is a Poisson distribution used for?

Save to ▾
Show answer
Modelling the count of events in a fixed interval when events occur independently at a constant average rate, such as calls per hour or defects per batch.
11

A query using NOT IN returns zero rows even though matches should exist. What is the likely cause, and how do NULLs behave in SQL?

Save to ▾
Show answer
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.
12

What is early stopping?

Save to ▾
Show answer
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.
13

What is the difference between additive and multiplicative seasonality?

Save to ▾
Show answer
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.
14

What are common ways to evaluate NLP models?

Save to ▾
Show answer
Accuracy, F1 and confusion matrices for classification, BLEU or ROUGE for generation and summarisation, perplexity for language models, plus human review.
15

How do you handle dates and time zones in Pandas?

Save to ▾
Show answer
Convert strings with pd.to_datetime, giving a format argument for speed and safety. Use the .dt accessor to pull year, month, weekday or hour. For time zones, first tz_localize naive timestamps to their real source zone, then tz_convert to a common zone such as UTC or Asia/Kolkata. Store data in UTC and convert only for reporting. Mixing naive and aware timestamps causes errors, so keep one convention across the pipeline.
16

What is non-maximum suppression in object detection?

Save to ▾
Show answer
A detector usually predicts many overlapping boxes for the same object. Non-maximum suppression keeps the box with the highest confidence, removes other boxes of the same class whose IoU with it exceeds a threshold such as 0.5, and repeats with the remaining boxes. A threshold that is too low can delete genuinely nearby objects in crowded scenes, so variants like soft-NMS lower scores instead of removing boxes.
17

What are dataclasses in Python and why are they useful in data projects?

Save to ▾
Show answer
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.
18

What is an autoencoder and what is it used for?

Save to ▾
Show answer
A network that compresses inputs into a small latent code and reconstructs them; used for denoising, dimensionality reduction and anomaly detection.
19

What is a confusion matrix?

Save to ▾
Show answer
A table of true positives, false positives, true negatives and false negatives from which accuracy, precision, recall and F1 are calculated.
20

What is an A/A test and why would you run one?

Save to ▾
Show answer
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.
21

What is an isolation forest and how does it detect anomalies?

Save to ▾
Show answer
An isolation forest builds many random trees that split data on random features at random thresholds. Anomalies are rare and different, so they get isolated in very few splits, giving a short average path length. Normal points need many splits. The anomaly score comes from that path length. It is fast, works without labels and scales to large data, but you must choose a contamination rate or score threshold carefully.
22

You are building defect detection for a factory line where only 1 in 1,000 images shows a defect. How do you approach it?

Save to ▾
Show answer
With so few defects, a plain classifier will learn to say no defect. Collect every defect image possible and oversample them or use class-weighted or focal loss. Consider anomaly detection trained only on good parts, which flags anything unusual. Use augmentation that mimics real variation in lighting and position. Evaluate with recall at a fixed false alarm rate, since missing a defect usually costs far more than a manual recheck.
23

Write Python code to calculate the sample size per group needed to detect a lift from 5 percent to 5.5 percent conversion.

Save to ▾
Show answer
from statsmodels.stats.power import NormalIndPower from statsmodels.stats.proportion import proportion_effectsize baseline, target = 0.05, 0.055 effect = proportion_effectsize(target, baseline) # Cohen's h n = NormalIndPower().solve_power( effect_size=effect, alpha=0.05, power=0.8, ratio=1.0, alternative='two-sided' ) print(round(n)) # about 31,000 users per group
24

How do you detect outliers?

Save to ▾
Show answer
Use the IQR rule (below Q1-1.5 IQR or above Q3+1.5 IQR), z-scores beyond 3, box plots or model-based methods such as Isolation Forest, then decide whether to cap, remove or keep them.
25

What is conditional probability? Give an example.

Save to ▾
Show answer
Conditional probability is the chance of an event given that another event has happened, written P(A given B) = P(A and B) / P(B). Example: 10 percent of users buy, and 40 percent of users who add to cart buy. So P(buy given cart) is 0.4, much higher than the overall 0.1. It is the base of Bayes' theorem, Naive Bayes and many funnel analyses.
26

Write SQL to pivot order counts by status into columns using CASE WHEN.

Save to ▾
Show answer
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;
27

Write a prompt template for classifying customer support tickets.

Save to ▾
Show answer
System: You classify support tickets for an e-commerce company. Categories: payment, delivery, refund, account, other. Rules: choose exactly one category; if unsure, choose other; do not invent details. Return JSON with fields category and reason, reason under 20 words. Then two short examples showing a ticket and the expected JSON. User: Ticket: {ticket_text}. Keep the template fixed and test it on 100 labelled tickets before rollout.
28

What is chunking in RAG and how do you choose a chunk size?

Save to ▾
Show answer
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.
29

What is statistical power and how can you increase it?

Save to ▾
Show answer
Power is the probability of detecting a real effect. Increase it with a larger sample, a bigger effect size, lower noise or a higher significance level.
30

What are interaction features and when do they help?

Save to ▾
Show answer
Interaction features combine two or more variables, such as price times quantity, or income divided by number of dependents. They help linear models capture effects where one variable changes the impact of another. Tree models can learn some interactions themselves, but explicit ratios often still help. Too many automatic interactions explode the feature count and overfit, so build them from domain logic and validate each one.
31

What is feature scaling and which models need it?

Save to ▾
Show answer
Putting features on comparable ranges using standardisation or min-max scaling. Distance-based and gradient-based models (KNN, SVM, regression, neural nets) need it; tree models do not.
32

What is overfitting and how do you prevent it?

Save to ▾
Show answer
The model memorises noise and fails on new data. Prevent it with more data, simpler models, regularisation, cross-validation, early stopping and dropout.
33

Explain precision vs recall. When would you prefer recall?

Save to ▾
Show answer
Precision = TP / (TP + FP). Recall = TP / (TP + FN). Prefer recall when missing a positive is costly — for example disease screening or fraud detection.
34

What is Naive Bayes and why is it called naive?

Save to ▾
Show answer
It applies Bayes' theorem assuming features are independent given the class. The assumption is rarely true but the model is fast and works well for text.
35

What is the difference between COUNT(*), COUNT(column) and COUNT(DISTINCT column)?

Save to ▾
Show answer
COUNT(*) counts all rows, including rows with NULLs. COUNT(column) counts only rows where that column is not NULL. COUNT(DISTINCT column) counts unique non-NULL values. For example, in an orders table, COUNT(*) is the number of orders, COUNT(coupon_code) is orders that used a coupon, and COUNT(DISTINCT customer_id) is the number of unique buyers. Mixing them up is a common reporting bug.
36

Write SQL to find the top 3 products by revenue in each category.

Save to ▾
Show answer
WITH rev AS ( SELECT category, product_id, SUM(price * qty) AS revenue FROM order_items GROUP BY category, product_id ), ranked AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) AS rn FROM rev ) SELECT category, product_id, revenue FROM ranked WHERE rn <= 3;
37

What is experiment tracking and why use a tool like MLflow?

Save to ▾
Show answer
Experiment tracking records each training run's parameters, code version, data version, metrics and output artefacts. Tools like MLflow or Weights and Biases store this in one place, so you can compare runs, reproduce the best model and see why something improved. Without it, results live in notebook outputs and memory. MLflow also offers a model registry to move approved models through staging and production.
38

What is ANOVA and when would you use it?

Save to ▾
Show answer
ANOVA, analysis of variance, tests whether three or more group means are equal. It compares variation between groups to variation within groups using an F statistic. For example, comparing average order value across four city tiers. A significant result says at least one mean differs but not which one, so you follow up with post-hoc tests like Tukey's HSD. It assumes independent samples, roughly normal residuals and similar variances.
39

What does the axis parameter mean in NumPy and Pandas?

Save to ▾
Show answer
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.
40

Write Python code to group a list of order dictionaries by city and sum the amounts without Pandas.

Save to ▾
Show answer
from collections import defaultdict orders = [ {'city': 'Pune', 'amount': 250}, {'city': 'Delhi', 'amount': 400}, {'city': 'Pune', 'amount': 150}, ] totals = defaultdict(float) for o in orders: totals[o['city']] += o['amount'] print(dict(totals)) # {'Pune': 400.0, 'Delhi': 400.0}

Frequently asked questions

What happens in the Data Science online assessment round?

Most companies start with an online test: aptitude and reasoning, a few MCQs on core Data Science concepts, and one or two short hands-on tasks. It filters a large number of applicants, so speed and accuracy both count.

How do I clear the online assessment round?

Practise under a timer: about one minute per MCQ and 15-20 minutes per hands-on task. Read every option before answering; tests often include two nearly correct choices. Use a stable internet connection, keep your camera on and avoid switching tabs in proctored tests.

Which round comes next?

A typical order is online assessment, telephonic screening, one or two technical rounds, a managerial round and HR. Use the other round pages to practise each stage.