Skip to content
tezvyn:
Menu

Top 30 Data Science & Analytics Interview Questions and Answers

30 multiple-choice questions on Data Science & Analytics, of the kind that come up in a technical interview, drawn from 30 bites in the Data Science & Analytics library. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.

Analysis, notebooks, visualization, pandas, statistics

30 questions. Pick an answer, or open “Show the answer” to read it.

Answers are graded in your browser. Quiz progress is not saved, and no XP or streak is earned here. The app keeps score.

  1. Question 1 of 30

    When converting a large list of flat dictionaries to a pandas DataFrame, which method is the idiomatic one-shot approach for aligning keys and avoiding repeated DataFrame growth?

    Show the answer

    Answer: c · Pass the list of dicts directly to pd.DataFrame so the constructor aligns the dictionary keys in one operation

    Passing the list directly to pd.DataFrame is the idiomatic approach for flat row-oriented dictionaries: it aligns the union of keys and fills missing values with NaN. Repeatedly growing a DataFrame can cause unnecessary copying, while the exact performance of alternatives depends on the data and pandas version.

    Read the full bite: Most efficient way to convert list of dicts to pandas DataFrame

  2. Question 2 of 30

    For a DataFrame with a string index, which call raises an error and why?

    Show the answer

    Answer: d · df.iloc['x'], because iloc requires integer positions not labels

    iloc is strictly positional and rejects a string label, raising a TypeError. df.loc['x'] and df.iloc[0] both work correctly on a string-indexed frame.

    Read the full bite: Pandas loc versus iloc indexing

  3. Question 3 of 30

    A pandas DataFrame has 5% missing values in customer_age, completely at random. When is dropna the better choice over fillna?

    Show the answer

    Answer: c · When generating a quick aggregate report and the remaining 95% of data is sufficient

    The card states that dropna is safe for a quick aggregate report when data is missing completely at random and the remaining sample is still large enough. Option A describes the opposite scenario: when age is predictive, dropping rows discards valuable labeled outcomes and reduces model performance, so imputation is preferred instead.

    Read the full bite: Describe strategies for handling missing values in pandas DataFrames

  4. Question 4 of 30

    Which query pattern correctly identifies customers who have never placed an order?

    Show the answer

    Answer: b · LEFT JOIN orders then filter WHERE orders.customer_id IS NULL

    B uses the correct anti-join pattern: LEFT JOIN preserves all customers and IS NULL keeps only those with no matching orders. D is not an anti-join, and A can be unsafe when the subquery contains NULL customer IDs because SQL three-valued logic can suppress expected rows.

    Read the full bite: Find customers who have not placed any orders

  5. Question 5 of 30

    Which approach correctly handles the full response lifecycle when fetching JSON from a REST API in production using Python's requests?

    Show the answer

    Answer: c · Verify the status with r.raise_for_status() before parsing with r.json()

    Calling r.raise_for_status() before trusting r.json() raises an HTTPError for unsuccessful responses before application code treats their bodies as successful payloads. r.json() parses the response body independently and can also raise a JSON decoding error when the body is not valid JSON; timeouts and connection errors need separate handling.

    Read the full bite: How do you fetch JSON from a REST API and parse it?

  6. Question 6 of 30

    Why is a violinplot generally preferred over a bar plot when exploring house prices across neighborhoods?

    Show the answer

    Answer: a · It preserves the full distribution, revealing features like bimodality and outliers that a bar plot's single statistic would obscure.

    The card states that bar plots collapse a continuous distribution into a single estimate like the mean, hiding variance, multimodality, and extreme values, whereas violinplots reveal the full distribution shape. Option D actually describes the key limitation of a bar plot, not an advantage of a violinplot.

    Read the full bite: Which plot visualizes a continuous versus categorical variable and why?

  7. Question 7 of 30

    During EDA, a heatmap reveals a strong positive correlation between daily ice cream sales and sunscreen sales. What is the most appropriate next step before making causal business recommendations?

    Show the answer

    Answer: d · Investigate potential confounders such as outdoor temperature and examine partial correlations before making causal recommendations.

    The card emphasizes that a strong heatmap correlation should prompt a search for confounders such as temperature and further analysis like partial correlation, not a causal conclusion. Option B is wrong because heatmap color intensity reflects linear association, not causal strength, which is a key red flag mentioned.

    Read the full bite: Explain correlation vs causation and heatmap limitations in EDA

  8. Question 8 of 30

    A data scientist chooses Z-score standardization over Min-Max scaling before training a logistic regression model with gradient descent. What is the primary statistical reason for this choice?

    Show the answer

    Answer: b · Z-score standardization centers features at mean zero with unit variance, ensuring weight updates proceed at comparable rates during gradient descent.

    Z-score standardization places features on comparable scales so gradient descent updates all weights at similar rates and no feature dominates the loss surface. The Min-Max distractor is tempting but incorrect because bounding values to [0, 1] does not equalize variances, and high-variance features can still compress the signal of others.

    Read the full bite: Min-Max scaling vs Z-score standardization: differences and algorithm preferences

  9. Question 9 of 30

    When a categorical feature has thousands of unique values, which approach avoids the dimensionality and memory issues of one-hot encoding while keeping predictive signal?

    Show the answer

    Answer: d · Target encoding, which replaces each category with the mean of the target variable for that category

    Target encoding collapses a high-cardinality categorical feature into a numeric statistic such as a target mean, avoiding one sparse column per category. Compute the statistic out-of-fold for training data and from training data only for validation or test data, with smoothing where appropriate, to reduce target leakage. Label and ordinal encoding can impose a false order on nominal categories.

    Read the full bite: Why avoid one-hot encoding for high cardinality and what are alternatives?

  10. Question 10 of 30

    In fraud detection with 1% fraud prevalence, a model labels every transaction as legitimate and achieves 99% accuracy. What is the key lesson?

    Show the answer

    Answer: a · Accuracy can be misleading because it ignores the rare positive class entirely

    The card describes the accuracy paradox, where a trivial classifier achieves 99% accuracy on imbalanced fraud data while catching zero actual fraud, proving accuracy can hide complete failure on the minority class. Option C is tempting because 99% sounds excellent, but it wrongly rewards a model that is entirely useless for the business goal of detecting fraud.

    Read the full bite: Why is accuracy misleading for fraud detection, and what metrics instead?

  11. Question 11 of 30

    Which description best captures how K-Means iteratively forms its final clusters?

    Show the answer

    Answer: d · It initializes K centroids, then repeatedly assigns points to the nearest centroid and recomputes each centroid as the cluster mean until stable.

    K-Means uses Lloyd's algorithm to repeatedly assign observations to the nearest centroid and update each centroid to the cluster mean until convergence. Option B is tempting because random initialization is correct, but the algorithm is not a single-pass assignment; without iterative refinement it would not minimize within-cluster variance.

    Read the full bite: How does K-Means clustering work and how do you choose K?

  12. Question 12 of 30

    You run an experiment and obtain p = 0.03. Which statement correctly interprets this p-value?

    Show the answer

    Answer: c · If the null hypothesis were true, there is a 3% probability of observing data at least this extreme.

    A p-value assumes the null hypothesis is true and quantifies the probability of seeing data at least this extreme under that assumption; it does not measure the probability that the null is false, that the alternative is true, or that the result occurred by chance.

    Read the full bite: What is a p-value? Interpret p = 0.03 at alpha = 0.05.

  13. Question 13 of 30

    Which hypothesis pair best tests whether a green signup button increases registrations compared to blue?

    Show the answer

    Answer: b · H0: The registration conversion rate for green equals that for blue; H1: The registration conversion rate for green is strictly greater than that for blue.

    The correct answer frames H0 as no difference and H1 as a directional increase in the specific metric, matching the one-tailed nature of the business question. Option A is tempting because it uses 'no difference,' but it wrongly uses a two-tailed alternative that ignores the directional ask and wastes statistical power.

    Read the full bite: What are your null and alternative hypotheses for this A/B test?

  14. Question 14 of 30

    Which approach best demonstrates a sound framework for measuring e-commerce user engagement?

    Show the answer

    Answer: a · Use DAU/MAU, adoption, retention, and stickiness tied to conversion and churn

    Among these choices, A is the best framework because it connects engagement measures to business outcomes instead of treating page views as success. For an e-commerce product, apply that principle to the journey: product views and search, add-to-cart, checkout, purchase, repeat purchase, conversion, revenue or margin, and retention. DAU/MAU can remain a supporting habit signal.

    Read the full bite: What metrics track e-commerce user engagement and how do you prioritize them?

  15. Question 15 of 30

    An e-commerce site sees search users convert at 5% and non-search users at 2%. What is the best next step to estimate the true incremental impact of search?

    Show the answer

    Answer: a · Match searchers to similar non-searchers using device, landing page, and prior sessions, then compare rates

    Matching on confounders like device and landing page isolates selection bias, which is why the example shows the true incremental lift drops to roughly 25% after propensity matching. Running a two-sample t-test on the raw rates assumes the groups are comparable and would incorrectly validate an inflated, non-causal difference.

    Read the full bite: How would you validate that search users are more likely to purchase?

  16. Question 16 of 30

    A monthly subscriber cancels mid-cycle but retains access until month-end. Which approach reflects a rigorous churn definition for this user?

    Show the answer

    Answer: a · Waiting until the billing period ends or a reactivation window passes

    A rigorous definition ties churn to the actual end of access or the close of a defined renewal window, not just the intent signal. Counting the cancellation click immediately is the naive error highlighted in the card, because the user may still revert and the revenue is still active through the billing period.

    Read the full bite: How do you define churn for a subscription service?

  17. Question 17 of 30

    A checkout A/B test shows significantly higher conversion but slightly lower AOV. What is the strongest basis for a launch recommendation?

    Show the answer

    Answer: d · Estimate net revenue and ensure the AOV decline is within a pre-specified non-inferiority margin

    The right framework classifies conversion as a success metric and AOV as a guardrail requiring non-inferiority, then uses net revenue to judge the business outcome. Treating AOV as a co-success metric that must significantly increase is a tempting error that causes unnecessary conservatism and missed wins.

    Read the full bite: How would you recommend launching a checkout flow with mixed A/B metrics?

  18. Question 18 of 30

    A marketing team debates predicting exact spend versus High/Medium/Low tiers. What most strongly determines whether regression or classification is the better framing?

    Show the answer

    Answer: a · Whether the downstream campaign action requires a ranked list and continuous segmentation or a hard gate into fixed segments.

    The campaign action dictates whether you need a ranked continuous score or a discrete gate, making B correct. D is tempting but dangerous because choosing classification solely for yes/no simplicity ignores the information loss from binarizing a continuous signal and may mismatch flexible budget allocation.

    Read the full bite: How do you frame high-value customer identification as classification versus regression?

  19. Question 19 of 30

    Why is the correlation between profile completion and retention weak evidence that forcing completion will improve retention?

    Show the answer

    Answer: d · Engaged users self-select into completing profiles, confounding the relationship

    Motivated users both complete profiles and retain, so engagement is a confounder making completion a marker rather than a proven cause. A randomized experiment is needed; the other options misstate the actual problem.

    Read the full bite: Does forcing profile completion cause retention?

  20. Question 20 of 30

    What is the most important addition to a revenue metric when evaluating a change that may harm long-term satisfaction?

    Show the answer

    Answer: b · Long-horizon guardrail metrics like retention plus a sufficiently long experiment

    Long-term harm surfaces as delayed churn, so guardrail metrics measured over a long-enough window are essential to weigh against the immediate revenue lift. More precise short-term revenue alone still misses the delayed retention cost.

    Read the full bite: Framing ad-load tradeoffs: revenue versus retention

  21. Question 21 of 30

    When validating a composite burnout proxy, why test whether it predicts voluntary attrition six months later?

    Show the answer

    Answer: c · It establishes predictive validity by showing the proxy correlates with a meaningful future outcome

    Testing future attrition establishes predictive validity, confirming the composite index captures a construct with real downstream consequences. The most tempting distractor confuses prediction with causation: a proxy that predicts attrition does not prove burnout causes it, since unobserved confounders may drive both.

    Read the full bite: How would you build and validate a proxy target for employee burnout?

  22. Question 22 of 30

    What justifies using a z-test for a population mean when the underlying data are heavily skewed?

    Show the answer

    Answer: a · The sampling distribution of the sample mean becomes approximately normal for large n

    The CLT states that the sampling distribution of the sample mean approaches normality as n grows, which justifies using z-tests even when the population is skewed. Option B describes the Law of Large Numbers, a common look-alike that explains convergence to a single value rather than the bell-curve shape required for inference.

    Read the full bite: Explain the Central Limit Theorem and its importance for hypothesis testing

  23. Question 23 of 30

    Which statement correctly describes how increasing model complexity affects bias and variance?

    Show the answer

    Answer: b · Bias decreases but variance increases because the fit depends more on the specific training sample.

    The card explains that increasing complexity reduces bias by fitting training data more closely but simultaneously increases variance by making predictions dependent on the specific sample. Option D is the most tempting distractor because it reflects the common red-flag misconception that adding parameters improves both error sources.

    Read the full bite: Describe the bias-variance tradeoff and how model complexity affects bias and variance

  24. Question 24 of 30

    A medical model reports 99% accuracy on a disease with 1% prevalence. Which observation best shows why accuracy is misleading?

    Show the answer

    Answer: a · The model could predict every patient is healthy and still score 99%.

    When prevalence is 1%, an all-negative classifier automatically achieves 99% accuracy while detecting zero actual cases, proving accuracy can mask total failure. Distractor A is a common misconception the card explicitly warns against, as the problem is class imbalance rather than sample size.

    Read the full bite: Why is 99% accuracy misleading with 1% disease prevalence?

  25. Question 25 of 30

    What happens when the learning rate in gradient descent is set too high?

    Show the answer

    Answer: a · Steps overshoot the minimum and the loss may oscillate or diverge

    Too large a step size overshoots the minimum, causing oscillation or divergence instead of convergence. A high rate does not guarantee faster or correct convergence, and it does not change how the gradient is computed.

    Read the full bite: How gradient descent and the learning rate work

  26. Question 26 of 30

    In PCA on mean-centered data, what does the eigenvalue associated with a principal component directly represent?

    Show the answer

    Answer: d · The variance of the data projected onto that component's direction

    Each eigenvalue equals the variance captured along its eigenvector, which is why components are ranked by eigenvalue. Accuracy is a downstream model metric, not what the eigenvalue measures.

    Read the full bite: Eigenvalues, eigenvectors, and their role in PCA

  27. Question 27 of 30

    In a two-proportion conversion test, which change most directly explains why detecting a 2% relative lift requires roughly 390k users per variant instead of 63k for a 5% relative lift?

    Show the answer

    Answer: a · The absolute MDE shrinks from 0.5 to 0.2 percentage points, and sample size scales roughly with the inverse square of the absolute effect size.

    The correct answer identifies that the absolute MDE falls from 0.5 to 0.2 percentage points, and because N is roughly proportional to the inverse square of the absolute MDE, required sample size balloons by about sixfold. Distractor D is tempting because it quotes the true p(1-p) variance formula from the card, but in this range variance barely changes and cannot explain the explosion in sample size.

    Read the full bite: How do you determine sample size for a conversion lift experiment?

  28. Question 28 of 30

    Under what condition does MAP estimation give essentially the same result as MLE?

    Show the answer

    Answer: a · When the prior is uniform or the dataset is very large

    A uniform prior makes the posterior proportional to the likelihood, and with large data the likelihood overwhelms any prior, so MAP converges to MLE. A strong prior on small data does the opposite.

    Read the full bite: MLE versus MAP estimation and the role of priors

  29. Question 29 of 30

    You need to combine customers and transactions on customer_id to compute total spend per customer, including those with zero transactions. Which approach correctly uses pandas?

    Show the answer

    Answer: b · Use pd.merge with how='left' on customer_id, then group by customer, sum amounts, and fill NaN totals with zero

    A left join preserves every customer and shows NaN for missing transactions, which you fill with zero after grouping; an inner join is tempting because it is the pandas default, but it silently drops customers with no matching transactions.

    Read the full bite: How would you combine customer and transaction DataFrames and describe join types?

  30. Question 30 of 30

    When squaring a million-element NumPy array, why is np.square(arr) orders of magnitude faster than a Python for-loop?

    Show the answer

    Answer: b · It delegates to pre-compiled C loops on contiguous memory, avoiding Python interpreter overhead per element.

    NumPy vectorization dispatches operations to C ufuncs on contiguous buffers, eliminating per-element Python interpreter dispatch and object boxing. The most tempting distractor confuses vectorization with parallel processing, yet the card explicitly states that standard NumPy vectorization is single-threaded unless an external multithreaded library is used.

    Read the full bite: What is vectorization in NumPy and pandas?

Could you explain these out loud?

That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon