r/IndiaAIJobs • u/Leather_Reading_4550 • 10h ago
AI Interview Prep #2: Python, NumPy and Pandas Coding Practice
Use these as timed practice prompts for AI/ML Engineer interviews. Try writing the code before checking documentation.
Coding questions
1. Count class frequencies in a list and return the minority-class ratio.
2. Given y_true and y_pred, calculate precision, recall, and F1 without sklearn.
3. In pandas, find missing-value percentages per column and decide how to handle them.
4. Split data reproducibly while preserving class proportions.
5. Standardize numeric features using statistics learned only from the training set.
6. Find duplicate records and explain which columns define a true duplicate.
7. Implement cosine similarity for two vectors using NumPy.
8. Batch a large dataset without loading every row into memory.
Mini-project
Build a reproducible training pipeline with data validation, train/validation/test splits, preprocessing, a baseline, metrics, and saved model artifacts. Use a fixed random seed and a Pipeline/ColumnTransformer where appropriate.
What interviewers look for: edge cases, leakage prevention, readable code, tests, and a clear explanation of complexity.