HireHireInterview Quizzes › Data Scientist

Data Scientist Interview Questions

Think you're ready? These are the questions that actually decide Data Scientist interviews. Warm up on Easy — then face the Hard round, where 95% of candidates crumble. 80 questions across 3 levels, instant score, completely free.

80Questions
3Difficulty levels
95%Fail the hard round
FreeInstant score
Easy
Warm-up · 20 Qs
Medium
Practical · 30 Qs
Hard
Brutal · 30 Qs
⚡ Take the Data Scientist quiz — get your score →

The Data Scientist interview questions

Below are the real questions, grouped by difficulty. Expand any one to reveal the correct answer and why — or take the timed quiz for a score you can share. Can you clear the Hard round?

Easy round 20 questions

A model scores 99% accuracy on training data but only 68% on the test set. What is most likely happening?
  • A. Underfitting
  • B. Overfitting ✓
  • C. Data leakage into the test set
  • D. The test set is too large
Correct answer: B. A large gap where train accuracy is high but test accuracy is low is the classic signature of overfitting.
You are detecting fraud where only 1% of transactions are fraudulent. A model predicts 'not fraud' for everything. What is its accuracy and why is that misleading?
  • A. 1% accuracy, which correctly shows it is useless
  • B. 99% accuracy, but it catches zero fraud so recall is 0 ✓
  • C. 50% accuracy, because there are two classes
  • D. 0% accuracy, because it never predicts fraud
Correct answer: B. With 99% negatives, always predicting the majority class gives 99% accuracy while completely failing the actual goal, so recall is 0.
Your dataset has 'age' ranging 0-100 and 'income' ranging 0-1,000,000, and you plan to use k-NN. What should you do first?
  • A. Nothing, k-NN handles scale automatically
  • B. Scale/standardize the features so income does not dominate the distance ✓
  • C. Drop the age column since income is larger
  • D. Convert both to categorical bins
Correct answer: B. Distance-based models like k-NN are dominated by large-range features unless features are scaled to comparable ranges.
A city's ice-cream sales and drowning incidents both rise in the same months. What is the correct interpretation?
  • A. Ice cream causes drownings
  • B. They are correlated, likely driven by a common cause (hot weather) ✓
  • C. Drownings cause ice-cream sales
  • D. There is no relationship at all
Correct answer: B. Correlation does not imply causation; a confounder (summer heat) drives both variables.
You run 5-fold cross-validation. What is its main advantage over a single train/test split?
  • A. It makes the model train faster
  • B. It gives a more reliable performance estimate by testing on every fold ✓
  • C. It guarantees the model will not overfit
  • D. It removes the need for a test set entirely
Correct answer: B. Cross-validation averages performance across multiple folds, reducing the variance of the estimate compared with one split.
A confusion matrix shows TP=40, FP=10, FN=20, TN=30. What is the precision?
  • A. 0.80 ✓
  • B. 0.67
  • C. 0.57
  • D. 0.40
Correct answer: A. Precision = TP / (TP + FP) = 40 / (40 + 10) = 0.80.
Given the same matrix (TP=40, FP=10, FN=20, TN=30), what is the recall?
  • A. 0.80
  • B. 0.67 ✓
  • C. 0.57
  • D. 0.50
Correct answer: B. Recall = TP / (TP + FN) = 40 / (40 + 20) = 0.67.
You have a categorical feature 'color' with values red/green/blue for a linear regression. What is the standard way to prepare it?
  • A. Label it 1, 2, 3 so the model reads it directly
  • B. One-hot encode it into separate binary columns ✓
  • C. Drop it because linear models cannot use text
  • D. Replace each value with its frequency count only
Correct answer: B. One-hot encoding avoids imposing a false ordinal relationship that integer labels (1,2,3) would introduce.
A feature column is missing in 2% of rows and the values are roughly normally distributed. What is a reasonable simple imputation?
  • A. Fill with 0 always
  • B. Fill with the column mean or median ✓
  • C. Delete the entire column
  • D. Fill with a random large number
Correct answer: B. For a small fraction of missing values in a numeric column, mean/median imputation is a standard baseline.
During gradient descent your loss oscillates and diverges instead of decreasing. What is the most likely cause?
  • A. The learning rate is too high ✓
  • B. The learning rate is too low
  • C. There is too little training data
  • D. The features are already scaled
Correct answer: A. A learning rate that is too large causes overshooting of the minimum, making the loss diverge or oscillate.
An A/B test returns a p-value of 0.03 at a significance level of 0.05. What is the appropriate conclusion?
  • A. Fail to reject the null; no real difference
  • B. Reject the null; the difference is statistically significant ✓
  • C. The result proves B is better with 97% certainty of the effect size
  • D. The test is invalid and must be rerun
Correct answer: B. Since 0.03 < 0.05, you reject the null hypothesis and call the result statistically significant.
A linear regression reports R-squared = 0.85. What does this tell you?
  • A. The model is correct 85% of the time
  • B. 85% of the variance in the target is explained by the model ✓
  • C. The predictions are within 15% of actual values
  • D. There is an 85% correlation between two features
Correct answer: B. R-squared is the proportion of variance in the dependent variable explained by the model's predictors.
A decision tree grown with no depth limit fits training data perfectly but generalizes poorly. What best addresses this?
  • A. Increase the number of features
  • B. Limit max depth or prune the tree ✓
  • C. Train for more epochs
  • D. Remove the test set
Correct answer: B. Restricting depth or pruning reduces the tree's capacity to memorize noise, improving generalization.
In pandas, df.groupby('city')['sales'].mean() returns what?
  • A. The total sales across all cities
  • B. The average sales for each city ✓
  • C. The number of rows per city
  • D. A single overall mean of the sales column
Correct answer: B. groupby('city') with .mean() on 'sales' computes the mean sales within each city group.
A model has high bias and low variance. What is it most likely doing?
  • A. Overfitting the training data
  • B. Underfitting because it is too simple ✓
  • C. Perfectly balanced
  • D. Memorizing noise in the data
Correct answer: B. High bias with low variance means the model is too simple to capture the pattern, i.e. underfitting.
A numeric feature is strongly right-skewed with a long tail. Which transform commonly makes it more symmetric for a linear model?
  • A. Squaring the values
  • B. Applying a log transform ✓
  • C. Multiplying by a constant
  • D. Rounding to integers
Correct answer: B. A log transform compresses large values and reduces right skew, helping linear-model assumptions.
Adding an L2 (ridge) penalty to a regression primarily has what effect?
  • A. It forces some coefficients to exactly zero
  • B. It shrinks coefficients toward zero to reduce overfitting ✓
  • C. It increases model variance
  • D. It removes the intercept term
Correct answer: B. L2 regularization penalizes large coefficients, shrinking them to reduce variance and overfitting.
Data for a normal distribution has mean 50 and standard deviation 10. Approximately what percent of values fall between 40 and 60?
  • A. About 50%
  • B. About 68% ✓
  • C. About 95%
  • D. About 99.7%
Correct answer: B. Under the empirical rule, roughly 68% of values lie within one standard deviation of the mean.
You standardize your training features using their mean and std. How should you transform the test set?
  • A. Compute a new mean and std from the test set
  • B. Apply the mean and std learned from the training set ✓
  • C. Leave the test set unscaled
  • D. Scale each test row by its own mean and std
Correct answer: B. Using training statistics on the test set prevents data leakage and keeps the transform consistent.
A categorical feature 'user_id' has 500,000 unique values. Why is one-hot encoding it directly a bad idea for most models?
  • A. It loses the ordering of the ids
  • B. It creates a huge sparse matrix that explodes memory and overfits ✓
  • C. One-hot encoding only works on numbers
  • D. It changes the target variable
Correct answer: B. Extremely high-cardinality one-hot encoding produces massive sparse feature spaces that waste memory and overfit.

Medium round 30 questions

You train a classifier and get 97% accuracy, but the business is unhappy because the model rarely catches the fraud cases it was built for. Fraud is 3% of all transactions. What is the most likely explanation?
  • A. The model is overfitting the training data
  • B. The dataset is imbalanced, so high accuracy reflects mostly predicting the majority class ✓
  • C. The learning rate was set too high
  • D. You need a larger neural network
Correct answer: B. With 3% fraud, a model predicting 'not fraud' every time scores 97% accuracy, so accuracy is misleading on imbalanced data and metrics like recall or precision-recall AUC are needed.
You fit a StandardScaler on your entire dataset and then split into train and test sets to evaluate a model. What is the problem with this workflow?
  • A. StandardScaler should only be used on tree-based models
  • B. It causes data leakage because test-set statistics inform the scaling applied to training data ✓
  • C. Scaling must always be done after model training
  • D. There is no problem; scaling before splitting is the recommended approach
Correct answer: B. Fitting the scaler on all data lets test-set information (mean/variance) leak into training, inflating performance; the scaler must be fit on the train set only and applied to the test set.
In pandas, you want to compute the average purchase amount per customer from a transactions DataFrame. Which approach is correct?
  • A. df.groupby('customer_id')['amount'].mean() ✓
  • B. df.sort_values('customer_id')['amount'].mean()
  • C. df['amount'].mean().groupby('customer_id')
  • D. df.pivot('customer_id')['amount']
Correct answer: A. groupby on customer_id followed by selecting the amount column and calling mean() produces the per-customer average, which is the standard pandas aggregation pattern.
Your Random Forest achieves near-perfect accuracy on training data but performs poorly on the validation set. Which action is most likely to help?
  • A. Increase the maximum tree depth further
  • B. Remove the validation set and train on all data
  • C. Limit tree depth or increase min_samples_leaf to reduce overfitting ✓
  • D. Switch the evaluation metric to training accuracy
Correct answer: C. The large train/validation gap indicates overfitting, and constraining tree complexity (shallower depth, larger leaf size) regularizes the forest and improves generalization.
You are running an A/B test comparing conversion rates between a control and a variant. After one day the variant looks better with p=0.04, so a colleague wants to ship it immediately. What is the best response?
  • A. Ship it; p<0.05 means the result is definitely real
  • B. Wait until the pre-determined sample size or duration is reached to avoid peeking-induced false positives ✓
  • C. Re-run the test 10 times and average the p-values
  • D. Switch to a one-tailed test to get a smaller p-value
Correct answer: B. Stopping a test early the moment significance appears (peeking) dramatically inflates the false-positive rate, so you should reach the pre-planned sample size before deciding.
You need to encode a categorical feature 'city' with about 500 unique values for a gradient-boosting model. Which approach is generally most practical?
  • A. One-hot encode all 500 values, creating 500 new columns
  • B. Drop the feature because it has too many categories
  • C. Use target/mean encoding or group rare categories, being careful to avoid leakage ✓
  • D. Convert the city names to their string length
Correct answer: C. For high-cardinality categoricals, target encoding or grouping rare levels is more practical than exploding into 500 sparse one-hot columns, provided encoding is computed within cross-validation folds to prevent leakage.
A stakeholder asks whether an outlier customer with a spend of 5,000,000 (versus a typical 200) should be summarized using the mean or the median for a 'typical customer spend' report. What do you advise?
  • A. The mean, because it uses all data points
  • B. The median, because it is robust to the extreme outlier ✓
  • C. Neither; report only the maximum value
  • D. The mean, since averaging always best represents a group
Correct answer: B. The median is resistant to extreme values, so it better represents a 'typical' customer when a large outlier would drag the mean far above most observations.
You run a SQL query joining orders to customers and notice the result has more rows than the orders table. What is the most likely cause?
  • A. You used a LEFT JOIN instead of an INNER JOIN
  • B. The customers table has duplicate rows for the join key, causing row multiplication ✓
  • C. SQL always returns extra rows after a join
  • D. The ORDER BY clause duplicated the rows
Correct answer: B. When the join key is not unique on the joined side, each order matches multiple customer rows, multiplying the output row count, which is a common fan-out bug.
You are choosing between L1 (Lasso) and L2 (Ridge) regularization for a linear model with many features, and you also want automatic feature selection. Which is the better fit and why?
  • A. L2, because it drives many coefficients exactly to zero
  • B. L1, because it can shrink some coefficients exactly to zero, effectively selecting features ✓
  • C. Neither affects coefficients; both only change the intercept
  • D. L2, because it always yields sparser models than L1
Correct answer: B. L1's penalty can set coefficients exactly to zero, producing sparse models and built-in feature selection, whereas L2 shrinks coefficients toward but not exactly to zero.
During cross-validation on time-series data (predicting next month's sales), a teammate uses standard k-fold with random shuffling. Why is this problematic?
  • A. k-fold is only valid for classification, not regression
  • B. Random shuffling lets the model train on future data to predict the past, leaking temporal information ✓
  • C. Time-series data cannot be cross-validated at all
  • D. Shuffling reduces the number of folds automatically
Correct answer: B. Random k-fold ignores time order, so future observations end up in the training folds used to predict earlier points, leaking information; a forward-chaining/time-series split is required.
On a dataset that is 95% majority class, which is the LEAST appropriate primary evaluation metric?
  • A. F1-score
  • B. Precision-recall AUC
  • C. Raw accuracy ✓
  • D. Balanced accuracy
Correct answer: C. Raw accuracy is misleading under imbalance since predicting the majority alone scores high.
Compared to L2 (Ridge), L1 (Lasso) regularization is notable because it:
  • A. Never shrinks coefficients
  • B. Can drive some coefficients exactly to zero, doing feature selection ✓
  • C. Always outperforms Ridge
  • D. Requires normally distributed targets
Correct answer: B. L1's penalty geometry produces sparse solutions with exact-zero weights.
A model with high bias and low variance typically:
  • A. Overfits the training data
  • B. Underfits, missing relevant patterns ✓
  • C. Has perfect generalization
  • D. Memorizes noise
Correct answer: B. High bias means the model is too simple to capture the underlying signal.
In 5-fold cross-validation:
  • A. The model is trained once on all data
  • B. Data splits into 5 parts; each serves as validation once while the rest train ✓
  • C. Only 5 samples are used for validation
  • D. The test set trains the model 5 times
Correct answer: B. Each fold is held out for validation exactly once, averaging five estimates.
Why is feature scaling important for k-Nearest Neighbors?
  • A. KNN cannot handle categorical data
  • B. Distance calculations get dominated by features with larger numeric ranges ✓
  • C. It reduces the k value needed
  • D. It converts KNN into a linear model
Correct answer: B. Unscaled large-range features overwhelm the distance metric that KNN relies on.
An ROC-AUC of 0.5 indicates a classifier that:
  • A. Is perfect
  • B. Performs no better than random guessing ✓
  • C. Is severely overfit
  • D. Is perfectly calibrated
Correct answer: B. 0.5 AUC equals the diagonal, meaning no discriminative power.
When values are missing not at random and correlated with the target, a risky imputation choice is:
  • A. Adding a missingness indicator flag
  • B. Blindly filling with the column mean ✓
  • C. Model-based imputation
  • D. Investigating the missingness mechanism
Correct answer: B. Mean-filling MNAR data hides informative structure and biases the model.
If gradient descent loss oscillates wildly and diverges, the most likely cause is:
  • A. Learning rate set too high ✓
  • B. Too many epochs
  • C. Learning rate set too low
  • D. Batch size being too small only
Correct answer: A. An overly large learning rate overshoots minima, causing divergence.
A Variance Inflation Factor (VIF) well above 10 for a predictor signals:
  • A. The predictor is irrelevant
  • B. Strong multicollinearity with other predictors ✓
  • C. Heteroscedasticity
  • D. A non-linear relationship
Correct answer: B. High VIF means the predictor is largely explained by other predictors.
Compared to a single deep decision tree, a random forest primarily reduces:
  • A. Bias by growing deeper trees
  • B. Variance by averaging many de-correlated trees ✓
  • C. Total training time
  • D. The number of features needed
Correct answer: B. Bagging plus feature subsampling averages out the high variance of individual trees.
On a dataset that is 99% negative, which metric is LEAST informative about model quality?
  • A. Accuracy ✓
  • B. Precision
  • C. Recall
  • D. F1-score
Correct answer: A. A model predicting only the majority class scores 99% accuracy while learning nothing, so accuracy misleads on imbalanced data.
Which technique best addresses multicollinearity among predictors in regression?
  • A. Increasing learning rate
  • B. Ridge (L2) regularization ✓
  • C. One-hot encoding
  • D. Random oversampling
Correct answer: B. Ridge regularization shrinks and stabilizes coefficients that would otherwise blow up under collinearity.
In 5-fold cross-validation, how many times does each observation serve as validation data?
  • A. Once ✓
  • B. Five times
  • C. Four times
  • D. Never
Correct answer: A. Each observation lands in exactly one fold and is used for validation that single time.
What is the effect of increasing k in k-Nearest Neighbors?
  • A. The boundary becomes more jagged
  • B. The decision boundary smooths out, raising bias and lowering variance ✓
  • C. Training time grows quadratically
  • D. The model overfits more
Correct answer: B. Larger k averages over more neighbors, producing a smoother, higher-bias, lower-variance boundary.
When is stratified sampling in a train-test split most useful?
  • A. To speed up training
  • B. To normalize features
  • C. To preserve class proportions in imbalanced data ✓
  • D. To remove outliers
Correct answer: C. Stratification keeps each split's class ratios matching the full dataset, important when classes are rare.
Feature A ranges 0-1 and Feature B ranges 0-100000. Which model is MOST sensitive to this scale mismatch?
  • A. Decision Tree
  • B. Random Forest
  • C. K-Means clustering ✓
  • D. Naive Bayes
Correct answer: C. K-Means uses Euclidean distance, so the large-range feature dominates unless features are scaled.
A high Variance Inflation Factor (VIF) for a feature indicates what?
  • A. The feature is highly collinear with other features ✓
  • B. The feature has strong predictive power
  • C. The residuals are non-normal
  • D. The model is underfitting
Correct answer: A. VIF measures how much a feature is linearly explained by the others; high values signal multicollinearity.
In gradient descent, what happens if the learning rate is set too high?
  • A. Training becomes slow but stable
  • B. The loss may diverge or oscillate instead of converging ✓
  • C. The model always underfits
  • D. Gradients become exactly zero
Correct answer: B. An overly large step overshoots minima, causing the loss to oscillate or diverge.
Which practice constitutes p-hacking?
  • A. Using a large sample size
  • B. Repeatedly running tests until significance appears ✓
  • C. Reporting confidence intervals
  • D. Using a two-tailed test
Correct answer: B. Testing until you find a significant result inflates false positives by ignoring multiple comparisons.
Why apply a log transform to a right-skewed target variable?
  • A. To make it categorical
  • B. To reduce skew and stabilize variance ✓
  • C. To add more features
  • D. To permanently remove outliers
Correct answer: B. A log transform compresses large values, reducing skew and making variance more constant.

Hard round 30 questions

A fraud model on a dataset with 0.5% positives reports 99.4% accuracy, ROC-AUC 0.91, but the fraud team says it misses most fraud in production at the default 0.5 threshold. Which single diagnostic best explains the gap and points to the fix?
  • A. ROC-AUC is invalid on imbalanced data, so retrain with balanced class weights before trusting any metric
  • B. The PR curve / PR-AUC shows precision-recall tradeoff at operating thresholds; 0.5 sits where recall collapses, so tune the threshold on the PR curve to the business cost ratio ✓
  • C. Accuracy is high, so the model is fine and the issue is label noise in the production fraud reports
  • D. ROC-AUC of 0.91 proves the model ranks well, so the only fix is to oversample the minority class with SMOTE until classes are balanced
Correct answer: B. ROC-AUC can look strong under imbalance because true negatives dominate; the PR curve exposes the collapse in recall at 0.5 and the correct fix is choosing a cost-driven threshold rather than blindly rebalancing.
You run this query to compute month-over-month revenue growth: SELECT month, revenue, (revenue - LAG(revenue) OVER (ORDER BY month)) / LAG(revenue) OVER (ORDER BY month) AS growth FROM monthly_rev; The table has multiple months per region (region column present) but you forgot to partition. What happens?
  • A. It errors because LAG requires a PARTITION BY clause when the table has a grouping column
  • B. It silently computes growth across region-interleaved rows, so LAG pulls the prior row which may belong to a different region, producing meaningless growth values ✓
  • C. It automatically partitions by region because region is a column in the table
  • D. It returns NULL for every row because ORDER BY month alone is not a valid window frame
Correct answer: B. Without PARTITION BY region, the window is the whole result set ordered by month, so LAG crosses region boundaries and yields incorrect cross-region growth rather than erroring.
An XGBoost model's training logloss keeps decreasing across 2000 boosting rounds, but validation logloss bottomed at round 300 and has risen since. A teammate proposes lowering the learning rate from 0.1 to 0.01 while keeping n_estimators=2000 fixed and no early stopping. What is the most likely result?
  • A. Lower learning rate alone eliminates overfitting because each tree contributes less, so validation loss will keep improving to round 2000
  • B. It still overfits: a smaller learning rate needs MORE rounds to fit, but with 2000 rounds and no early stopping it will again overshoot the optimal round and overfit ✓
  • C. Training loss will stop decreasing, proving the model can no longer fit the data
  • D. The two hyperparameters are independent, so learning rate has no effect on where validation loss bottoms out
Correct answer: B. Learning rate and n_estimators trade off; shrinking the rate slows fitting but with a fixed large round count and no early stopping the ensemble still passes the optimal point and overfits, so early stopping on validation is the real fix.
A deep network trains stably at batch size 256 with Adam and lr=1e-3. After switching to SGD with the SAME lr=1e-3 and batch size 2048, loss diverges to NaN within a few steps. Which explanation is most consistent with this?
  • A. Adam adapts per-parameter step sizes so 1e-3 was safe, but raw SGD applies that lr directly to large gradients, and the 8x larger batch also raises the effective step, causing divergence ✓
  • B. SGD is fundamentally unable to train deep networks, so any lr will diverge
  • C. Larger batch size always reduces the effective learning rate, so the divergence must come from a data pipeline bug, not the optimizer change
  • D. Adam and SGD are interchangeable at the same lr; the NaN must be from float16 overflow unrelated to the optimizer swap
Correct answer: A. Adam normalizes updates by gradient magnitude so a given lr behaves very differently under plain SGD, and a larger batch gives lower-variance but not smaller-magnitude gradients, so the un-normalized step is far too large and diverges.
An offline-trained churn model scores AUC 0.88 on a held-out test set but only 0.71 in production two weeks after launch. Feature distributions (PSI) are stable, and no schema changed. The training set was built by joining a snapshot that included a 'days_since_last_login' feature computed as of the label date. What is the most probable root cause?
  • A. Concept drift: customer behavior changed in two weeks, so retrain more frequently
  • B. Covariate shift: the PSI test is too weak to detect the shift, so use the KS test instead
  • C. Temporal/target leakage: the feature was computed using information from at or after the label window, so it is unavailable or different at true serving time, inflating offline AUC ✓
  • D. Sample ratio mismatch between training and serving traffic caused the degradation
Correct answer: C. Stable input distributions plus a big offline-to-online drop and a feature computed 'as of the label date' point to temporal leakage where offline features encode future information unavailable at serving time.
A team runs an A/B test, checks the p-value daily, and stops the moment it drops below 0.05 on day 6 of a planned 14-day test, declaring a win. Assuming no true effect, what is the primary statistical problem?
  • A. Nothing is wrong; reaching p<0.05 earlier just means the effect is strong enough to stop early
  • B. Repeated peeking inflates the Type I error rate far above 5% because each look is another chance to cross the threshold by noise; a sequential/alpha-spending procedure is required to stop early validly ✓
  • C. The test is underpowered, so the p-value is unreliable and they should have used a larger sample from the start
  • D. Daily checks reduce power, making a false negative (Type II error) the main risk here
Correct answer: B. Optional stopping on a fixed-horizon p-value multiplies the chances of a false positive so the real Type I rate greatly exceeds 5%; valid early stopping needs sequential testing or alpha-spending.
In scaled dot-product attention, scores are computed as softmax(QK^T / sqrt(d_k)) V. Why is the division by sqrt(d_k) present, and what breaks without it as d_k grows large?
  • A. It normalizes the output to unit norm; without it the output magnitude grows and the residual connection overflows
  • B. For large d_k the dot products have large variance, pushing softmax into saturated regions with vanishing gradients; scaling by sqrt(d_k) keeps score variance ~1 so gradients stay usable ✓
  • C. It converts logits to probabilities; without it softmax cannot be applied at all
  • D. It makes attention permutation-invariant; without it positional information leaks into the scores
Correct answer: B. With random Q,K the dot product variance scales with d_k, so unscaled logits saturate softmax and kill gradients; dividing by sqrt(d_k) keeps the variance around 1 and preserves gradient flow.
You must add a feature answering internal-policy questions over a 40,000-page compliance manual that is revised weekly, with a hard requirement that every answer cite the exact source paragraph and that removed documents stop being answerable immediately. Which approach best fits, and why?
  • A. Fine-tune the base model weekly on the manual, because fine-tuning gives the best factual grounding and lowest latency
  • B. RAG over a vector index of the manual, because retrieval provides citable source chunks, weekly revisions only require re-indexing (not retraining), and deleting a document removes it from answers immediately ✓
  • C. A long-context prompt stuffing all 40,000 pages every call, because it guarantees the model sees everything and needs no infrastructure
  • D. Fine-tune with LoRA adapters daily, because adapters are cheap and encode citations directly into the weights
Correct answer: B. RAG naturally supplies verifiable source passages for citation, handles frequent updates by re-indexing rather than retraining, and honors deletions instantly by removing chunks from the index, which fine-tuning and full-context stuffing cannot do cleanly or affordably.
An analyst finds users who enabled two-factor auth churn 30% less and recommends forcing 2FA on everyone to cut churn. What is the strongest methodological objection?
  • A. The sample is too small unless it exceeds 30 users per the Central Limit Theorem
  • B. Self-selection/confounding: users who opt into 2FA are already more engaged and security-conscious, so the correlation likely reflects that confounder rather than a causal effect of 2FA on churn ✓
  • C. The p-value was not reported, so the 30% figure is meaningless regardless of design
  • D. Churn is a lagging metric, so any observational finding about it is automatically invalid
Correct answer: B. 2FA adoption is voluntary and correlates with engagement, a classic confounder, so the observed reduction cannot be read as causal without a randomized rollout or a valid quasi-experimental design.
You deploy LoRA fine-tuning: the base weights W are frozen and you learn a low-rank update so the effective weight is W + (B A) with A (r x d) and B (d x r), rank r=8. Which statement about this setup is correct?
  • A. LoRA modifies the frozen W in place during training, so you must keep a full copy of the original weights to roll back
  • B. Only A and B are trained, drastically cutting trainable parameters and optimizer state; at inference B A can be merged into W so there is no added latency ✓
  • C. LoRA requires 4-bit quantization of the base model to function; without QLoRA the low-rank update is mathematically undefined
  • D. The rank r must equal the hidden dimension d for the approximation to be lossless, so r=8 will always underfit badly
Correct answer: B. LoRA freezes W and trains only the small A and B matrices (huge memory savings on params and optimizer state), and since BA has the same shape as W it can be folded into the weights at inference for zero added latency.
How does XGBoost handle missing feature values during training by default?
  • A. It drops rows containing any missing value
  • B. It learns a default split direction for missing values at each node ✓
  • C. It imputes with the global mean first
  • D. It raises an error requiring pre-imputation
Correct answer: B. XGBoost assigns missing values to whichever branch minimizes loss, learned per split.
Dropout regularizes a neural network primarily by:
  • A. Permanently deleting neurons after training
  • B. Randomly deactivating units during training to prevent co-adaptation ✓
  • C. Decaying the learning rate over time
  • D. Normalizing activations per mini-batch
Correct answer: B. Random deactivation forces redundant, robust representations akin to model averaging.
The 'kernel trick' in SVMs allows the algorithm to:
  • A. Train without any support vectors
  • B. Compute inner products in a high-dimensional space without explicitly mapping the data ✓
  • C. Guarantee a linear boundary in input space
  • D. Eliminate the regularization parameter C
Correct answer: B. Kernels compute dot products in feature space implicitly, avoiding explicit transformation.
As dimensionality grows, a key manifestation of the curse of dimensionality is that:
  • A. Distances between points become more distinct
  • B. Points become nearly equidistant, weakening distance-based methods ✓
  • C. Models always underfit
  • D. Fewer samples are needed to generalize
Correct answer: B. In high dimensions pairwise distances concentrate, degrading nearest-neighbor notions.
During inference, batch normalization uses:
  • A. The current mini-batch statistics
  • B. Running moving-average estimates of mean and variance from training ✓
  • C. Freshly computed per-sample statistics
  • D. No normalization at all
Correct answer: B. At test time BN relies on population statistics accumulated during training for determinism.
In PCA, the principal components correspond to:
  • A. The eigenvectors of the covariance matrix ordered by eigenvalue ✓
  • B. The rows with the highest variance
  • C. The features with the largest raw values
  • D. Randomly rotated axes
Correct answer: A. PCA directions are covariance-matrix eigenvectors, ranked by explained variance.
Why might log loss be preferred over accuracy for a probabilistic classifier?
  • A. It ignores predicted probabilities
  • B. It penalizes confident wrong predictions, rewarding calibrated probabilities ✓
  • C. It is invariant to class imbalance
  • D. It only counts the argmax class
Correct answer: B. Log loss scores probability quality, heavily punishing confident mistakes.
A subtle form of data leakage occurs when:
  • A. The test set is smaller than the training set
  • B. Scaling/imputation parameters are fit on the full dataset before the train/test split ✓
  • C. Categorical variables are one-hot encoded
  • D. The random seed is fixed
Correct answer: B. Fitting preprocessing on all data leaks test-set information into training.
A 95% frequentist confidence interval means:
  • A. There is a 95% probability the true parameter lies in this specific interval
  • B. 95% of such intervals from repeated samples would contain the true parameter ✓
  • C. The parameter is random with 95% density in this range
  • D. The sample mean is 95% accurate
Correct answer: B. The 95% refers to the long-run coverage of the procedure, not one fixed interval.
Sigmoid activations worsen the vanishing gradient problem in deep networks because:
  • A. Their derivative saturates near 0 for large-magnitude inputs, shrinking backpropagated gradients ✓
  • B. They output unbounded values
  • C. They are non-differentiable
  • D. They amplify gradients exponentially
Correct answer: A. Saturated sigmoids have near-zero slope, so gradients decay multiplicatively across layers.
In XGBoost, what does the gamma (min_split_loss) parameter control?
  • A. The learning rate
  • B. The minimum loss reduction required to make a split ✓
  • C. The number of boosting rounds
  • D. The row subsample ratio
Correct answer: B. Gamma sets the minimum gain a split must achieve, acting as a complexity/regularization control.
Why can't standard k-fold cross-validation be used directly on time-series data?
  • A. It leaks future information into training folds ✓
  • B. It requires labeled data
  • C. It cannot handle numeric features
  • D. It always overfits
Correct answer: A. Random folds let future observations train a model evaluated on the past, leaking information; time-based splits are needed.
Which OLS assumption is violated when residuals are heteroscedastic?
  • A. Linearity in parameters
  • B. Constant error variance (homoscedasticity) ✓
  • C. Independence of features
  • D. Normality of predictors
Correct answer: B. Heteroscedasticity means error variance changes across observations, violating the constant-variance assumption.
In PCA, the principal components are the eigenvectors of which matrix?
  • A. The covariance matrix of the data ✓
  • B. The design matrix
  • C. The confusion matrix
  • D. The Gram matrix of the labels
Correct answer: A. PCA diagonalizes the feature covariance matrix; its eigenvectors are the principal directions.
What does the kernel trick in SVMs enable?
  • A. Reducing the number of support vectors
  • B. Computing inner products in a high-dimensional space without explicit mapping ✓
  • C. Balancing class weights
  • D. Preventing vanishing gradients
Correct answer: B. Kernels evaluate dot products in an implicit high-dimensional space, avoiding costly explicit feature maps.
Why does bagging in a random forest reduce variance?
  • A. Averaging many decorrelated trees lowers overall variance ✓
  • B. Each tree uses all features
  • C. It increases individual tree depth
  • D. It drives bias to zero
Correct answer: A. Averaging predictions from trees trained on different bootstrap samples and feature subsets cancels their independent errors.
A very deep, unpruned decision tree typically exhibits which bias-variance profile?
  • A. High bias, low variance
  • B. Low bias, high variance ✓
  • C. High bias, high variance
  • D. Low bias, low variance
Correct answer: B. Deep trees fit training data closely (low bias) but change a lot with new data (high variance).
Why does maximum-likelihood estimation for logistic regression lack a closed-form solution?
  • A. The log-likelihood is nonlinear in the parameters and must be solved iteratively ✓
  • B. The data is always non-separable
  • C. The sigmoid is non-differentiable
  • D. The Hessian is always singular
Correct answer: A. The sigmoid makes the likelihood equations nonlinear, so methods like Newton-Raphson or gradient ascent are required.
In a soft-margin SVM, what does a small value of the C parameter do?
  • A. Produces a narrow margin with no allowed misclassification
  • B. Produces a wider margin that tolerates more misclassifications ✓
  • C. Sets the kernel bandwidth
  • D. Sets the polynomial degree
Correct answer: B. Small C weakens the misclassification penalty, favoring a wider, more regularized margin.
In A/B testing, what is a Type II error?
  • A. Detecting an effect that does not actually exist
  • B. Failing to detect a real effect that does exist ✓
  • C. Choosing the wrong test statistic
  • D. Setting alpha to 0.05
Correct answer: B. A Type II error is a false negative, failing to reject a false null when a true effect is present.

Prep for another role

Questions are original, written and independently verified for HireHire's role interview quizzes. They reflect the kind of knowledge Data Scientist interviews test, not any specific company's questions. HireHire maps live tech & IT jobs across India, updated regularly. Last updated: August 2026.