1What's the difference between a list and a tuple in
Python?
Lists are mutable and can be changed after creation; tuples
are immutable, which makes them faster and hashable, so they
can be used as dictionary keys.
2What are Python decorators?
Functions that wrap another function to extend its behavior
without modifying its actual code, commonly used for
logging, timing, or access control.
3Explain generators and why they're
memory-efficient.
Generators yield values one at a time using yield, so they
don't hold the entire sequence in memory the way a list
would.
4What is the Global Interpreter Lock (GIL)?
A mutex in CPython that allows only one thread to execute
Python bytecode at a time, which limits true parallelism for
CPU-bound multi-threaded code.
5Difference between multiprocessing and multithreading in
Python?
Multiprocessing runs separate processes with their own
memory space, bypassing the GIL for true parallelism;
multithreading shares memory but is limited by the GIL for
CPU-bound tasks.
6What is NumPy broadcasting?
It lets NumPy perform operations on arrays of different
shapes by automatically expanding the smaller array without
physically copying data, saving memory and time.
7Explain the difference between .values and .to_numpy() in
Pandas.
Both extract the underlying NumPy array from a DataFrame or
Series; .to_numpy() is the newer, more explicit method and
is the recommended one going forward.
8What is the purpose of __init__ in a Python class?
It's the constructor method that runs automatically when a
new object is instantiated, used to initialize the object's
instance attributes.
9How would you handle a memory error while processing a
large dataset in Python?
Process data in chunks, use more memory-efficient dtypes,
switch to a library like Dask for out-of-core computation,
or downsample if the analysis allows it.
10What's the difference between a regular function and a
lambda function?
A lambda is a small anonymous function limited to a single
expression; a regular function defined with def can contain
multiple statements and is named.
11Explain *args and **kwargs.
*args lets a function accept a variable number of positional
arguments as a tuple; **kwargs lets it accept variable
keyword arguments as a dictionary.
12What's the difference between mutable and immutable
objects in Python?
Mutable objects, like lists and dictionaries, can be changed
after creation; immutable objects, like strings, tuples, and
integers, cannot.
13How do you profile and speed up slow Python code?
Use profiling tools like cProfile to find bottlenecks, then
optimize with vectorization, better algorithms, caching, or
compiled extensions like Cython or Numba.
14What's the difference between Pandas' merge() and
concat()?
merge() joins DataFrames based on common keys or columns
like a SQL join; concat() simply stacks DataFrames along an
axis without matching on any keys.
15Explain how Python's exception hierarchy works.
All exceptions inherit from BaseException, with common ones
like ValueError and TypeError inheriting from Exception,
letting you catch broad or specific error types.
16What is JSON normalization, and when would you use it in
Pandas?
json_normalize() flattens nested JSON structures into a flat
table, useful when working with API responses that contain
nested fields.
17What's the difference between a Python module and a
package?
A module is a single .py file; a package is a directory of
modules containing an __init__.py file that groups related
functionality together.
18How do you handle categorical variables in Python for
modeling?
Common techniques include one-hot encoding, label encoding,
or target encoding, chosen based on cardinality and whether
the model requires numeric input.
19What's the difference between .apply() and .map() in
Pandas?
.map() works element-wise on a Series only; .apply() works
on both Series and DataFrames and can operate row-wise,
column-wise, or element-wise.
20Explain what a context manager (the "with" statement)
does.
It automatically handles setup and teardown, like opening
and closing a file, ensuring resources are released properly
even if an error occurs mid-way.
Machine LearningQ21–Q40
21What's the difference between supervised and unsupervised
learning?
Supervised learning trains on labeled data to predict a
known outcome; unsupervised learning finds patterns or
groupings in data without labeled outcomes.
22Explain the bias-variance tradeoff.
High bias means a model is too simple and underfits; high
variance means it's too complex and overfits. The goal is
balancing both for the best generalization.
23What is overfitting, and how do you prevent it?
Overfitting is when a model learns noise in the training
data instead of the underlying pattern; it's prevented with
regularization, cross-validation, more data, or simpler
models.
24What is cross-validation?
A technique that splits data into multiple folds, training
and testing the model on different combinations, to get a
more reliable estimate of its performance.
25Explain the difference between L1 and L2
regularization.
L1 (Lasso) adds the absolute value of coefficients as a
penalty, which can shrink some to exactly zero for feature
selection; L2 (Ridge) adds the squared value, shrinking
coefficients but rarely to zero.
26What is a confusion matrix?
A table showing true positives, true negatives, false
positives, and false negatives, used to evaluate a
classification model's performance in detail.
27Difference between precision and recall?
Precision measures how many predicted positives were
actually correct; recall measures how many actual positives
the model successfully identified.
28What is the F1 score, and when would you prioritize
it?
The harmonic mean of precision and recall; it's useful when
you need a balance between the two, especially on imbalanced
datasets.
29Explain the difference between bagging and
boosting.
Bagging trains multiple models in parallel on random subsets
of data and averages their results to reduce variance;
boosting trains models sequentially, each correcting the
previous one's errors, to reduce bias.
30What is a Random Forest?
An ensemble of decision trees trained on random subsets of
data and features, whose predictions are averaged or voted
on to improve accuracy and reduce overfitting.
31How does a decision tree decide where to split?
It selects the split that produces the greatest reduction in
impurity, commonly measured using Gini impurity or entropy
and information gain.
32What is gradient boosting, and how is it different from
Random Forest?
Gradient boosting builds trees sequentially, with each tree
correcting the residual errors of the previous ones, unlike
Random Forest's parallel, independent trees.
33Explain the curse of dimensionality.
As the number of features grows, data becomes increasingly
sparse in the feature space, making distance-based models
less effective and increasing the risk of overfitting.
34What is feature scaling, and why does it matter?
It normalizes the range of independent variables so no
single feature dominates a distance-based or gradient-based
algorithm purely because of its scale.
35What's the difference between a parametric and
non-parametric model?
Parametric models assume a fixed functional form with a set
number of parameters, like linear regression; non-parametric
models grow in complexity with the data, like KNN or
decision trees.
36Explain the ROC curve and AUC.
The ROC curve plots the true positive rate against the false
positive rate at different thresholds; AUC summarizes
overall model performance across all thresholds, with 1.0
being perfect.
37What is k-fold cross-validation?
The dataset is split into k equal parts; the model trains on
k-1 folds and validates on the remaining fold, repeating k
times so every fold is used for validation once.
38What's the difference between K-Means and hierarchical
clustering?
K-Means requires specifying the number of clusters upfront
and partitions data iteratively; hierarchical clustering
builds a tree of nested clusters without needing a
predefined cluster count.
39Explain what hyperparameter tuning is and one common
method.
It's the process of finding the best configuration values
for a model that aren't learned from data, commonly done
using Grid Search or Random Search combined with
cross-validation.
40What is data leakage, and how do you prevent it?
It happens when information from outside the training set,
often from the future or the test set, improperly influences
model training; it's prevented with strict train/test
separation and careful feature engineering.
Deep Learning & NLPQ41–Q60
41What is a neural network, in simple terms?
A layered system of interconnected nodes (neurons) that
learns to map inputs to outputs by adjusting connection
weights through training.
42What is backpropagation?
The algorithm used to train neural networks by calculating
the gradient of the loss function with respect to each
weight, then updating weights to reduce error.
43What is the vanishing gradient problem?
In deep networks, gradients can shrink exponentially as
they're propagated backward through many layers, making
earlier layers learn extremely slowly or not at all.
44Explain the difference between CNN and RNN.
CNNs are designed for spatial data like images, using
convolutional filters to detect patterns; RNNs are designed
for sequential data like text or time series, maintaining a
memory of previous inputs.
45What is an activation function, and why is it
needed?
It introduces non-linearity into a neural network, allowing
it to learn complex patterns instead of behaving like a
simple linear model.
46What's the difference between ReLU and Sigmoid activation
functions?
ReLU outputs zero for negative inputs and the input itself
for positive ones, avoiding vanishing gradients on the
positive side; Sigmoid squashes outputs between 0 and 1 but
saturates and causes vanishing gradients at extremes.
47What is dropout, and why is it used?
A regularization technique that randomly disables a fraction
of neurons during training, forcing the network to avoid
relying too heavily on any single neuron, which reduces
overfitting.
48Explain what an LSTM is and why it's used over a standard
RNN.
Long Short-Term Memory networks use gates to control what
information is kept or forgotten, solving the vanishing
gradient problem that limits standard RNNs on long
sequences.
49What is a transformer architecture?
A model architecture built entirely around self-attention
mechanisms rather than recurrence, allowing it to process
sequences in parallel and capture long-range dependencies
more effectively.
50What is attention in the context of deep learning?
A mechanism that lets a model weigh the importance of
different parts of the input when producing each part of the
output, rather than treating all inputs equally.
51What is tokenization in NLP?
The process of breaking text into smaller units, like words
or subwords, that a model can process numerically.
52Explain the difference between stemming and
lemmatization.
Stemming crudely chops word endings to get a root form;
lemmatization uses vocabulary and grammar rules to return
the actual dictionary base form of a word.
53What are word embeddings?
Dense vector representations of words that capture semantic
meaning, so words with similar meanings end up close
together in the vector space.
54What's the difference between Word2Vec and TF-IDF?
Word2Vec learns dense semantic embeddings through a neural
network trained on context; TF-IDF is a sparse statistical
weighting based on word frequency and rarity across
documents.
55What is transfer learning?
Reusing a model pretrained on a large dataset and
fine-tuning it on a smaller, task-specific dataset, saving
training time and often improving performance.
56Explain batch normalization.
A technique that normalizes the inputs to each layer during
training, stabilizing and speeding up learning while
reducing sensitivity to weight initialization.
57What's the difference between epoch, batch, and iteration
in training?
An epoch is one full pass through the training data; a batch
is a subset of data processed at once; an iteration is one
update step, equal to processing one batch.
58What is an autoencoder used for?
A neural network trained to reconstruct its input, commonly
used for dimensionality reduction, anomaly detection, or
denoising data.
59Explain what a loss function does.
It quantifies how far the model's predictions are from the
actual values, giving the optimizer a signal to adjust
weights and improve accuracy.
60What's the difference between a generative and a
discriminative model?
A generative model learns the underlying data distribution
and can create new samples; a discriminative model focuses
only on distinguishing between classes given the input.
Statistics & ProbabilityQ61–Q80
61What is conditional probability, and why does it matter
in ML?
The probability of an event occurring given that another
event has already happened; it underlies models like Naive
Bayes and is central to reasoning about dependent features.
62Explain Bayes' Theorem in simple terms.
It's a way to update the probability of a hypothesis as new
evidence becomes available, combining prior belief with the
likelihood of the observed data.
63What's the difference between a discrete and a continuous
probability distribution?
A discrete distribution deals with countable outcomes, like
a dice roll; a continuous distribution deals with outcomes
over a continuous range, like height, described using
probability density functions.
64What is a normal distribution, and why is it so common in
statistics?
A symmetric, bell-shaped distribution where most values
cluster around the mean; it's common because many natural
and averaged phenomena tend toward it, per the Central Limit
Theorem.
65Explain what variance measures.
The average squared deviation of data points from the mean,
capturing how spread out a dataset is.
66What is covariance, and how is it different from
correlation?
Covariance measures how two variables change together in raw
units; correlation normalizes that relationship to a
standardized range between -1 and 1, making it easier to
interpret.
67What is the law of large numbers?
As a sample size grows, the sample average converges toward
the true population average, which is why larger datasets
tend to give more reliable estimates.
68What is a Z-score, and what does it represent?
It measures how many standard deviations a data point is
from the mean, used to compare values across different
distributions or detect outliers.
69Explain the difference between a one-tailed and a
two-tailed hypothesis test.
A one-tailed test checks for an effect in a single specified
direction; a two-tailed test checks for an effect in either
direction.
70What is sampling bias, and how can it affect a
model?
It occurs when the sample used doesn't represent the true
population, leading a trained model to learn skewed patterns
that don't generalize well to real-world data.
71What's the difference between a prior and a posterior
probability in Bayesian statistics?
A prior is your belief about a parameter before seeing data;
a posterior is the updated belief after incorporating
observed evidence via Bayes' Theorem.
72What is entropy in the context of information
theory?
A measure of uncertainty or randomness in a variable's
distribution; it's used in decision trees to decide the most
informative feature to split on.
73Explain what a chi-square test is used for.
It tests whether there's a significant association between
two categorical variables by comparing observed frequencies
to expected frequencies.
74What's the difference between independent and dependent
events?
Independent events don't influence each other's probability;
dependent events do, meaning the outcome of one changes the
likelihood of the other.
75What does "statistically significant" actually
mean?
It means the observed result is unlikely to have occurred by
random chance alone, based on a predefined significance
threshold, typically p < 0.05.
76What's the difference between population variance and
sample variance formulas?
Sample variance divides by n-1 instead of n, known as
Bessel's correction, to correct for the bias introduced by
estimating the mean from the same sample.
77Explain what a probability density function (PDF)
represents.
It describes the relative likelihood of a continuous random
variable taking on a specific value, where the area under
the curve over an interval gives the probability of falling
within that range.
78What's the difference between MLE and MAP
estimation?
Maximum Likelihood Estimation finds parameters that maximize
the likelihood of the observed data alone; Maximum A
Posteriori incorporates a prior belief about the parameters
along with that likelihood.
79How would you test if two groups have significantly
different means?
Using a t-test if comparing two groups with roughly normal
distributions, or a non-parametric alternative like the
Mann-Whitney U test if normality assumptions don't hold.
80What's the difference between homoscedasticity and
heteroscedasticity in regression?
Homoscedasticity means the residuals have constant variance
across all levels of the independent variable;
heteroscedasticity means that variance changes, which can
violate regression assumptions.
Model Evaluation & DeploymentQ81–Q100
81What is the train-test split, and why is it
necessary?
Splitting data into separate training and testing sets lets
you evaluate how well a model generalizes to unseen data,
instead of just checking how well it memorized the training
set.
82What's the difference between a validation set and a test
set?
The validation set is used during training to tune
hyperparameters and make model decisions; the test set is
held back entirely and used only for a final, unbiased
performance check.
83What's the difference between MAE and RMSE for regression
evaluation?
MAE treats all errors equally; RMSE penalizes larger errors
more heavily because of the squaring step, making it more
sensitive to outliers.
84What is R-squared, and what does it tell you?
It represents the proportion of variance in the dependent
variable that's explained by the model's independent
variables, with values closer to 1 indicating a better fit.
85Explain what model drift is.
The gradual degradation of a deployed model's performance
over time as real-world data patterns shift away from what
the model was originally trained on.
86What is A/B testing used for in model deployment?
Comparing a new model's real-world performance against the
current production model by routing a portion of live
traffic to each and measuring the outcome.
87What's the difference between online and batch
prediction?
Online prediction serves results in real time as requests
come in; batch prediction processes a large set of inputs
together on a schedule and stores the results.
88What is model versioning, and why does it matter?
Tracking different iterations of a trained model so you can
reproduce results, roll back to a previous version, or
compare performance across versions.
89Explain what a REST API is used for in model
deployment.
It exposes a trained model as a web service so other
applications can send input data and receive predictions
over HTTP.
90What is the precision-recall tradeoff, and how do you
manage it?
Increasing the classification threshold typically raises
precision but lowers recall, and vice versa; the right
balance depends on whether false positives or false
negatives are more costly for the business.
91What is feature importance, and how would you calculate
it?
A measure of how much each input feature contributes to a
model's predictions, often calculated using built-in
tree-based importances, permutation importance, or SHAP
values.
92What is SHAP, and why is it used?
A method based on game theory that explains individual
predictions by fairly attributing the contribution of each
feature to the final output.
93What's the difference between model interpretability and
explainability?
Interpretability refers to how naturally understandable a
model's internal logic is, like a simple decision tree;
explainability refers to techniques used to explain a
complex "black box" model's decisions after the fact.
94What is the cold start problem in recommendation
systems?
The difficulty of making accurate predictions for new users
or items that have little to no historical interaction data.
95How would you monitor a model in production?
Track prediction accuracy against ground truth when
available, monitor input data distribution for drift, and
set alerts for unusual latency or error rates.
96What's the difference between a pipeline and a single
model in ML workflows?
A pipeline bundles preprocessing steps, like scaling or
encoding, together with the model into a single reusable
object, ensuring the same transformations are applied
consistently at training and inference time.
97What is early stopping, and why is it used?
A technique that halts training once validation performance
stops improving, preventing the model from overfitting to
the training data.
98What is a champion-challenger model setup?
The champion is the current production model; a challenger
model is tested alongside it on live or held-out data to see
if it should replace the champion.
99How do you handle imbalanced classes in a classification
problem?
Techniques include resampling, either oversampling the
minority class or undersampling the majority, class
weighting, or using metrics like F1 or AUC instead of raw
accuracy.
100What would you check first if a deployed model's accuracy
suddenly drops?
Check for changes in the input data distribution, upstream
data pipeline issues, or schema changes before assuming the
model itself has degraded.
Ready to Practice These Live?
Our Data Science program includes real mock interview rounds built
around exactly these 100 questions, with mentor feedback after each
one.