0% found this document useful (0 votes)
14 views35 pages

Data Science Interview Questions for Logistics

The document provides a comprehensive list of commonly asked interview questions and sample answers for Data Science roles focused on logistics, covering topics such as supply chain analytics, forecasting, and route optimization. It includes beginner to advanced level questions on data science concepts, programming, machine learning, and real-world applications, along with practical examples and explanations. Additionally, it offers tips for effectively communicating findings to non-technical stakeholders and a structured approach for answering interview questions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views35 pages

Data Science Interview Questions for Logistics

The document provides a comprehensive list of commonly asked interview questions and sample answers for Data Science roles focused on logistics, covering topics such as supply chain analytics, forecasting, and route optimization. It includes beginner to advanced level questions on data science concepts, programming, machine learning, and real-world applications, along with practical examples and explanations. Additionally, it offers tips for effectively communicating findings to non-technical stakeholders and a structured approach for answering interview questions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Here’s a list of commonly asked interview questions for a Data

Science role focused on logistics along with sample answers. These


are tailored for roles that involve supply chain analytics, forecasting, route
optimization, inventory management, etc.

🔹 1. What is your experience with logistics or supply chain data?

Answer:

I have worked with logistics datasets such as shipment tracking,


warehouse inventory, delivery routes, and supplier lead times. I’ve used
data science techniques to optimize delivery schedules, forecast demand
using time-series models like ARIMA and Prophet, and reduce
transportation costs through clustering and route optimization algorithms.

🔹 2. How would you forecast product demand across multiple


warehouses?

Answer:

I would use historical sales data and external factors such as promotions,
seasonality, and market trends. Models like SARIMA, Prophet, or even
LSTM neural networks can capture temporal patterns. I would build
separate models for each warehouse or apply hierarchical time-series
forecasting depending on data granularity.

🔹 3. What metrics would you track to measure logistics


performance?

Answer:

Key logistics KPIs include:

 On-time delivery rate

 Order fulfillment accuracy

 Inventory turnover rate

 Freight cost per unit

 Warehouse picking/packing time


I would use dashboards to track these in real time and apply root
cause analysis on any drops in performance.
🔹 4. How would you reduce shipping costs using data science?

Answer:

I would analyze shipment data to identify high-cost routes, underutilized


transport modes, and carrier performance. Then I would apply clustering
to consolidate shipments and linear optimization models to suggest cost-
effective route plans, carrier combinations, or distribution center
assignments.

🔹 5. How can machine learning help with route optimization?

Answer:

ML can predict delays based on traffic, weather, or historical performance,


allowing for proactive rerouting. Algorithms like Genetic Algorithms or Ant
Colony Optimization can find optimal routes, especially in complex
delivery networks like last-mile logistics.

🔹 6. Explain a project where you used data science in a logistics-


related domain.

Answer:

I worked on a project for a distribution company where I built a demand


forecasting model to predict product needs at regional warehouses. Using
Prophet and XGBoost, we reduced stockouts by 25% and improved
inventory turnover. I also visualized inventory heatmaps using Power BI for
quicker decision-making.

🔹 7. Which tools and languages do you use in logistics data


science projects?

Answer:

I primarily use Python (pandas, scikit-learn, XGBoost, TensorFlow), SQL for


querying data, and visualization tools like Tableau or Power BI. For
route/network optimization, I use libraries like OR-Tools and PuLP.

🔹 8. How would you handle missing or inconsistent data in


logistics datasets?

Answer:
Logistics data can have missing timestamps, delivery confirmations, or
wrong coordinates. I use imputation techniques (mean, median, or ML-
based) and business rules to clean data. For example, I may infer delivery
status from GPS logs or scan times.

🔹 9. What is the difference between classification and clustering


in supply chain analysis?

Answer:

Classification is supervised learning—used to predict known labels, like


classifying a shipment as on-time or delayed. Clustering is unsupervised
and helps group data without labels—like segmenting customers or
grouping similar delivery routes.

🔹 10. How do you explain your findings to non-technical


stakeholders?

Answer:

I focus on the business impact and use clear visuals to communicate


insights. For example, instead of saying "XGBoost improved RMSE by
20%", I say "The new model helped reduce excess stock by 15%, saving
$200k monthly."

Here’s a categorized list of Data Science interview questions with


answers, covering Beginner, Intermediate, and Advanced levels.
These questions span core data science topics like statistics, machine
learning, data wrangling, and business applications.

🔰 Beginner Level Questions (0–1 years experience)

1. What is Data Science?

Answer:
Data Science is the field that uses statistical methods, algorithms, and
machine learning to extract insights and knowledge from structured and
unstructured data to support decision-making.

2. What’s the difference between Supervised and Unsupervised


Learning?

Answer:

 Supervised Learning: Uses labeled data (e.g., linear regression,


decision trees).

 Unsupervised Learning: Uses unlabeled data to find hidden


patterns (e.g., K-Means, PCA).

3. What is overfitting in machine learning?

Answer:

Overfitting occurs when a model learns the training data too well,
including noise and outliers, and fails to generalize to new, unseen data.

4. What is the difference between population and sample?

Answer:

 Population: Entire group of data.

 Sample: Subset of the population used for analysis.

5. Explain the steps in a Data Science project.

Answer:

1. Problem definition

2. Data collection

3. Data cleaning

4. Exploratory Data Analysis (EDA)

5. Feature engineering

6. Model training

7. Model evaluation
8. Deployment

🧩 Intermediate Level Questions (1–3 years experience)

6. How do you handle missing data?

Answer:

 Remove rows/columns (if few missing)

 Impute using mean/median/mode

 Use predictive models

 Use interpolation or KNN for time series or similarity-based


imputation

7. What is the Central Limit Theorem (CLT)?

Answer:

The CLT states that the sampling distribution of the sample mean
approaches a normal distribution as the sample size increases, regardless
of the population's distribution.

8. How do you evaluate a classification model?

Answer:

Using metrics such as:

 Accuracy

 Precision, Recall, F1-Score

 Confusion Matrix

 ROC Curve & AUC

9. What is feature selection and why is it important?

Answer:

Feature selection is the process of selecting the most relevant variables


for your model to improve performance and reduce overfitting. Methods
include:
 Filter methods (e.g., correlation)

 Wrapper methods (e.g., RFE)

 Embedded methods (e.g., Lasso)

10. Difference between bagging and boosting?

Answer:

 Bagging: Reduces variance; builds models in parallel (e.g., Random


Forest)

 Boosting: Reduces bias; builds models sequentially (e.g., XGBoost,


AdaBoost)

🚀 Advanced Level Questions (3+ years experience)

11. What is regularization? What are L1 and L2?

Answer:

Regularization prevents overfitting by adding a penalty term to the loss


function:

 L1 (Lasso): Adds absolute values, performs feature selection

 L2 (Ridge): Adds squared values, shrinks coefficients

12. Explain the bias-variance trade-off.

Answer:

 Bias: Error due to wrong assumptions; underfitting

 Variance: Error due to sensitivity to small fluctuations; overfitting


Goal: Find the right balance for low total error.

13. What is PCA (Principal Component Analysis)?

Answer:

PCA is a dimensionality reduction technique that transforms correlated


variables into a set of uncorrelated variables (principal components) that
retain most of the data's variance.
14. What’s the difference between precision and recall?

Answer:

 Precision: TP / (TP + FP) → How many predicted positives are


correct

 Recall: TP / (TP + FN) → How many actual positives are caught


Useful in imbalanced datasets (e.g., fraud detection).

15. How do you tune hyperparameters of a model?

Answer:

 Grid Search: Try all combinations

 Random Search: Try random combinations

 Bayesian Optimization (e.g., with Optuna)


Often combined with Cross-Validation to validate performance.

Certainly! Here's a more detailed and structured list of Data Science


interview questions and answers, across core concepts,
programming, machine learning, and real-world applications —
with clear and practical examples.

🔍 Statistics & Probability

1. What is p-value in hypothesis testing?

Answer:

The p-value tells us the probability of observing our sample data (or more
extreme) assuming the null hypothesis is true.

 If p < 0.05 (common threshold), we reject the null hypothesis.

 A small p-value means the observed data is unlikely under the


null.

🧠 Example:
Testing whether a new logistics system reduces delivery time:
 Null Hypothesis: No change in delivery time.

 If p = 0.01 → statistically significant → we reject the null.

2. What is the difference between confidence interval and


prediction interval?

Answer:

 Confidence Interval (CI): Range within which the mean of the


population lies.

 Prediction Interval: Range where a new individual observation


is likely to fall.

🧠 Example:
If the average delivery time = 3.2 days,

 CI = 3.0 to 3.4 days (we are 95% confident the true mean lies
here)

 Prediction interval = 2.0 to 4.5 days (future shipment could arrive in


this range)

🧮 Programming (Python/Pandas/SQL)

3. How do you handle large datasets in Python (Pandas)?

Answer:

 Use chunking (pd.read_csv(..., chunksize=100000))

 Filter unnecessary columns early

 Use Dask or Polars for scalable processing

 Convert object columns to category

 Use .loc[] instead of .iloc[] when possible

4. Write SQL to find the second highest salary from an Employee


table.

SELECT MAX(salary)

FROM employee
WHERE salary < (SELECT MAX(salary) FROM employee);

🧠 Tip: Use ROW_NUMBER() or DENSE_RANK() for more advanced salary


banding.

🤖 Machine Learning

5. What is cross-validation and why is it used?

Answer:

Cross-validation splits data into k parts (folds), trains on k-1 parts, and
tests on the remaining fold.
This repeats k times to ensure the model performs well on unseen data.

🧠 Common type:

 k-Fold CV (k=5 or 10)

 Stratified CV (when data is imbalanced)

6. What is the ROC Curve?

Answer:

The ROC Curve plots True Positive Rate (Recall) vs. False Positive
Rate.
It shows how good a model is at distinguishing between classes.

🧠 AUC (Area Under Curve):

 0.5 → random guessing

 0.7–0.9 → good

 0.9 → excellent

7. Difference between batch gradient descent and stochastic


gradient descent?

Batch Gradient Stochastic Gradient Descent


Feature
Descent (SGD)

Update
After all data After each data point
frequency
Batch Gradient Stochastic Gradient Descent
Feature
Descent (SGD)

Speed Slower Faster

Convergence Stable Noisy, may oscillate

Use case Small datasets Large datasets

📊 Data Cleaning & Feature Engineering

8. How do you deal with categorical variables?

Answer:

 Label Encoding: Ordinal categories (e.g., "low", "medium", "high")

 One-Hot Encoding: Nominal variables (e.g., "Red", "Blue",


"Green")

 Target Encoding: Replace categories with average target values


(be careful of leakage)

9. What is multicollinearity? How do you detect and fix it?

Answer:

Multicollinearity happens when two or more features are highly


correlated, which can distort coefficients in regression models.

Detection:

 Check correlation matrix

 Use Variance Inflation Factor (VIF)

Fix:

 Drop one of the variables

 Use PCA to combine features

 Use regularization (Lasso)

🧠 Deep Learning (Advanced)


10. What is the vanishing gradient problem?

Answer:

In deep neural networks, gradients can become very small (approaching


zero) as they backpropagate through layers — especially with sigmoid or
tanh activations — causing the model to learn slowly or not at all.

🧠 Solutions:

 Use ReLU activation

 Apply Batch Normalization

 Use Residual Networks (ResNet)

🧭 Business & Applied Scenarios

11. How would you approach a churn prediction problem?

Answer:

1. Understand business goals – e.g., telecom customers leaving

2. Gather data – transactions, support tickets, usage stats

3. Feature engineering – usage frequency, complaints, last login,


payment history

4. Model – Logistic Regression, XGBoost

5. Evaluate – ROC AUC, Precision/Recall

6. Deploy – alert sales team when high-risk customer is flagged

12. What’s your process for selecting a machine learning model?

Answer:

It depends on:

 Problem type (classification, regression, etc.)

 Data size

 Accuracy vs Interpretability

 Real-time vs batch prediction


🧠 Example:
For a quick and interpretable model: Logistic Regression
For complex non-linear relationships: Random Forest, XGBoost

✅ Final Tip: STAR Format for Interviews

When asked about projects or experience, use this format:

S – Situation
T – Task
A – Action
R – Result

🧠 Example:

“In my last project (S), I had to improve warehouse demand forecasting


(T). I used Prophet with holiday regressors (A), which reduced stockouts by
18% in 3 months (R).”

Absolutely! Here’s Part 2 of detailed Data Science interview


questions and answers covering more advanced ML concepts, time
series, NLP, deployment, and scenario-based business problem-solving.

🔁 Time Series Analysis

13. What is stationarity and why is it important in time series


forecasting?

Answer:

A stationary time series has a constant mean, variance, and


autocorrelation over time. Most forecasting models (like ARIMA) assume
the data is stationary.

To check stationarity:

 Plot rolling mean/variance

 Use ADF (Augmented Dickey-Fuller) test

To make it stationary:

 Differencing
 Log transform

 Seasonal adjustment

14. Difference between AR, MA, ARMA, and ARIMA models?

Model Description

AR
Predicts value using past values
(AutoRegressive)

MA (Moving
Predicts using past forecast errors
Average)

ARMA Combines AR and MA

Adds differencing to ARMA to handle non-


ARIMA
stationarity

🧠 Example: ARIMA(p, d, q)

 p: AR terms

 d: Differencing

 q: MA terms

15. What is seasonality in time series? How do you detect and


handle it?

Answer:

Seasonality refers to patterns that repeat over fixed time intervals (e.g.,
daily, monthly). You can detect it using:

 Decomposition (trend/seasonal/residual)

 ACF plots (lags)

To handle:

 Use seasonal models like SARIMA

 Add seasonal dummy variables

 Use Fourier transforms for complex cycles

Natural Language Processing (NLP)


16. What is TF-IDF?

Answer:

TF-IDF (Term Frequency–Inverse Document Frequency) measures


how important a word is to a document in a collection.

 TF: How often a term appears in a document

 IDF: Logarithm of total documents / number of documents


containing the word

🧠 Useful for converting text to numeric features for ML models.

17. What is word embedding? How is it different from one-hot


encoding?

Answer:

Word embeddings (e.g., Word2Vec, GloVe, BERT) represent words in a


dense vector space capturing meaning and context.

One-hot encoding Word Embedding

Sparse vectors
Dense vectors
(mostly 0s)

Captures semantic
No meaning captured
meaning

Usually 50–300
Size = vocab size
dimensions

18. What is stemming vs lemmatization?

Stemming Lemmatization

Removes suffixes Converts word to base form


crudely (lemma)

Faster, less accurate Slower, linguistically correct

“running” → “run” “ran” → “run”

🚀 Model Deployment & MLOps


19. How do you deploy a machine learning model?

Answer:

1. Train and validate model

2. Save it (e.g., using pickle or joblib)

3. Build API with Flask, FastAPI, or Django

4. Containerize with Docker

5. Deploy on cloud (AWS, GCP, Azure)

6. Monitor drift and performance

20. What is model drift? How do you handle it?

Answer:

Model drift occurs when the model’s performance degrades over time
due to changing data patterns (data distribution shift).

Types:

 Data drift (feature distribution changes)

 Concept drift (target definition changes)

🧠 Handling:

 Monitor metrics

 Retrain on new data

 Use drift detection tools (e.g., EvidentlyAI)

🧠 Advanced Machine Learning Concepts

21. What are ensemble methods?

Answer:

Ensemble methods combine multiple models to improve accuracy and


robustness.

Types:

 Bagging: Parallel (e.g., Random Forest)


 Boosting: Sequential (e.g., XGBoost, LightGBM)

 Stacking: Combine different models via meta-learner

22. Explain precision-recall trade-off. When is precision more


important than recall?

Answer:

 Precision: Focus on fewer false positives

 Recall: Focus on fewer false negatives

🧠 Use cases:

 Precision Priority: Spam detection (don’t flag real emails)

 Recall Priority: Disease diagnosis (catch all true positives even


with false alarms)

23. How does a decision tree split the data?

Answer:

It uses metrics like:

 Gini Impurity: Probability of incorrect classification

 Entropy (Information Gain): Uncertainty in data

It recursively splits data to maximize purity in resulting nodes.

24. How do you deal with imbalanced datasets?

Answer:

 Resampling techniques: SMOTE, oversampling minority class,


undersampling majority class

 Use different metrics: Precision, Recall, F1-Score, ROC AUC

 Cost-sensitive learning: Penalize misclassification

📦 Business & Real-World Scenarios


25. Imagine you are given customer purchase data. How would
you build a recommendation system?

Answer:

1. Collaborative filtering: User-user or item-item similarity

2. Content-based filtering: Recommend based on item features

3. Matrix Factorization: e.g., SVD

4. Deep Learning: e.g., autoencoders or transformers

26. How would you explain an ML model to a non-technical


stakeholder?

Answer:

Focus on the outcome, benefits, and use simple visualizations. Avoid


technical jargon and emphasize the impact on business.

🧠 Example:
Instead of saying “Our XGBoost model has 0.86 AUC,” say:

“This model helps us identify 86% of at-risk customers before they leave,
enabling proactive engagement and revenue protection.”

Here is a comprehensive guide to major Machine Learning (ML) and


Deep Learning (DL) algorithms — covering:

 ✅ Name of Algorithm

 🔍 Type (Supervised, Unsupervised, Reinforcement, etc.)

 🛠 Used for (classification, regression, clustering, etc.)

 📘 Detailed Explanation with Examples

🧠 Machine Learning Algorithms

1. Linear Regression

 🔍 Type: Supervised
 🛠 Used for: Regression (predicting continuous values)

 📘 Details:
Predicts a continuous target variable based on one or more
independent variables using the line:
y = β0 + β1x1 + β2x2 + ... + ε
Ideal for simple predictive analytics (e.g., housing price, salary).

2. Logistic Regression

 🔍 Type: Supervised

 🛠 Used for: Classification (binary/multiclass)

 📘 Details:
Estimates the probability that a given input belongs to a class using
a sigmoid function.
E.g., Email spam detection (spam or not), disease prediction
(yes/no)

3. Decision Tree

 🔍 Type: Supervised

 🛠 Used for: Classification & Regression

 📘 Details:
Splits data based on feature conditions into branches, forming a tree
structure.
Easy to interpret but prone to overfitting.

4. Random Forest

 🔍 Type: Supervised

 🛠 Used for: Classification & Regression

 📘 Details:
Ensemble of decision trees using bagging (bootstrap sampling).
Reduces overfitting and increases accuracy.
E.g., Fraud detection, credit scoring

5. Support Vector Machine (SVM)

 🔍 Type: Supervised
 🛠 Used for: Classification, sometimes regression

 📘 Details:
Finds the optimal hyperplane that separates classes with maximum
margin. Works well in high-dimensional spaces.
E.g., Image classification, bioinformatics

6. K-Nearest Neighbors (KNN)

 🔍 Type: Supervised

 🛠 Used for: Classification & Regression

 📘 Details:
Instance-based learner: predicts based on the closest k training
examples in the feature space.
No model training; lazy learning.
E.g., Recommendation systems, handwritten digit recognition

7. Naive Bayes

 🔍 Type: Supervised

 🛠 Used for: Classification

 📘 Details:
Based on Bayes' Theorem assuming independence between
features.
Very fast and effective for text classification (e.g., spam filtering,
sentiment analysis)

8. K-Means Clustering

 🔍 Type: Unsupervised

 🛠 Used for: Clustering

 📘 Details:
Groups similar data points into k clusters based on distance.
E.g., Customer segmentation, market basket analysis

9. Principal Component Analysis (PCA)

 🔍 Type: Unsupervised
 🛠 Used for: Dimensionality Reduction

 📘 Details:
Transforms data into a lower-dimensional space while retaining most
variance.
Helps improve model speed and avoid multicollinearity.

10. Gradient Boosting (GBM, XGBoost, LightGBM, CatBoost)

 🔍 Type: Supervised

 🛠 Used for: Classification & Regression

 📘 Details:
Boosting algorithms build models sequentially where each new
model tries to correct errors made by the previous.
Highly accurate; used in winning Kaggle competitions.

🧠 Deep Learning Algorithms

11. Artificial Neural Networks (ANN)

 🔍 Type: Supervised

 🛠 Used for: Classification & Regression

 📘 Details:
Inspired by human brain; consists of input, hidden, and output
layers.
Used for general-purpose DL tasks: tabular data, basic image/text
classification.

12. Convolutional Neural Networks (CNN)

 🔍 Type: Supervised

 🛠 Used for: Image classification, object detection

 📘 Details:
Uses convolutional layers to extract spatial features from images.
E.g., Face recognition, medical imaging, self-driving cars

13. Recurrent Neural Networks (RNN)


 🔍 Type: Supervised

 🛠 Used for: Sequential data like text, speech, time series

 📘 Details:
Maintains memory across sequences using hidden states.
Challenges: vanishing gradients, limited context.

14. LSTM (Long Short-Term Memory)

 🔍 Type: Supervised

 🛠 Used for: Time series forecasting, text generation

 📘 Details:
A type of RNN that solves the vanishing gradient issue using gates.
E.g., Stock price prediction, chatbot history

15. Transformer (BERT, GPT, etc.)

 🔍 Type: Supervised (can be fine-tuned), also pre-trained

 🛠 Used for: NLP (translation, summarization, QA)

 📘 Details:
Replaces RNNs with attention mechanisms that allow
parallelization and better long-range understanding.
E.g., BERT for classification, GPT for text generation

16. Autoencoders

 🔍 Type: Unsupervised

 🛠 Used for: Feature learning, anomaly detection

 📘 Details:
Learns to compress and reconstruct data through a bottleneck.
Useful for noise reduction, dimensionality reduction.

17. GANs (Generative Adversarial Networks)

 🔍 Type: Unsupervised / Semi-supervised

 🛠 Used for: Image generation, deepfake, data augmentation


 📘 Details:
Two networks (generator and discriminator) compete to create
realistic data.
Used in art generation, fake images, medical data synthesis.

18. Reinforcement Learning (Q-Learning, DQN, PPO)

 🔍 Type: Reinforcement

 🛠 Used for: Game playing, robotics, recommendation systems

 📘 Details:
Learns optimal actions through rewards and penalties in an
environment.
E.g., AlphaGo, autonomous driving

✅ Summary Table

Algorithm Type Use Case

Linear Regression Supervised Predict sales, price, growth

Logistic Regression Supervised Classification (spam, fraud)

Decision Tree Supervised Rule-based decisions

Random Forest Supervised Accurate predictions

High-dimensional
SVM Supervised
classification

KNN Supervised Pattern recognition

Naive Bayes Supervised Text classification

Unsupervis
K-Means Segmentation
ed

Unsupervis
PCA Dimensionality reduction
ed

Advanced
Gradient Boosting Supervised
classification/regression

ANN Supervised Any ML task

CNN Supervised Vision tasks


Algorithm Type Use Case

RNN / LSTM Supervised Time series, sequences

Transformer Supervised NLP tasks

Unsupervis
Autoencoder Anomaly detection
ed

Unsupervis
GAN Image synthesis
ed

Reinforcement
RL Game agents, robotics
Learning

Here's a detailed breakdown of Data Mining and Data Science


algorithms, covering:

 ✅ Algorithm Name

 🔍 Used For

 🧠 Type (Supervised / Unsupervised / Other)

 📘 Detailed Explanation

📊 PART 1: Data Mining Algorithms

Data mining focuses on discovering patterns, relationships, and


anomalies in large datasets, often using unsupervised or semi-supervised
techniques.

1. Apriori Algorithm

 🔍 Used For: Association rule mining (Market Basket Analysis)

 🧠 Type: Unsupervised

 📘 Explanation:
Finds frequent itemsets in transactional data and derives rules like:
If a person buys bread and butter → they are likely to buy jam.

It uses support, confidence, and lift to measure interestingness of rules.


2. FP-Growth (Frequent Pattern Growth)

 🔍 Used For: Association rule mining

 🧠 Type: Unsupervised

 📘 Explanation:
Faster alternative to Apriori that avoids generating candidate sets.
It builds a compact prefix-tree structure (FP-Tree) to mine frequent
patterns efficiently.

3. K-Means Clustering

 🔍 Used For: Customer segmentation, grouping similar data

 🧠 Type: Unsupervised

 📘 Explanation:
Clusters data into k groups based on Euclidean distance.
Each point belongs to the nearest cluster centroid. Iteratively
updates centroids until convergence.

4. DBSCAN (Density-Based Spatial Clustering of Applications with


Noise)

 🔍 Used For: Clustering with irregular shapes or noisy data

 🧠 Type: Unsupervised

 📘 Explanation:
Groups together closely packed data points.
Can detect outliers and does not require predefined number of
clusters (k). Useful for geospatial or anomaly data.

5. Decision Trees

 🔍 Used For: Classification and regression

 🧠 Type: Supervised

 📘 Explanation:
Splits data into branches using rules based on features (e.g., if age
< 30).
Used in rule discovery in mining tasks.
6. Outlier Detection (Z-score, IQR, LOF)

 🔍 Used For: Anomaly detection, fraud detection

 🧠 Type: Unsupervised / Semi-supervised

 📘 Explanation:
Detects data points significantly different from others.

 Z-score: Based on standard deviation

 IQR: Interquartile range

 LOF (Local Outlier Factor): Uses density-based method

7. Chi-Square Test / Correlation Analysis

 🔍 Used For: Feature selection / pattern discovery

 🧠 Type: Statistical method

 📘 Explanation:
Identifies whether two categorical variables are dependent.
Useful in mining relevant associations or removing redundant
features.

🤖 PART 2: Data Science Algorithms

Data Science combines data mining, statistics, machine learning, and


business understanding.

8. Linear & Logistic Regression

 🔍 Used For: Predicting continuous and binary outcomes

 🧠 Type: Supervised

 📘 Explanation:

 Linear Regression: Predict numeric values (e.g., sales)

 Logistic Regression: Predict probabilities (e.g., 0 or 1)

9. Random Forest

 🔍 Used For: Classification, regression, feature importance

 🧠 Type: Supervised
 📘 Explanation:
Ensemble of decision trees using bagging.
Reduces overfitting and improves accuracy.

10. Support Vector Machines (SVM)

 🔍 Used For: Classification

 🧠 Type: Supervised

 📘 Explanation:
Finds a hyperplane that best separates two classes with maximum
margin.
Can use kernel functions to work in high-dimensional space.

11. Gradient Boosting / XGBoost / LightGBM

 🔍 Used For: Structured data, high-performance


classification/regression

 🧠 Type: Supervised

 📘 Explanation:
Boosting builds models sequentially by correcting errors of previous
ones.
Highly used in Kaggle competitions and production models.

12. Principal Component Analysis (PCA)

 🔍 Used For: Dimensionality reduction

 🧠 Type: Unsupervised

 📘 Explanation:
Transforms data into uncorrelated components while retaining the
most variance.
Reduces complexity and improves visualization or model
performance.

13. KNN (K-Nearest Neighbors)

 🔍 Used For: Pattern recognition, classification

 🧠 Type: Supervised
 📘 Explanation:
Classifies new instances based on the majority class of their k
nearest neighbors.
Very intuitive and simple.

14. LSTM (Long Short-Term Memory)

 🔍 Used For: Time series, sequential data

 🧠 Type: Supervised (Deep Learning)

 📘 Explanation:
A type of RNN designed to remember long-term dependencies.
Used in forecasting, NLP, and speech recognition.

15. Transformers (BERT, GPT)

 🔍 Used For: Natural Language Processing

 🧠 Type: Supervised / Pretrained

 📘 Explanation:
Use attention mechanisms to understand context in sequences.
Outperforms older models like LSTM in text generation,
summarization, question-answering.

🧾 Summary Table

Algorithm Type Used For Domain

Unsupervis
Apriori Association rules Data Mining
ed

Unsupervis Data Mining /


K-Means Clustering
ed DS

Unsupervis
FP-Growth Pattern mining Data Mining
ed

Unsupervis Data Mining /


PCA Dimensionality reduction
ed DS

Decision Tree Supervised Classification / regression Both

Random Forest Supervised High-performance models Data Science


Algorithm Type Used For Domain

SVM Supervised Classification Data Science

KNN Supervised Pattern recognition Data Science

XGBoost Supervised Kaggle-level modeling Data Science

Unsupervis Clustering + Outlier


DBSCAN Data Mining
ed Detection

Unsupervis Anomaly detection, Data Science


Autoencoder
ed compression (DL)

LSTM Supervised Time series, NLP Deep Learning

Transformer
Supervised Advanced NLP Deep Learning
(BERT)

Outlier Unsupervis
Fraud detection Data Mining
Detection ed

✅ Key Differences

Feature Data Mining Data Science

Focus Pattern discovery Predictive modeling + insights

Python, R, Jupyter, PyTorch,


Tools SQL, Weka, RapidMiner, R
Spark

Models, dashboards, automated


Outcome Rules, clusters, anomalies
pipelines

Techniques Association, clustering, Machine learning, deep learning,


used statistics analytics

Here’s a curated list of SQL and Power BI interview questions for


Data Science roles, grouped by difficulty level and with detailed
answers and examples where relevant.

🧩 PART 1: SQL Questions for Data Science

SQL is critical in data science for querying and manipulating structured


data from relational databases.
🔰 Beginner SQL Questions

1. What is the difference between WHERE and HAVING?

Answer:

 WHERE: Used to filter rows before aggregation.

 HAVING: Used to filter groups after aggregation.

🧠 Example:

-- Filter rows

SELECT * FROM orders

WHERE status = 'shipped';

-- Filter aggregated groups

SELECT customer_id, COUNT(*) AS total_orders

FROM orders

GROUP BY customer_id

HAVING COUNT(*) > 5;

2. What are different types of JOINs?

Answer:

 INNER JOIN: Matches rows in both tables

 LEFT JOIN: All rows from left + matched from right

 RIGHT JOIN: All rows from right + matched from left

 FULL JOIN: All rows from both, unmatched filled with NULL

 SELF JOIN: Table joined with itself

3. How do you find duplicate records in a table?

SELECT name, COUNT(*) AS cnt

FROM customers
GROUP BY name

HAVING COUNT(*) > 1;

4. Write a query to find the second highest salary.

SELECT MAX(salary)

FROM employees

WHERE salary < (SELECT MAX(salary) FROM employees);

🧠 Intermediate SQL Questions

5. What is a CTE (Common Table Expression)? Why use it?

Answer:
A CTE is a temporary result set used to simplify complex queries.

🧠 Example:

WITH TopCustomers AS (

SELECT customer_id, SUM(total) AS total_spent

FROM sales

GROUP BY customer_id

SELECT * FROM TopCustomers

WHERE total_spent > 5000;

6. Find customers who placed orders in all months of 2024.

SELECT customer_id

FROM orders

WHERE YEAR(order_date) = 2024

GROUP BY customer_id

HAVING COUNT(DISTINCT MONTH(order_date)) = 12;


7. Explain window functions with an example.

Answer:
Window functions operate on a set of rows related to the current row
(without collapsing them).

🧠 Example: Rank customers by spending:

SELECT customer_id, total,

RANK() OVER (ORDER BY total DESC) AS rank

FROM sales;

🧪 Advanced SQL Questions

8. What’s the difference between RANK(), DENSE_RANK() and


ROW_NUMBER()?

Gaps in
Function Use Case
Ranking

RANK() Yes With gaps in ties

DENSE_RANK( No gaps in tied


No
) ranks

ROW_NUMBER No ties, Sequential


() unique numbering

9. Detect changes in customer address over time.

SELECT customer_id, address,

LAG(address) OVER (PARTITION BY customer_id ORDER BY


updated_at) AS previous_address

FROM customer_address;

10. What is normalization and denormalization?

Answer:

 Normalization: Organize data to reduce redundancy (multiple


related tables).
 Denormalization: Combine tables for faster read access (used in
Power BI for DAX).

📊 PART 2: Power BI Questions for Data Science

🔰 Power BI Beginner Questions

1. What is Power BI?

Answer:
Power BI is a business intelligence tool by Microsoft for:

 Data cleaning (Power Query)

 Data modeling (relationships, DAX)

 Data visualization (dashboards, reports)

2. What is the difference between Power BI Desktop and Power BI


Service?

Service
Feature Desktop
(Cloud)

Data
✅ ❌
modeling

Data refresh Manual Scheduled

Sharing No (unless

reports published)

3. What are Measures vs Calculated Columns in Power BI?

Calculated
Type Measure
Column

Evaluated Row-level, during Aggregated, during


when? load report

Slower for large


Performance Faster
data
Calculated
Type Measure
Column

Profit = Sales - Total Sales =


DAX Example
Cost SUM(Sales)

🧠 Intermediate Power BI Questions

4. How do relationships work in Power BI?

Answer:
Relationships allow combining data from multiple tables using keys. Power
BI supports:

 One-to-many (common)

 Many-to-many (with composite models)

 Active/Inactive relationships

🧠 Example: Fact table (sales) joins with Dimension table (product)

5. Explain DAX and give an example.

Answer:
DAX (Data Analysis Expressions) is the formula language in Power BI,
similar to Excel.

🧠 Example:

TotalSales = SUM(Sales[Amount])

YTD Sales = TOTALYTD([TotalSales], Dates[Date])

6. What is a slicer in Power BI?

Answer:
A slicer is a visual filter used by users to slice the report data by
dimension (e.g., date, region).

7. What is the difference between DirectQuery and Import mode?


Mode Description Performance

Data loaded into Power BI


Import Fast
model

DirectQue Queries data live from Slower, live


ry source updates

🔧 Advanced Power BI Questions

8. How do you handle slow dashboards?

 Remove unnecessary visuals

 Use import instead of DirectQuery if possible

 Reduce cardinality of columns

 Use measures, not calculated columns

 Avoid using too many slicers

9. What is row-level security (RLS)?

Answer:
RLS restricts data access for users based on filters. You define roles in
Power BI Desktop and assign them in Power BI Service.

🧠 Example: A sales manager only sees their region's data.

10. Explain the use of CALCULATE() in DAX.

Answer:
CALCULATE() changes the context in which a measure is evaluated.

🧠 Example:

SalesLastYear = CALCULATE(SUM(Sales[Amount]),
SAMEPERIODLASTYEAR(Date[Date]))

✅ Summary: Tools Comparison

Skill SQL Power BI

Purpose Query & manipulate raw Visualize, model & explore


Skill SQL Power BI

data data

Data engineering, data Business analytics,


Level
wrangling dashboards

Languag
SQL syntax DAX, M language
e

You might also like