Skip to content

CRED Data Science Interview Questions & Answers

Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.

Solved for CREDStart practicing
3 QUESTIONS FREESign up or log in 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 TF-IDF?

CREDMedium
Save to ▾
Show answer
Term Frequency × Inverse Document Frequency: a word scores high if it is frequent in one document but rare across all documents. A classic way to turn text into numeric features.
02

What are Python's main built-in data types?

CREDEasy
Save to ▾
Show answer
int, float, complex, bool, str, list, tuple, set, dict and NoneType. Mutable ones are list, set and dict; the others are immutable.
03

What is the difference between a set and a dictionary?

CREDEasy
Save to ▾
Show answer
A set stores unique values with no keys; a dictionary stores key-value pairs with unique keys. Both use hashing, so lookups are O(1) on average.
04

Explain Bayes' theorem with an example.

CREDMedium
Save to ▾
Show answer
P(A given B) = P(B given A) x P(A) / P(B). In a medical test it converts test accuracy and disease prevalence into the real chance a positive result means disease.
05

What is the Central Limit Theorem?

CREDMedium
Save to ▾
Show answer
The distribution of sample means approaches a normal distribution as the sample size grows (roughly 30+), whatever the population's shape. It lets us build confidence intervals and run hypothesis tests on means.
06

Pandas: merge vs join vs concat?

CREDMedium
Save to ▾
Show answer
merge joins on columns, SQL-style (how='inner', 'left', ...). join joins on the index. concat stacks DataFrames along rows or columns.
07

What is the difference between mean, median and mode?

CREDEasy
Save to ▾
Show answer
Mean is the average, median is the middle value after sorting and mode is the most frequent value. Median is more robust to outliers.
08

What are RNNs and why did LSTMs improve them?

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

What is SVM and the kernel trick?

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

What is a confidence interval?

CREDMedium
Save to ▾
Show answer
A range built from sample data that would contain the true parameter in a stated percentage (for example 95%) of repeated samples. It is not the probability that the parameter lies inside this one interval.
11

What is overfitting and how do you prevent it?

CREDEasy
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.
12

What is gradient descent and what does the learning rate do?

CREDMedium
Save to ▾
Show answer
An optimisation method that updates weights in the opposite direction of the loss gradient. The learning rate sets the step size: too high and it diverges, too low and it is slow. Variants include SGD, mini-batch and Adam.
13

What is the difference between iterators and iterables in Python?

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

What is tokenisation in NLP?

CREDEasy
Save to ▾
Show answer
Splitting text into units such as words, subwords or characters that are mapped to ids; subword methods like BPE handle rare words well.
15

What is the difference between Bayesian and frequentist approaches?

CREDHard
Save to ▾
Show answer
Frequentists treat parameters as fixed and use long-run frequencies; Bayesians treat parameters as distributions updated with data via priors and posteriors, giving direct probability statements.
16

How do you evaluate and explain a model to business stakeholders?

CREDHard
Save to ▾
Show answer
Tie metrics to business outcomes such as cost saved, show feature importance or SHAP values, give example predictions and be transparent about limitations.
17

Why do we use activation functions? Why is ReLU popular?

CREDMedium
Save to ▾
Show answer
Activations add non-linearity so networks can learn complex patterns. ReLU (max(0, x)) is cheap and reduces vanishing gradients compared with sigmoid/tanh; Leaky ReLU avoids 'dead' neurons.
18

What is an autoencoder and what is it used for?

CREDMedium
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 the difference between a function and a method?

CREDEasy
Save to ▾
Show answer
A method is a function that belongs to an object or class and receives the instance (self) as its first argument.
20

What are precision and recall trade-offs in practice?

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

What is standard deviation and what does it tell you?

CREDEasy
Save to ▾
Show answer
The square root of the variance; it measures how far values typically sit from the mean, in the same units as the data.
22

Difference between loc and iloc in Pandas?

CREDEasy
Save to ▾
Show answer
loc selects by label (row and column names, inclusive of the end label); iloc selects by integer position (end-exclusive).
23

Design an end-to-end churn prediction system.

CREDHard
Save to ▾
Show answer
Define churn and the prediction window → build usage and billing features → handle imbalance → train gradient boosting → evaluate with PR-AUC and lift → explain with SHAP → deploy as batch scoring or an API → monitor drift → hand top-risk users to the retention team.
24

What is the attention mechanism?

CREDMedium
Save to ▾
Show answer
It lets a model weigh which input positions matter most for each output, computing weighted combinations of values from query-key similarity. It is the core of transformers.
25

What are common ways to evaluate NLP models?

CREDMedium
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.
26

How do you handle missing values?

CREDEasy
Save to ▾
Show answer
First understand why data is missing. Then drop rows or columns with too many nulls, impute with mean/median/mode or a model (KNN), add a 'was_missing' flag, and fit imputers on training data only.
27

Which activation functions do you know and when to use them?

CREDMedium
Save to ▾
Show answer
ReLU for hidden layers, sigmoid for binary outputs, softmax for multi-class outputs and tanh when zero-centred outputs help; Leaky ReLU avoids dead neurons.
28

What is a normal distribution?

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

What is skewness?

CREDEasy
Save to ▾
Show answer
A measure of asymmetry. Right-skewed data has a long tail on the right (mean greater than median); left-skewed is the opposite. Log transforms often reduce right skew.
30

What is backpropagation?

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

How do you design an A/B test?

CREDHard
Save to ▾
Show answer
Define the hypothesis and one primary metric, calculate sample size from the baseline, minimum detectable effect, α and power, randomise users, run for full business cycles, check for sample-ratio mismatch, then test both statistical and practical significance.
32

What is PCA and when do you use it?

CREDMedium
Save to ▾
Show answer
It projects data onto orthogonal directions of maximum variance to reduce dimensions, remove correlation and speed up models, at some cost of interpretability.
33

What is sampling bias and how can you reduce it?

CREDMedium
Save to ▾
Show answer
Bias occurs when the sample does not represent the population. Reduce it with random or stratified sampling, higher response rates and by checking sample demographics against the population.
34

How do you use groupby with multiple aggregations?

CREDMedium
Save to ▾
Show answer
df.groupby('region').agg(total=('sales','sum'), avg=('sales','mean')) gives named aggregations per group in one pass.
35

What is statistical power and how can you increase it?

CREDMedium
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.
36

How do you handle imbalanced classes?

CREDMedium
Save to ▾
Show answer
Use stratified splits, class weights, resampling such as SMOTE, threshold tuning and judge models with precision, recall, F1 or PR-AUC instead of accuracy.
37

What is transfer learning?

CREDMedium
Save to ▾
Show answer
Reusing a model pretrained on a large dataset and fine-tuning it on a smaller task-specific dataset, saving data, time and compute.
38

What is the difference between regression and classification?

CREDEasy
Save to ▾
Show answer
Regression predicts continuous values such as price; classification predicts discrete categories such as spam or not spam.
39

CNN vs RNN vs Transformer — what is the difference?

CREDHard
Save to ▾
Show answer
CNNs use convolutions to find spatial patterns (images). RNNs/LSTMs process sequences step by step but struggle with long context. Transformers use self-attention to look at all tokens at once — parallel and better at long-range context; they power modern LLMs.
40

What is calibration of a classifier?

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

How do you deal with high-cardinality categorical features?

CREDMedium
Save to ▾
Show answer
Use target or frequency encoding with cross-validation, hashing, embeddings or grouping rare categories, instead of huge one-hot matrices.
42

What is NumPy broadcasting?

CREDEasy
Save to ▾
Show answer
The rule that lets arrays of different shapes operate together by virtually stretching the smaller one, for example adding a scalar or a (3,) vector to a (4,3) matrix.
43

Pearson vs Spearman correlation?

CREDEasy
Save to ▾
Show answer
Pearson measures linear relationships on continuous data; Spearman uses ranks, so it captures monotonic relationships and is less sensitive to outliers.
44

Pandas: find the top 3 products by revenue in each region.

CREDMedium
Save to ▾
Show answer
(df.assign(rev=df.price * df.qty) .groupby(['region', 'product'])['rev'].sum() .reset_index() .sort_values('rev', ascending=False) .groupby('region').head(3))
45

Why are NumPy arrays faster than Python lists?

CREDMedium
Save to ▾
Show answer
They store same-type values in contiguous memory and run vectorised operations in compiled C, avoiding Python loop overhead and per-object type checks.
46

Random forest vs a single decision tree?

CREDMedium
Save to ▾
Show answer
A forest averages many trees trained on bootstrapped rows and random feature subsets, which cuts variance and overfitting at the cost of interpretability.
47

Correlation vs covariance?

CREDEasy
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.
48

What is correlation and why does it not imply causation?

CREDMedium
Save to ▾
Show answer
Correlation measures linear association between variables (-1 to 1). A third factor, reverse causality or chance can create it, so causation needs controlled experiments.
49

Type I vs Type II error?

CREDEasy
Save to ▾
Show answer
Type I = false positive (rejecting a true null), probability α. Type II = false negative (missing a real effect), probability β. Power = 1 − β.
50

What is a RAG system and why use it?

CREDHard
Save to ▾
Show answer
Retrieval-Augmented Generation fetches relevant documents and gives them to an LLM as context, reducing hallucination and keeping answers grounded in current private data.
51

What is the difference between parametric and non-parametric tests?

CREDMedium
Save to ▾
Show answer
Parametric tests assume a distribution (usually normal) and use means; non-parametric tests such as Mann-Whitney use ranks and make fewer assumptions.
52

Explain the Law of Large Numbers.

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

What is batch normalisation?

CREDMedium
Save to ▾
Show answer
It normalises layer inputs per mini-batch and then rescales them, stabilising and speeding up training and allowing higher learning rates.
54

Explain p-value in simple words.

CREDEasy
Save to ▾
Show answer
The probability of seeing a result at least this extreme if the null hypothesis were true. A small p-value (for example < 0.05) is evidence against the null hypothesis.