Swiggy interview prep
5 practice questions on the topics candidates reported from Swiggy interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
Python 1
-
What does this print?
import pandas as pd df = pd.DataFrame({"city": ["Pune", "Delhi", "Pune", "Delhi", "Pune"], "orders": [10, 4, 6, 8, 2]}) print(df.groupby("city")["orders"].mean().to_dict())- {'Delhi': 6.0, 'Pune': 6.0}
- {'Pune': 18, 'Delhi': 12}
- {'Delhi': 12, 'Pune': 18}
- {'Delhi': 4.0, 'Pune': 10.0}
Show the answer
A. {'Delhi': 6.0, 'Pune': 6.0}
groupby collects the rows per city and mean averages each group: Delhi (4 + 8) / 2 = 6.0 and Pune (10 + 6 + 2) / 3 = 6.0. Groups come out sorted by key. .sum() would give 12 and 18.
This topic is named in a candidate’s interview report: Associate data scientist interview, 2025, on Reddit.
DBMS and SQL 1
-
What does a FULL OUTER JOIN of tables A and B return?
- Only rows that match in both
- Every row from both tables: matched rows joined, and unmatched rows from either side with NULLs for the other side's columns
- Every row from A only
- Every combination of rows from A and B
Show the answer
B. Every row from both tables: matched rows joined, and unmatched rows from either side with NULLs for the other side's columns
INNER keeps matches only, LEFT adds unmatched A rows, RIGHT adds unmatched B rows, FULL adds both. Every combination is a CROSS JOIN. MySQL has no FULL OUTER JOIN and emulates it with a LEFT JOIN UNION a RIGHT JOIN.
This topic is named in a candidate’s interview report: Associate data scientist interview, 2025, on Reddit.
Machine learning 3
-
A classifier has 40 true positives, 10 false positives, 20 false negatives and 30 true negatives. What is its precision?
- 0.67
- 0.80
- 0.70
- 0.57
Show the answer
B. 0.80
Precision is TP / (TP + FP): of everything predicted positive, the share that really was. 40 / (40 + 10) = 0.80.
This topic is named in a candidate’s interview report: Associate data scientist interview, 2025, on Reddit.
-
Same classifier: 40 true positives, 10 false positives, 20 false negatives, 30 true negatives. What is its recall?
- 0.67
- 0.80
- 0.70
- 0.75
Show the answer
A. 0.67
Recall is TP / (TP + FN): of all the real positives, the share the model found. 40 / (40 + 20) = 0.67.
This topic is named in a candidate’s interview report: Associate data scientist interview, 2025, on Reddit.
-
How does a random forest differ from a gradient-boosted model such as LightGBM?
- A random forest averages many independent deep trees built on random samples (bagging); boosting builds shallow trees one after another, each fitting the errors of those before
- A random forest uses a single tree
- LightGBM cannot use decision trees
- They are the same algorithm
Show the answer
A. A random forest averages many independent deep trees built on random samples (bagging); boosting builds shallow trees one after another, each fitting the errors of those before
Bagging mainly reduces variance and is hard to overfit; boosting reduces bias and is often more accurate on tabular data but needs tuning, such as the learning rate and early stopping.
This topic is named in a candidate’s interview report: Associate data scientist interview, 2025, on Reddit.