1. What are Python’s main features?
Python is simple, readable, and versatile. It supports multiple paradigms (OOP, functional,
procedural), has a huge standard library, and works cross-platform.
2. How is Python different from other programming languages?
Python focuses on readability and minimal syntax, unlike Java/C++ which require more
boilerplate. It’s interpreted, dynamically typed, and has vast community support.
3. What are Python’s data types?
Basic types include int, float, complex, str, bool, and NoneType. Collections include
list, tuple, set, dict.
4. Explain mutable and immutable types in Python.
Mutable types (e.g., list, dict, set) can be changed after creation. Immutable types (e.g., str,
tuple, int) cannot be altered; any change creates a new object.
5. What is the difference between a list and a tuple?
Lists are mutable, can change size, and use more memory. Tuples are immutable, faster,
and often used for fixed data.
6. How are sets different from lists in Python?
Sets store unique, unordered elements with no duplicates, and support mathematical set
operations. Lists can store duplicates and maintain order.
7. What are Python dictionaries?
Dictionaries store data as key-value pairs, allowing fast lookups using keys. Keys must be
immutable types.
8. How do you create and use functions in Python?
Functions are defined with def, take parameters, and may return values. Example:
python
CopyEdit
def add(a, b): return a + b
**9. What is the difference between *args and kwargs?
*args passes a variable number of positional arguments as a tuple. **kwargs passes
keyword arguments as a dictionary.
10. What is Python’s scope resolution (LEGB rule)?
Python searches variables in this order: Local → Enclosing → Global → Built-in.
11. What are Python modules and packages?
A module is a single .py file with Python code. A package is a folder of modules with an
__init__.py file.
12. How does Python manage memory?
It uses automatic garbage collection with reference counting and a cyclic garbage collector
to free unused objects.
13. What are Python decorators?
Decorators are functions that modify other functions’ behavior without changing their code,
often using @decorator_name.
14. Explain Python generators and yield keyword.
Generators are functions that return values one at a time using yield, saving memory and
allowing lazy evaluation.
15. What is the difference between deep copy and shallow copy?
Shallow copy copies only the outer object, keeping references to inner objects. Deep copy
duplicates everything recursively.
16. How does Python handle exceptions?
It uses try-except blocks to catch errors, preventing crashes. Optional finally runs
cleanup code.
17. What are Python’s built-in data structures?
They include list, tuple, set, dict, str, and frozenset.
18. Explain Python’s with statement and context managers.
The with statement ensures resources (like files) are properly opened and closed
automatically using context managers.
19. What is list comprehension? Give an example.
A compact way to create lists in one line. Example: [x*x for x in range(5)] → [0,
1, 4, 9, 16].
20. What is lambda in Python?
An anonymous, one-line function using the syntax: lambda args: expression.
21. Difference between is and == in Python?
== checks if values are equal. is checks if two references point to the same object in
memory.
22. Explain Python’s pass, break, and continue statements.
pass does nothing (placeholder). break exits a loop. continue skips the current iteration
and moves to the next.
23. What is the difference between Python 2 and Python 3?
Python 3 uses Unicode strings by default, has print as a function, and improved division
behavior. Python 2 is now outdated.
24. What is PEP 8 and why is it important?
PEP 8 is Python’s style guide for writing clean, readable, and consistent code.
25. How do you manage packages in Python?
You use pip to install, upgrade, or remove packages from the Python Package Index
(PyPI).
26. What is Artificial Intelligence (AI)?
AI is the ability of a machine or computer program to think, learn, and make decisions like a
human.
27. Difference between AI and Machine Learning?
AI is the overall field of making machines smart. ML is a subset of AI where machines learn
from data without being explicitly programmed.
28. What are the main types of AI?
● Narrow AI (specific tasks)
● General AI (human-like intelligence)
● Super AI (beyond human intelligence — still theoretical)
29. What is the Turing Test?
A test to check if a machine’s responses are indistinguishable from a human’s.
30. What is Natural Language Processing (NLP)?
NLP is the AI branch that allows computers to understand and work with human languages
like English or Hindi.
31. What is Computer Vision?
It’s AI that enables machines to “see” and understand images or videos.
32. What is Expert System in AI?
An AI program that uses rules and knowledge to give advice or make decisions, like a
virtual doctor.
33. What is Knowledge Representation?
The way AI stores and organizes facts so it can reason and solve problems.
34. What is an AI Agent?
An AI entity that perceives its environment and takes actions to achieve goals.
35. What is Reinforcement Learning in AI?
A learning method where an agent learns by getting rewards or penalties for actions.
36. What are Chatbots?
AI programs that can simulate conversation with users, like customer support bots.
37. What is Search Algorithm in AI?
A method used by AI to find a solution from all possible options, like pathfinding in Google
Maps.
38. What is Heuristic in AI?
A shortcut or rule of thumb that helps AI find solutions faster.
39. What is Fuzzy Logic?
An AI approach that deals with uncertain or vague information, like “temperature is warm.”
40. What are some real-life applications of AI?
Voice assistants, recommendation systems, self-driving cars, face recognition, etc.
Machine Learning Basics (41–65)
41. What is Machine Learning (ML)?
ML is when computers learn patterns from data and improve without being explicitly
programmed.
42. Types of ML?
● Supervised Learning (learn from labeled data)
● Unsupervised Learning (find patterns in unlabeled data)
● Reinforcement Learning (learn from rewards & penalties)
43. What is Supervised Learning?
A type of ML where the model learns from input-output pairs, like predicting house prices.
44. What is Unsupervised Learning?
ML where the system groups or finds patterns without knowing the answers, like customer
segmentation.
45. What is Reinforcement Learning?
Learning by trial and error with rewards for correct actions.
46. What is a Dataset?
A collection of data used for training and testing ML models.
47. What is Feature in ML?
A measurable property of data, like height, weight, or color.
48. What is Label in ML?
The output we want to predict, like “spam” or “not spam.”
49. What is Training Data?
Data used to teach the ML model.
50. What is Testing Data?
Data used to check if the ML model works correctly.
51. What is Model in ML?
A mathematical representation of the problem learned from data.
52. What is Overfitting?
When the model learns the training data too well, including noise, and performs badly on
new data.
53. What is Underfitting?
When the model is too simple and fails to capture patterns in data.
54. What is Cross-Validation?
A method to test the model on multiple subsets of data for better accuracy.
55. What is Bias in ML?
Error from wrong assumptions in the model, making it inaccurate.
56. What is Variance in ML?
Error from too much sensitivity to training data, causing overfitting.
57. What is the Bias-Variance Tradeoff?
Balancing bias and variance to make the model generalize well.
58. What is a Confusion Matrix?
A table that shows how well a classification model performs using True/False
positives/negatives.
59. What is Accuracy in ML?
The percentage of correct predictions made by the model.
60. What is Precision and Recall?
● Precision = Correct positive predictions / All positive predictions
● Recall = Correct positive predictions / All actual positives
61. What is F1 Score?
The harmonic mean of precision and recall — balances both metrics.
62. What is a Neural Network?
A model inspired by the human brain, made of layers of nodes (neurons).
63. What is Deep Learning?
A type of ML using neural networks with many layers for complex tasks like image
recognition.
64. What are some ML algorithms?
Linear Regression, Decision Trees, Random Forest, SVM, KNN, Naive Bayes, Neural
Networks.
65. Real-life applications of ML?
Email spam filters, product recommendations, fraud detection, medical diagnosis, speech
recognition.
1. Linear Regression
Linear Regression is a supervised learning algorithm used for predicting a continuous value.
It tries to find the best-fitting straight line through data points by minimizing the difference
between actual and predicted values (called error). It works well when there’s a linear
relationship between the input features (X) and the target (Y), like predicting house prices
based on size.
2. Logistic Regression
Logistic Regression is used for binary classification problems (Yes/No, 0/1). Instead of
predicting a number directly, it predicts the probability that something belongs to a certain
class using the sigmoid function. For example, predicting if an email is spam or not.
3. Decision Tree
A Decision Tree splits the dataset into branches based on conditions, like a flowchart. Each
node asks a question (feature-based condition), and the data flows down the branches until
it reaches a decision (leaf node). It’s easy to understand but can overfit the training data if
not controlled.
4. Random Forest
Random Forest is an ensemble of many decision trees. Each tree is trained on a random
subset of the data and features, and the final prediction is made by averaging (for
regression) or taking a majority vote (for classification) from all trees. This reduces overfitting
and improves accuracy compared to a single decision tree.
5. Support Vector Machine (SVM)
SVM tries to find the best boundary (hyperplane) that separates different classes in the
dataset. It works well in high-dimensional data and can also handle non-linear classification
using a technique called the kernel trick. For example, separating cancerous vs.
non-cancerous cell data.
6. K-Nearest Neighbors (KNN)
KNN is a simple algorithm that classifies a new data point based on the majority class
among its ‘K’ closest points in the training data. Distance is usually measured using
Euclidean distance. It works well for small datasets but is slow for large datasets.
7. Naive Bayes
Naive Bayes is a probabilistic algorithm based on Bayes’ Theorem. It assumes that features
are independent (which is rarely true in real life, but works surprisingly well). It’s commonly
used in spam filtering, sentiment analysis, and text classification.
8. K-Means Clustering
K-Means is an unsupervised learning algorithm that groups similar data points into ‘K’
clusters. It works by assigning points to the nearest cluster center (centroid) and then
updating the centroids until they stop changing. For example, grouping customers into
different market segments.
9. Hierarchical Clustering
This is another unsupervised algorithm that builds a tree-like hierarchy of clusters. It starts
with each point as its own cluster and merges the closest pairs until only one cluster remains
(agglomerative method). Useful for visualizing relationships in data.
10. Principal Component Analysis (PCA)
PCA is a dimensionality reduction technique that transforms data into fewer dimensions
while preserving as much information as possible. It’s used to simplify datasets, remove
noise, and speed up machine learning models.
11. Gradient Boosting
Gradient Boosting builds an ensemble of weak learners (usually decision trees) sequentially,
with each new tree correcting the errors of the previous ones. This results in a powerful
predictive model but can be slow to train.
12. XGBoost / LightGBM / CatBoost
These are optimized versions of gradient boosting algorithms. They are faster, more
memory-efficient, and handle missing values better. They’re popular in Kaggle competitions
and real-world projects due to high accuracy.
13. Artificial Neural Networks (ANN)
ANNs are inspired by the human brain and consist of layers of interconnected “neurons” that
process information. They’re used for complex tasks like image recognition, speech
processing, and natural language understanding.
14. Convolutional Neural Networks (CNN)
CNNs are specialized for image and video processing. They use convolutional layers to
detect patterns like edges, shapes, and textures. They power applications like face
recognition, medical imaging, and self-driving cars.
15. Recurrent Neural Networks (RNN) & LSTMs
RNNs are designed for sequence data, such as text, time series, and speech. They can
remember past inputs to make better predictions. LSTMs (Long Short-Term Memory) are a
type of RNN that overcome the problem of forgetting long-term dependencies.
1. NLP (Natural Language Processing)
NLP is the branch of AI that helps computers understand, interpret, and generate human
language. It bridges the gap between how humans communicate (natural language) and
how machines understand data (structured data).
Key Concepts in NLP
1. Tokenization – Splitting text into smaller units like words or sentences. Example: “I
love AI” → [I], [love], [AI].
2. Stopwords Removal – Removing common words (like "the", "is", "and") that don’t
add much meaning.
3. Stemming and Lemmatization – Reducing words to their root form.
○ Stemming: playing → play (cuts without grammar check)
○ Lemmatization: better → good (grammar-aware)
4. Bag of Words (BoW) – Representing text as word counts in a document.
5. TF-IDF (Term Frequency–Inverse Document Frequency) – Gives importance to
words based on how rare they are in the dataset.
6. Word Embeddings – Representing words as vectors so machines understand
meaning and similarity (Word2Vec, GloVe, FastText).
7. Language Models – Predict the next word in a sequence (e.g., GPT models, BERT).
8. Named Entity Recognition (NER) – Identifying specific entities like names, dates,
locations in text.
9. Sentiment Analysis – Determining the sentiment behind a text (positive, negative,
neutral).
10.Machine Translation – Translating one language to another (Google Translate).
Common Uses of NLP:
● Chatbots (like me 😄)
● Voice assistants (Siri, Alexa)
● Spam detection
● Search engines
● Text summarization
2. Deep Learning
Deep Learning is a subset of Machine Learning inspired by how the human brain works. It
uses artificial neural networks with multiple layers (deep architectures) to learn complex
patterns in data.
Key Concepts in Deep Learning
1. Neural Networks – The core structure made up of:
○ Input Layer – Takes data.
○ Hidden Layers – Extract patterns and features.
○ Output Layer – Produces final predictions.
2. Activation Functions – Decide whether a neuron should “fire” or not. Examples:
ReLU, Sigmoid, Tanh.
3. Backpropagation – The process of adjusting weights in the network to reduce error.
4. Gradient Descent – Optimization algorithm to find the best model parameters.
5. Overfitting & Underfitting –
○ Overfitting: Model memorizes training data but fails on new data.
○ Underfitting: Model fails to capture patterns.
6. Convolutional Neural Networks (CNNs) – Mainly used for images (feature
extraction using filters).
7. Recurrent Neural Networks (RNNs) – For sequential data like text and time-series.
○ LSTM (Long Short-Term Memory) – Solves short-term memory problem in
RNNs.
8. Transformers – Modern architectures for NLP (e.g., BERT, GPT) that use attention
mechanisms to focus on important parts of data.
9. Dropout – A regularization method to prevent overfitting by randomly “dropping”
neurons during training.
10.Batch Normalization – Speeds up training and improves stability by normalizing
layer inputs.
Common Uses of Deep Learning:
● Image recognition (Face ID, medical scans)
● Speech recognition (voice assistants)
● Autonomous driving
● NLP tasks (translation, summarization, chatbots)
● Video analysis
AI Agents – Explained Simply
In Artificial Intelligence, an agent is anything that can perceive its environment, process
the information, and take actions to achieve certain goals.
Think of it like a person — you see, think, and act.
In AI, the “seeing” is done by sensors, the “thinking” by algorithms, and the “acting” by
actuators.
1. Basic Structure of an AI Agent
● Sensors → Collect data from the environment (e.g., camera, microphone, GPS).
● Processor/Brain → Uses AI models, rules, or logic to decide what to do.
● Actuators → Carry out actions (e.g., robot arms moving, chatbot sending replies).
● Environment → The world or system where the agent operates.
Example:
● In a self-driving car:
○ Sensors: Cameras, LIDAR, GPS.
○ Processor: AI algorithms that detect lanes, objects, and decide
speed/direction.
○ Actuators: Steering, brakes, accelerator.
○ Environment: The road and traffic around it.
2. Types of AI Agents
a) Simple Reflex Agents
● Work on if-then rules.
● React directly to the environment without storing history.
● Example: A thermostat — if temperature < 20°C → turn heater on.
b) Model-Based Reflex Agents
● Keep an internal model of the world.
● Can work even if some information is missing.
● Example: A chess AI remembers the board state even if you don’t tell it every move
again.
c) Goal-Based Agents
● Don’t just react — they plan actions to achieve a goal.
● Example: GPS navigation — plans a route from your current location to your
destination.
d) Utility-Based Agents
● Choose actions based on happiness score (utility).
● Pick the action that gives the best result for the situation.
● Example: Movie recommendation system chooses movies you’re most likely to enjoy.
e) Learning Agents
● Improve over time by learning from past experiences.
● Example: Spam filter — learns to block new spam patterns without being told.
3. Where We Use AI Agents
● Robotics → Robots in factories, home assistants like Roomba.
● Virtual Assistants → Alexa, Siri, Google Assistant.
● Gaming AI → Enemies that adapt to your playing style.
● Healthcare → AI bots for medical diagnosis and patient monitoring.
● Finance → Stock market trading bots.
● Customer Support → Chatbots that understand and respond naturally.
4. Why AI Agents Are Powerful
● They sense, think, and act in a continuous loop.
● Can operate in real-time and make fast decisions.
● They adapt and improve with machine learning.
● Can handle environments that are complex and unpredictable.
1. CodeBuddy – AI Coding Tutor
Description:
An AI-powered tutor that helps users learn coding by breaking down concepts in real-time,
creating visual diagrams, and even generating relevant images for better understanding.
Tech Stack & How You Used Them:
● Python → Core backend logic, API integrations, and data handling.
● Google Gemini → AI model for explaining code concepts and answering questions.
● MermaidJS → Generated flowcharts and diagrams for visual learning.
● Pexels API → Fetched AI-relevant images for topics.
● Streamlit → Created an interactive web UI for real-time use.
● Session Memory → Remembered previous interactions for continuity.
● One-click PDF Export → Enabled learners to save study materials.
Possible Interview Questions & Answers:
1. Q: How does CodeBuddy generate diagrams automatically?
A: I used MermaidJS to convert AI-generated diagram descriptions into visuals,
integrated with Streamlit for real-time rendering.
2. Q: How did you integrate Google Gemini with Streamlit?
A: Through REST API calls, I sent user queries to Gemini, processed the response,
and displayed them in the Streamlit frontend.
3. Q: How did you ensure the AI explanations were accurate?
A: By validating Gemini’s output using pre-defined test prompts and refining the
prompts to get contextually correct answers.
2. DocuBotX – Multi-PDF QA Bot
Description:
An AI bot that can answer user questions based on the content of multiple uploaded PDFs,
using vector embeddings and semantic search.
Tech Stack & How You Used Them:
● Python → Orchestrated file processing and AI logic.
● LangChain → Managed the LLM pipeline and document parsing.
● HuggingFace → Used pretrained models for embeddings.
● FAISS → Stored and searched vector embeddings for relevant content.
● Streamlit → Interactive UI for PDF uploads and question answering.
Possible Interview Questions & Answers:
1. Q: How does the bot find relevant answers in multiple PDFs?
A: The PDFs are split into text chunks, converted into embeddings using
HuggingFace models, and stored in FAISS. User queries are embedded the same
way and matched via semantic search.
2. Q: Why use FAISS instead of a normal database?
A: FAISS is optimized for vector similarity search, making it much faster for
retrieving semantically similar text compared to keyword search.
3. Q: How do you handle large PDFs?
A: By chunking text into smaller sections with overlap to preserve context.
3. IntelliCode – DebugAssist AI
Description:
An AI assistant for debugging code with semantic analysis and multi-language support.
Tech Stack & How You Used Them:
● Python → Backend logic and model orchestration.
● Tree-Sitter → Parsed code into Abstract Syntax Trees (AST) for structural analysis.
● HuggingFace → Integrated AI models for code understanding and suggestions.
● LangChain → Connected AI reasoning steps and retrieval.
● Streamlit → Built the user interface with dynamic component loading.
Possible Interview Questions & Answers:
1. Q: How does IntelliCode understand code logic?
A: By parsing source code into an AST using Tree-Sitter, which allows semantic
analysis before sending structured queries to the AI model.
2. Q: How do you support multiple programming languages?
A: Tree-Sitter provides parsers for multiple languages, so I just switch grammar
settings based on the file type.
3. Q: What’s the role of LangChain here?
A: LangChain orchestrates the flow between code parsing, retrieval of related
examples, and AI-generated debugging suggestions.