0% found this document useful (0 votes)
2 views4 pages

Data Science Interview Answers

The document is a comprehensive guide for data science interview preparation, covering key topics such as statistics, data preprocessing, exploratory data analysis, machine learning algorithms, model evaluation, and feature engineering. It includes detailed questions and answers that explain fundamental concepts and techniques relevant to the field. The content is structured into sections that facilitate understanding of both theoretical and practical aspects of data science.

Uploaded by

Bhavin Sadhu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Data Science Interview Answers

The document is a comprehensive guide for data science interview preparation, covering key topics such as statistics, data preprocessing, exploratory data analysis, machine learning algorithms, model evaluation, and feature engineering. It includes detailed questions and answers that explain fundamental concepts and techniques relevant to the field. The content is structured into sections that facilitate understanding of both theoretical and practical aspects of data science.

Uploaded by

Bhavin Sadhu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Data Science Interview Q&A – Detailed Interview-Ready Answers (2025 Edition)

Table of Contents
1. Statistics & Probability
2. Data Preprocessing & Cleaning
3. Exploratory Data Analysis (EDA)
4. Machine Learning Algorithms
5. Model Evaluation & Metrics
6. Feature Engineering
7. SQL & Data Handling
8. Deep Learning (Basics)
9. Data Science System Design / Deployment
10. Real-World Case Studies

1. Statistics & Probability


Q: What is the difference between population and sample? A: A population is the entire set of data or all
possible observations of interest in a study. For example, if we want to study the average height of all adults
in India, all adults form the population. A sample is a subset of the population that we actually collect data
from to make inferences about the population. Collecting data for the whole population is usually
impractical. Proper sampling ensures unbiased estimates.

Q: What are mean, median, and mode, and when do they differ? A: Mean is the arithmetic average,
median is the middle value when data is sorted, and mode is the most frequent value. In symmetric
distributions, all three are equal. In skewed distributions, they differ. Example: Dataset [2,2,3,5,100],
mean=22.4, median=3, mode=2. Median is preferred for skewed data.

Q: How do you handle skewed data? A: Transformations like log, sqrt, Box-Cox can normalize skewed
data. Robust statistics like median or IQR can be used instead of mean/standard deviation. Example: Annual
income data is right-skewed; log(income) normalizes it for regression.

Q: What is variance and standard deviation? A: Variance measures average squared deviation from
∑(xi −μ)2
mean: σ2 = n . Standard deviation is sqrt(variance). SD shows spread in same units as data.
Sensitive to outliers.

Q: Explain Central Limit Theorem (CLT). A: CLT states that sample means approximate a normal
distribution for large sample sizes, regardless of population distribution. Example: Sampling weights from
skewed population repeatedly produces normally distributed sample means. Useful for confidence intervals
and hypothesis testing.

1
Q: What is conditional probability? A: Probability of event A given B occurred: P(A|B) = P(A∩B)/P(B).
Example: Probability of rain given cloudy sky.

Q: Explain Bayes’ Theorem. A: P(A|B)=P(B|A)P(A)/P(B). Updates probability of a hypothesis with new


evidence. Example: Medical test diagnosis adjustment based on prevalence.

Q: What is independence between random variables? A: Events A and B are independent if P(A∩B) =
P(A)P(B). Knowledge of one event doesn’t affect probability of the other.

Q: Explain common distributions. A: Normal: symmetric, mean=median=mode. Binomial: success/failure


counts. Poisson: events per interval. Exponential: time between events. Uniform: all outcomes equally likely.

Q: What is law of total probability? A: P(A) = Σ P(A|B_i)P(B_i). Useful in Bayesian inference and breaking
complex probabilities.

Q: Explain null and alternative hypotheses. A: Null H0 = no effect/difference, Alternative H1 = effect/


difference. Example: H0: mean=50, H1: mean≠50.

Q: What is a p-value? A: Probability of observing the data assuming H0 is true. Small p (<0.05) → reject H0.

Q: Explain Type I and Type II errors. A: Type I: false positive (reject H0 incorrectly). Type II: false negative
(fail to reject H0).

Q: T-test vs Z-test? A: T-test: small sample, unknown variance. Z-test: large sample, known variance.

Q: ANOVA vs Chi-square test? A: ANOVA: compare means of 3+ groups. Chi-square: test independence for
categorical variables.

Q: How do you check independence statistically? A: Chi-square test for categorical, correlation/mutual
info for continuous variables.

2. Data Preprocessing & Cleaning


Q: What are the steps for data cleaning? A: Handling missing values, outlier detection, correcting
inconsistencies, standardizing data types, encoding categorical variables.

Q: How do you handle missing values? A: Methods: remove rows/columns, mean/median/mode


imputation, KNN imputation, or predictive modeling. Choice depends on missing data mechanism (MCAR,
MAR, MNAR).

Q: How to encode categorical variables? A: One-hot encoding, label encoding, ordinal encoding, target
encoding. Example: 'Red','Blue','Green' → One-hot: [1,0,0],[0,1,0],[0,0,1].

2
Q: How do you handle outliers? A: Remove extreme points, clip values, transform (log, sqrt), or use robust
models.

Q: Explain feature scaling. A: Standardization: z = (x-mean)/std. Normalization: scale to [0,1]. Scaling helps
models sensitive to magnitude (SVM, KNN, gradient descent).

Q: What is multicollinearity? A: High correlation between independent variables; affects regression


stability. Detect using VIF (>10 problematic) or correlation matrix. Solutions: drop features, combine, or PCA.

Q: Feature selection methods? A: Filter: correlation, statistical tests. Wrapper: Recursive Feature
Elimination (RFE). Embedded: Lasso (L1), tree-based importance.

3. Exploratory Data Analysis (EDA)


Q: What is EDA and why is it important? A: EDA summarizes data, identifies patterns, anomalies,
relationships, and informs feature engineering. Techniques: visualizations, summary statistics, correlation
analysis.

Q: How to detect skewness and kurtosis? A: Skewness measures asymmetry, kurtosis measures tail
heaviness. Positive skew: long right tail. High kurtosis: heavy tails. Use [Link] / kurtosis .

Q: Correlation vs causation? A: Correlation indicates association, not cause-effect. Example: ice cream
sales and drowning rates are correlated (summer), but ice cream doesn’t cause drowning.

Q: Recommended visualizations? A: Histogram, boxplot, scatterplot for numeric; bar chart, heatmap for
categorical/numeric relationships.

Q: Summarizing numeric & categorical features? A: Groupby + aggregation (mean, sum), pivot tables,
count/frequency analysis.

4. Machine Learning Algorithms


Supervised Learning: - Linear Regression: assumptions include linearity, homoscedasticity, independence,
normality. Example: Predict house prices. - Logistic Regression: outputs probability, coefficients = log-odds. -
Decision Trees: splits nodes based on Gini/entropy; prone to overfitting. - Random Forest: ensemble of
trees, reduces variance. - Gradient Boosting/XGBoost: sequentially fits trees to residuals to minimize error. -
Bias-Variance Tradeoff: high bias → underfit; high variance → overfit. Balance is key. - Regularization: L1
(Lasso) → sparse; L2 (Ridge) → shrink coefficients.

Unsupervised Learning: - K-Means: partitions data into K clusters, sensitive to initialization. - Hierarchical:
builds nested clusters via linkage. - PCA: reduces dimensionality, retains max variance; eigenvectors/values
indicate principal components.

3
5. Model Evaluation & Metrics
Classification Metrics: Accuracy, Precision, Recall, F1-score. Use F1-score for imbalanced datasets. ROC
curve & AUC assess model’s discriminative ability.

Regression Metrics: R², Adjusted R², RMSE, MAE. RMSE penalizes large errors more.

Cross-validation: k-fold or stratified to assess generalization.

Precision-recall tradeoff: Adjust threshold to balance false positives/negatives.

6. Feature Engineering
• Create meaningful features using domain knowledge, transformations, interactions.
• Handle dates: extract day, month, weekday, lag features.
• Encode categorical variables: one-hot, target encoding.
• Polynomial features for non-linear relationships.
• Dimensionality reduction

You might also like