Analytics Interview Questions
In this series we will try to solve as many questions as possible in 4 areas, SQL, Python, Machine Learning Algorithms, and Miscellaneous. All you need to do is to comment your answers below and the best answer will get an extra e-book for free 😛
You need to attempt these questions, put everything in one comment, we will evaluate and will announce the winner in the next day’s post

Analytics Interview Questions
We will follow the below pattern:
– SQL (3 Questions)
– Python (2 Questions)
– Case Study (1 Question)
– Machine Learning and Statistics (2 Questions)
SQL
1) There are two tables X and Y, X has a column A that contains 4 rows -1,-1,-1,-1. Y has a column B that contains -1,-1,-1 (Most asked interview question)
How many rows will be there if we do X left join Y
Given:
- Table X has column A with values (-1, -1, -1, -1) → 4 rows
- Table Y has column B with values (-1, -1, -1) → 3 rows
When we perform LEFT JOIN (X LEFT JOIN Y ON X.A = Y.B):
- Each -1 in X.A will match with all -1s in Y.B (3 matches per row).
- Since there are 4 rows in X, and each matches 3 rows in Y, we get 4 × 3 = 12 rows in the output.
2) What is the use of partition in a table?
Partitioning is used to divide a large table into smaller, manageable sections based on specific criteria (e.g., date, region).
Benefits of Partitioning:
- Improves query performance by scanning only relevant partitions.
- Enhances data management by allowing partition-wise operations.
- Speeds up deletion as old partitions can be dropped instead of row-wise deletion.
Example:
A sales table partitioned by year (sales_2023, sales_2024) allows queries to run faster for a specific year.
3) What is the difference between the Drop and Delete table? (Meesho, OYO rooms)
- DROP TABLE: Removes the entire table structure and data permanently. Cannot be rolled back.
- DELETE FROM TABLE: Removes only the records but keeps the table structure. Can be rolled back if inside a transaction.
Example:
DROP TABLE employees;Â -- Deletes table completely
DELETE FROM employees WHERE department = 'HR'; -- Deletes only HR employees
🚀 Master MySQL Interviews! Get expert answers to all MySQL interview questions in one power-packed eBook. – 550 SQL Interview Questions to crack Any Analytics Interview.
Python
1) What is a mutable and immutable data type? (Most Asked Questions)
- Mutable Data Types: Can be modified after creation (e.g., lists, dictionaries, sets).
- Immutable Data Types: Cannot be modified after creation (e.g., strings, tuples, integers).
Example:
# Mutable List
lst = [1, 2, 3]
lst[0] = 10Â # Allowed
# Immutable String
s = "hello"
s[0] = "H"Â # Error: Strings cannot be changed
2) How do you read a CSV file in Python?
import pandas as pd
df = pd.read_csv("data.csv")
print(df.head())Â # Displays first 5 rows
3) What is the syntax of group by in Python ?
import pandas as pd
df = pd.DataFrame({
    'Category': ['A', 'B', 'A', 'B'],
    'Sales': [100, 200, 150, 250]
})
grouped = df.groupby('Category').sum()
print(grouped)
🚀 Become a Full Stack Analytics Pro! Get the ultimate guide to mastering analytics and landing your dream job. Grab your copy now! -> 2200 Most Asked Analytics Interview Questions
Case Study
1) For a particular e-commerce company, there has been a decline in the number and value of items stored in the cart. Tell all the possible reasons for this decline?
- Increased Pricing: Customers may abandon carts due to higher product or shipping costs.
- Website Performance Issues: Slow page loads or crashes can discourage users.
- Complex Checkout Process: Lengthy forms or too many steps can lead to drop-offs.
- Limited Payment Options: Lack of preferred payment methods may reduce conversions.
- Discount Expiry: Users may have added products expecting a discount that expired.
- Better Competitor Pricing: Customers may compare prices and buy from competitors.
🚀 Basic, you can practice a lot of case studies and other statistics topics here –
https://thedatamonk.com/data-science-resources/
Machine Learning Concepts
1) What is the p-value? Explain in a very layman term with simple example
- The p-value tells us how likely we got our results by random chance.
- If p-value < 0.05, results are significant (not due to chance).
Example:
- Suppose we test a new diet pill.
- If the p-value = 0.02, it means there’s a 2% chance the results are random.
- Since 2% is less than 5%, we conclude the pill works.
2) What is correlation? Explain with simple example
- Correlation measures how strongly two variables move together.
- Positive Correlation: When one increases, the other increases (e.g., height vs weight).
- Negative Correlation: When one increases, the other decreases (e.g., price vs demand).
- No Correlation: No relationship between them.
Example:
- More hours of study → Higher exam scores (Positive Correlation).
- More ice cream sales → More people at the beach (Positive Correlation).
- More gym workouts → Lower body fat (Negative Correlation).
🚀 Crack Any ML Interview! Get 1,200 Machine Learning Interview Questions in one ultimate eBook. Boost your confidence and ace your next interview! – Machine Learning 1200 Interview Questions
🚀 Get The Data Monk 23 eBook Bundle covering everything from ML to SQL. Your all-in-one prep for cracking any interview! -> The Data Monk 23 e-book bundle 📚
The Data Monk services
We are well known for our interview books and have 70+ e-book across Amazon and The Data Monk e-shop page . Following are best-seller combo packs and services that we are providing as of now
- YouTube channel covering all the interview-related important topics in SQL, Python, MS Excel, Machine Learning Algorithm, Statistics, and Direct Interview Questions
Link – The Data Monk Youtube Channel - Website – ~2000 completed solved Interview questions in SQL, Python, ML, and Case Study
Link – The Data Monk website - E-book shop – We have 70+ e-books available on our website and 3 bundles covering 2000+ solved interview questions. Do check it out
Link – The Data E-shop Page - Instagram Page – It covers only Most asked Questions and concepts (100+ posts). We have 100+ most asked interview topics explained in simple terms
Link – The Data Monk Instagram page - Mock Interviews/Career Guidance/Mentorship/Resume Making
Book a slot on Top Mate
For any information related to courses or e-books, please send an email to [email protected]
Comments ( 2 )
SQL
1. 12 rows
2. Partition is used in window functions, for doing aggregation or operations in a particular window. For example, rank() over(partition by customer) would organize the data customer wise and the rank operation will work customer window-wise.
3. delete is used for manipulating data within a table whereas drop is used to delete an entire table from the schema.
Python
1. Mutable datatype is one in which the elements can be changed and immutable is one in which the elements or the structure cannot be changed. For example, a list is mutable – you can append, extend or pop elements in it. A tuple is immutable – you cannot make any changes to it.
2. import pandas as pd
file = pd.read_csv(‘file_name.csv’)
3. for example, df is the name of the dataframe and col is the column by which we need to group our data.
df.groupby(col).sum()
Case Study
Some clarification questions-
1. What category do these items belong to? General or a particular category only?
2. Were there any changes made (in the UI or otherwise) on the platform?
3. What is the magnitude and timeline of the decline?
4. Items stored in the cart – Does this mean that checkout has increased? Or they do not checkout at all?
Reasons-
1. External – A competitor has these items in a better price or quality, hence users are switching to them. Another possible reason is that the general demand of those items (if they are of a particular category), is dropping.
2. Internal – Our delivery time. item price and quality are not upto the customers’ expectations.
3. Internal – The path to checkout, till adding items to the cart, is not too clear to customers. Some UI related issue.
Machine Learning Concepts
2. Correlation, simply explained, shows the strength and direction of the relation between two numerical variables. For example, if the correlation between number of hours studied and marks scored is 0.8, it means that the more hours studied. more will be the marks scored (positive correlation).
Very nice attempt Raahul 🙂