Interview Questions
Python
1. What is the difference between a Python list and a tuple? When would you use one over the other?
2. Explain the concept of mutability vs. immutability in Python. Give an example of one mutable data type and
one immutable data type.
3. What are Python sets? What is a key advantage of using a set over a list for checking if an item exists in a
collection?
4. What is the purpose of the __init__ method in a Python class? What does the self keyword represent?
5. How do you handle errors in Python? Briefly explain the purpose of a try...except...finally block.
6. What is a Python decorator? Can you give a simple conceptual example of what it's used for (e.g., timing a
function)?
7. What is the Global Interpreter Lock (GIL) in Python? How does it affect the execution of multi-threaded
code?
8. How would you merge two Pandas DataFrames? Briefly explain the difference between an inner join and a
left join.
9. What is broadcasting in NumPy? Why is it useful?
10. What is the difference between a shallow copy and a deep copy of a Python object? Why does this
distinction matter, especially for nested lists or dictionaries?
Machine Learning
1. Despite its name, Logistic Regression is used for classification. Why is this? Can you explain how it works at a
high level (e.g., using the sigmoid function)?
2. What is the "naive" assumption in the Naive Bayes algorithm? What is one advantage of this algorithm, even
with this assumption?
3. Explain the core idea of a Support Vector Machine (SVM). What is the role of a "kernel" (like the RBF kernel)?
4. Describe the Precision-Recall tradeoff. Give a real-world example of a scenario where you would want to
optimize for high precision, even at the cost of recall.
5. What is an ROC Curve, and what does the AUC (Area Under the Curve) score represent? What would an AUC
score of 0.5 tell you about your model?
6. You are given a dataset with 20% of the values missing in a specific column. What are three different
methods you could use to handle these missing data?
7. What is the difference between Label Encoding and One-Hot Encoding? When would you absolutely need to
use One-Hot Encoding over Label Encoding?
8. What is dimensionality reduction, and why would you use it? Briefly explain the main idea behind Principal
Component Analysis (PCA).
9. Explain the difference between bagging and boosting, which are two types of ensemble methods. Name one
algorithm that is an example of each.
10. How would you explain the K-Nearest Neighbors (KNN) algorithm to someone non-technical? What is one
major disadvantage of using KNN, especially with large datasets?
Deep Learning
1. What is the main difference between a Convolutional Neural Network (CNN) and a Recurrent Neural Network
(RNN)? What type of data is each one best suited for?
2. Explain the purpose of a pooling layer (like Max Pooling) in a CNN. What are two main benefits it provides?
3. What is the vanishing gradient problem? Name one activation function that helps solve it (like ReLU) and one
type of network cell designed for it (like LSTM).
4. What is transfer learning? Briefly describe the process of fine-tuning a pre-trained model (like VGG16 or
ResNet) for a new, specific task.
5. What is the difference between a loss function (e.g., Binary Cross-Entropy) and an optimizer (e.g., Adam)?
How do they work together during training?
6. Explain dropout as a regularization technique. How does it help prevent overfitting, and does it behave
differently during training versus testing?
7. What is the purpose of Batch Normalization? Where is it typically placed in a neural network layer?
8. Why can't we just use a linear activation function (or no activation function at all) in all the hidden layers of a
deep neural network?
9. What is the difference between an autoencoder and a model like a CNN used for classification? What is a
primary use case for an autoencoder?
10. At a high level, what is the key innovation of the Transformer architecture (used in models like BERT and GPT)
that improved upon LSTMs for sequence tasks?
Natural Language Processing
1. What is the difference between stemming and lemmatization? Which one is generally preferred if you need
linguistically correct words?
2. Explain TF-IDF (Term Frequency-Inverse Document Frequency). Why is the "Inverse Document Frequency"
part important for finding relevant words?
3. What are stop words? Give an example of a task where you would remove them, and an example of a task
where you must keep them.
4. What is tokenization? Explain the difference between word tokenization and sentence tokenization.
5. What are word embeddings (like Word2Vec or GloVe)? What key problem do they solve that Bag-of-Words
and One-Hot Encoding do not?
6. What is Named Entity Recognition (NER)? Give three examples of the types of entities it might be trained to
find in a text.
7. What are n-grams? How can a bi-gram model (n=2) help capture context that a uni-gram (n=1) model would
miss, especially for phrases like "not good"?
8. At a high level, what is Topic Modeling? What is the main goal of an algorithm like Latent Dirichlet Allocation
(LDA)?
9. Describe a typical text preprocessing pipeline. What are 4-5 steps you would take to clean raw text before
feeding it to a machine learning model?
10. What is the main idea behind the self-attention mechanism in a Transformer (like BERT)? What advantage
does this give it over older models like LSTMs for understanding long sentences?