Skip to content

Machine Learning Interview Questions in Gurgaon

36 practice questions with answers for Machine Learning interviews in Gurgaon.

Machine Learning jobs in Gurgaon

Gurgaon (Gurugram) is home to many multinational, consulting, fintech and consumer-internet offices. Interviews often expect strong business understanding along with technical skills, especially for analytics and product-facing roles.

Below are 36 questions that match the mix of service, product and domain employers hiring machine learning engineers in Gurgaon.

Solved for GurgaonStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

The fraud team can only review 500 alerts a day. How do you set the threshold?

Save to ▾
Show answer
Instead of 0.5, rank transactions by predicted probability and pick the threshold that yields about 500 alerts per day on recent data. Then report precision and recall at that cut-off, or precision at k. I would monitor daily alert volume because drift can change it, and recompute the threshold periodically. If cost data exists, I would choose the threshold that maximises expected savings.
02

Use statsmodels to get p-values for regression coefficients.

Save to ▾
Show answer
import statsmodels.api as sm Xc = sm.add_constant(X_train) ols = sm.OLS(y_train, Xc).fit() print(ols.summary()) The summary shows coefficients, standard errors, p-values, confidence intervals, R-squared and diagnostics. scikit-learn focuses on prediction and does not report p-values, so statsmodels is preferred for inference.
03

What is the bias-variance trade-off?

Save to ▾
Show answer
Bias is error from overly simple assumptions, which causes underfitting. Variance is error from sensitivity to the particular training sample, which causes overfitting. Increasing model complexity usually lowers bias but raises variance. The goal is the complexity that minimises total test error. For example, a linear model on curved data has high bias, while a very deep unpruned tree has high variance.
04

What is Naive Bayes and why is it called naive?

Save to ▾
Show answer
Naive Bayes applies Bayes' theorem to compute the probability of each class given the features, assuming features are conditionally independent given the class. That independence assumption is rarely true, hence 'naive', but the model still works well for text classification like spam detection. Variants include Gaussian, Multinomial for word counts and Bernoulli for binary features. It is fast and needs little data.
05

What is the difference between a generative and a discriminative model?

Save to ▾
Show answer
A discriminative model learns the decision boundary or P(y|x) directly, such as logistic regression or SVM. A generative model learns how data is produced, P(x|y) and P(y), and can generate new samples, such as Naive Bayes or Gaussian mixture models. Discriminative models usually give better accuracy with enough data, while generative models handle missing data and small samples better.
06

How do you make an ML experiment reproducible?

Save to ▾
Show answer
Fix random seeds in NumPy, Python and the model, pin library versions in requirements.txt, version the data or record its hash, and save the exact code commit and hyperparameters. Tools like MLflow log parameters, metrics and artifacts per run. Use pipelines so preprocessing is identical each time, and keep the train-test split stored rather than recreated randomly.
07

Tell me about a time you balanced model accuracy against a business constraint.

Save to ▾
Show answer
Situation: our lead-scoring model had the best AUC with a large ensemble, but the CRM needed scores within 50 ms. Task: meet latency without losing much quality. Action: I compared a smaller LightGBM model with fewer features and measured both AUC and latency. Result: we lost 0.01 AUC but met the 50 ms limit, and sales teams adopted it because scores appeared instantly.
08

How would you encode cyclical features like hour of day or month?

Save to ▾
Show answer
Map the value onto a circle with sine and cosine so the end connects to the start. import numpy as np df['hour_sin'] = np.sin(2 * np.pi * df['hour'] / 24) df['hour_cos'] = np.cos(2 * np.pi * df['hour'] / 24) Now 23:00 and 00:00 are close, which linear and distance-based models cannot see with raw integers. Tree models often manage with the raw value.
09

The segments you built six months ago no longer match customer behaviour. What do you do?

Save to ▾
Show answer
I would measure drift by comparing feature distributions and segment sizes over time. Then refit clustering on recent data and map new clusters to old ones by centroid similarity so business names stay consistent. I would set up a quarterly refresh with stability checks and alert when segment sizes shift sharply, and explain any renamed or merged segments to stakeholders.
10

Your classifier works well overall but poorly for one customer segment. What do you do?

Save to ▾
Show answer
I would measure metrics per segment to confirm, then check if that segment is under-represented or has different feature distributions. Fixes include collecting more data, sample weighting, segment-specific features, or a separate model if the behaviour is truly different. If the segment relates to a protected attribute, I would also review fairness metrics and involve the compliance team.
11

How do you detect and treat outliers?

Save to ▾
Show answer
Detect with box plots, the IQR rule (below Q1 - 1.5 IQR or above Q3 + 1.5 IQR), z-scores above 3, or models like Isolation Forest. Treatment depends on cause: fix data entry errors, cap values (winsorise), apply log transforms for skewed data, or use robust models and losses. Genuine extreme values, such as large fraud amounts, may be the most important signal and should not be removed blindly.
12

How does a support vector machine work?

Save to ▾
Show answer
An SVM finds the hyperplane that separates classes with the maximum margin, and the points on the margin are the support vectors. The soft-margin version uses C to trade off margin width against misclassification. Kernels like RBF or polynomial let SVMs learn non-linear boundaries by implicitly mapping data to higher dimensions. SVMs need scaled features and become slow beyond roughly a hundred thousand rows.
13

Validation AUC is 0.99 on a loan default model. What do you suspect?

Save to ▾
Show answer
Such a high score on a hard problem usually signals leakage. I would check feature importances for a suspiciously dominant feature, look for fields recorded after the loan outcome such as collection status, verify preprocessing was fit only on training data, and check for duplicate customers across train and test. Then re-run with a time-based split to confirm a realistic score.
14

How does k-means clustering work?

Save to ▾
Show answer
k-means picks k initial centroids, assigns each point to its nearest centroid, recomputes each centroid as the mean of its points, and repeats until assignments stop changing. It minimises within-cluster sum of squares (inertia). It needs k in advance, scaled features, and assumes roughly spherical, similar-sized clusters. k-means++ initialisation and multiple runs with n_init reduce bad starting points.
15

Marketing wants customer segments for campaigns. How do you approach it?

Save to ▾
Show answer
I would agree on the purpose first, such as retention or upsell. Then build RFM features (recency, frequency, monetary) plus category preferences, log-transform skewed values and scale them. I would try k-means for k between 3 and 8, use silhouette and business review to pick k, profile each segment and give them clear names. Finally, test segment-based campaigns against a control group.
16

Tune LightGBM with Optuna.

Save to ▾
Show answer
import optuna from sklearn.model_selection import cross_val_score def objective(trial): p = {'num_leaves': trial.suggest_int('num_leaves', 15, 255), 'learning_rate': trial.suggest_float('learning_rate', 0.01, 0.2, log=True), 'min_child_samples': trial.suggest_int('min_child_samples', 10, 200)} m = lgb.LGBMClassifier(n_estimators=500, **p) return cross_val_score(m, X, y, cv=5, scoring='roc_auc').mean() study = optuna.create_study(direction='maximize') study.optimize(objective, n_trials=50)
17

How do you handle class imbalance?

Save to ▾
Show answer
Start with the right metrics, such as PR-AUC, recall at fixed precision or F1, not accuracy. Then use class_weight='balanced', resampling like random undersampling or SMOTE applied only on training folds, and threshold tuning based on business cost. Boosting models with scale_pos_weight also help. Stratified splits keep class ratios consistent across folds.
18

A demand forecast is consistently under-predicting during festivals. How would you fix it?

Save to ▾
Show answer
The model lacks festival information. I would add features for festival dates such as Diwali or regional holidays, days-to-festival, and past festival uplift for the same item. If the business cost of stock-outs is higher than over-stock, I would use a quantile loss for a higher percentile. Then validate specifically on past festival periods, not just the average error.
19

What is Local Outlier Factor and how does it differ from Isolation Forest?

Save to ▾
Show answer
Local Outlier Factor compares the local density of a point with the density of its neighbours; a point in a much sparser area than its neighbours gets a high outlier score. It catches local anomalies inside varied-density data but is distance-based, so it needs scaling and is slower on large data. Isolation Forest is tree-based, faster and scales better, but is less sensitive to local density differences.
20

How do you build a scikit-learn pipeline for mixed numeric and categorical data?

Save to ▾
Show answer
Use ColumnTransformer inside a Pipeline so preprocessing is fit only on training folds. from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder num = Pipeline([('imp', SimpleImputer(strategy='median')), ('sc', StandardScaler())]) pre = ColumnTransformer([ ('num', num, num_cols), ('cat', OneHotEncoder(handle_unknown='ignore'), cat_cols) ]) model = Pipeline([('pre', pre), ('clf', LogisticRegression(max_iter=1000))])
21

Serve a scikit-learn model with FastAPI.

Save to ▾
Show answer
from fastapi import FastAPI from pydantic import BaseModel import joblib, pandas as pd app = FastAPI() model = joblib.load('model_v1.joblib') class Item(BaseModel): age: int income: float city: str @app.post('/predict') def predict(item: Item): df = pd.DataFrame([item.model_dump()]) return {'score': float(model.predict_proba(df)[0, 1])} Run it with: uvicorn app:app --host 0.0.0.0 --port 8000
22

Compare batch scoring and real-time inference.

Save to ▾
Show answer
Batch scoring runs on a schedule, for example nightly churn scores for all customers written to a table; it is simple, cheap and tolerant of slow models. Real-time inference returns predictions on request, such as fraud checks during payment, and needs low latency, high availability, scaling and fresh features. Choose real-time only when the decision must happen at the moment of the event.
23

Compare grid search, random search and Bayesian optimisation.

Save to ▾
Show answer
Grid search tries every combination of listed values; it is thorough but expensive and wastes trials on unimportant parameters. Random search samples combinations and usually finds good settings faster in high-dimensional spaces. Bayesian optimisation, as in Optuna or Hyperopt, builds a model of past trials to pick promising settings next, using fewer trials. Successive halving methods add early pruning of weak trials.
24

What is heteroscedasticity and why does it matter?

Save to ▾
Show answer
Heteroscedasticity means the variance of residuals changes with the level of the prediction, such as errors growing for expensive houses. Predictions remain unbiased, but standard errors and p-values become unreliable. Detect it with a residuals versus fitted plot or the Breusch-Pagan test. Fixes include log-transforming the target, weighted least squares, or robust standard errors.
25

Describe a time you found a serious data quality issue late in a project.

Save to ▾
Show answer
Situation: two days before a demo, I noticed sales for one region were doubled. Task: fix it without missing the deadline. Action: I traced it to a join that duplicated rows on a non-unique key, fixed the join, added row-count assertions to the pipeline and retrained. I informed my lead immediately with the impact. Result: the demo went ahead with correct numbers, and the assertions caught a similar issue later.
26

What is target encoding and how do you avoid leakage with it?

Save to ▾
Show answer
Target encoding replaces each category with the mean target value for that category, which works well for high-cardinality features. It leaks if computed on the full data because each row sees its own label. Avoid this by computing encodings out-of-fold within cross-validation and adding smoothing toward the global mean for rare categories. scikit-learn 1.3+ has TargetEncoder with built-in cross-fitting.
27

How would you build a quick baseline before trying complex models?

Save to ▾
Show answer
Use a DummyClassifier or DummyRegressor to see the score of a trivial guess, then a simple model. from sklearn.dummy import DummyClassifier base = DummyClassifier(strategy='most_frequent') base.fit(X_train, y_train) print(base.score(X_test, y_test)) Any real model must clearly beat this number; otherwise the features carry little signal.
28

Labels for your loan model arrive only after 6 months. How do you monitor it meanwhile?

Save to ▾
Show answer
I would rely on proxy signals: input data drift with PSI, prediction score distribution, approval rates by segment, and early indicators like first missed payment at 30 or 60 days. Once enough early outcomes arrive, I would check performance on these. I would also set up a delayed evaluation job that computes full metrics as labels mature and compares them with the validation baseline.
29

Your training loss is not decreasing at all. What could be wrong?

Save to ▾
Show answer
Common causes are a learning rate that is too high or too low, unscaled features, a bug in labels or feature alignment, wrong loss for the task, or data that has been shuffled away from its labels. I would try overfitting a tiny subset first; if the model cannot even fit 50 rows, there is a bug. Then check scaling, learning rate and gradient values.
30

How do you interpret a coefficient in a multiple linear regression?

Save to ▾
Show answer
A coefficient is the expected change in the target for a one-unit increase in that feature, holding other features constant. For example, a coefficient of 2,500 on 'area in square metres' means each extra square metre adds about 2,500 to price. Interpretation breaks down with multicollinearity or when features are scaled, so report units clearly and check stability.
31

What is the difference between label encoding and ordinal encoding?

Save to ▾
Show answer
Both map categories to integers. In scikit-learn, LabelEncoder is meant for the target variable, while OrdinalEncoder is for input features. Integer encoding implies an order, so it is fine for truly ordered values like low, medium, high, or for tree models, but it can mislead linear models on nominal data like colours. For nominal features with linear models, prefer one-hot encoding.
32

Compare MAE, MSE and RMSE as regression metrics.

Save to ▾
Show answer
MAE is the average absolute error, easy to explain and robust to outliers. MSE averages squared errors and punishes large errors heavily, which suits cases where big misses are costly. RMSE is the square root of MSE, so it is in the same unit as the target. If RMSE is much higher than MAE, a few large errors are present. MAPE is useful for percentage errors but fails near zero.
33

What is the ROC curve and AUC? When is PR-AUC better?

Save to ▾
Show answer
The ROC curve plots true positive rate against false positive rate at every threshold, and AUC is the probability that a random positive is ranked above a random negative. It is threshold-independent. On heavily imbalanced data, like 0.5 percent fraud, ROC-AUC can look high even when precision is poor, so the precision-recall curve and PR-AUC give a more honest picture.
34

k-means gives one huge cluster and several tiny ones. What could be wrong?

Save to ▾
Show answer
Likely causes are unscaled features, where one large-range feature dominates distance; heavy skew or outliers pulling centroids; or data that is not naturally spherical. I would log-transform and scale features, remove or cap extreme outliers, and try different k values. If shapes are irregular, DBSCAN, HDBSCAN or a Gaussian Mixture Model may fit better.
35

How do you prioritise when several teams ask you for models at the same time?

Save to ▾
Show answer
I estimate each request's business value, effort and urgency, then share a ranked list with my manager so priorities are agreed rather than assumed. For quick wins I offer a simple baseline first. In one quarter this helped us deliver a high-value churn model first while giving another team a dashboard-based interim answer, and both teams knew the timeline.
36

Write a unit test for a model prediction function.

Save to ▾
Show answer
import joblib, pandas as pd def test_predict_shape_and_range(): model = joblib.load('model_v1.joblib') df = pd.DataFrame([{'age': 30, 'income': 50000.0, 'city': 'Pune'}, {'age': 45, 'income': 0.0, 'city': 'UnknownCity'}]) p = model.predict_proba(df)[:, 1] assert p.shape == (2,) assert ((p >= 0) & (p <= 1)).all() Run with pytest in CI so broken artifacts never reach production.

Companies with offices in Gurgaon (8)

Frequently asked questions

Which companies hire Machine Learning professionals in Gurgaon?

Companies with large offices in Gurgaon include Amazon, Google, Microsoft, Zomato, American Express, Walmart, Fractal Analytics, Accenture. Use their company pages below to practise employer-specific sets.

Are Machine Learning interviews in Gurgaon different from other cities?

The questions depend more on the company than the city. Gurgaon's mix of employers decides the style: Interviews often expect strong business understanding along with technical skills, especially for analytics and product-facing roles

How do I find Machine Learning jobs in Gurgaon?

Shortlist companies with Gurgaon offices, keep your CV focused on Machine Learning projects, apply on company career pages and job portals with the Gurgaon filter, and practise the questions on this page before each interview.