Top 30 Intermediate Data Science & Analytics Interview Questions and Answers
30 intermediate multiple-choice Data Science & Analytics interview questions, past the definitions: how the pieces fit together, what breaks in practice, and the trade-off behind a choice. They come from 30 bites in the Data Science & Analytics library, the middle slice of the 135 Data Science & Analytics interview questions in the 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. Nothing is saved, and no XP or streak is earned here. The app keeps score.
Question 1 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?
Question 2 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?
Question 3 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.
Question 4 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
Question 5 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.
Question 6 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?
Question 7 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
Question 8 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.
Question 9 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?
Question 10 of 30
Which single expression best computes total and average Sales_Amount per Region in pandas?
Show the answer
Answer: b · Select Sales_Amount after groupby and use agg with named aggregations
Selecting the column and using named aggregation computes both statistics in a single vectorized pass with clean column names. Option C is a common anti-pattern that runs two separate groupby passes and requires manual merging, which is slower and harder to maintain.
Read the full bite: Calculate total and average sales per region in pandas
Question 11 of 30
Which code correctly and efficiently extracts weekday names like 'Monday' from a pandas DataFrame column of timestamp strings?
Show the answer
Answer: b · pd.to_datetime(df['ts']).dt.day_name()
pd.to_datetime vectorizes parsing to datetime64 without Python loops, and the .dt accessor exposes day_name(); wrapping conversion in apply processes rows one by one and destroys performance, while calling day_name directly on a string or Series raises an AttributeError.
Read the full bite: Convert string timestamps to datetime and extract day of week
Question 12 of 30
Which client-side strategy best maximizes throughput for a 100 req/min API without triggering excessive 429 errors?
Show the answer
Answer: b · Bound concurrency to a small worker pool, proactively pace requests using rate-limit headers, and apply exponential backoff with jitter on 429s.
The correct answer combines proactive throttling, header-aware dynamic pacing, bounded concurrency, and resilient retries as described in the card. Option A is tempting because it limits concurrency, but it still creates burst traffic and ignores headers, relying on the server to punish the client rather than preventing 429s proactively.
Read the full bite: Design a rate-limited REST API data collection script
Question 13 of 30
When scraping a React site where the initial HTML lacks the target data, which tool and technique combination is most reliable?
Show the answer
Answer: d · Playwright using an explicit wait for the target element to appear in the rendered DOM
Dynamic JavaScript frameworks inject content after the initial document loads, so only a real browser engine with an explicit wait can reliably capture it. While Selenium is a valid browser tool, using a fixed sleep makes the scraper slow and flaky under variable network conditions rather than waiting for the element to actually appear.
Read the full bite: How would you scrape a page with dynamically loaded JavaScript content?
Question 14 of 30
When designing a pipeline to ingest millions of semi-structured mobile events per second, why is NoSQL typically chosen for the initial landing zone?
Show the answer
Answer: d · It allows schema flexibility and horizontal write scaling without blocking ingestion during field additions.
NoSQL is preferred because document stores handle new fields instantly and scale writes horizontally, avoiding the locking migrations a relational schema would require. The tempting ACID distractor is wrong because immutable append-only event logs do not need multi-row transactions at ingestion time.
Read the full bite: SQL or NoSQL for high-volume semi-structured event ingestion?
Question 15 of 30
A Python daemon runs nightly without user interaction to pull API data on its own behalf. Which OAuth 2.0 approach should it use to obtain an access token?
Show the answer
Answer: b · Use the client credentials grant, authenticating directly to the token endpoint with its client_id and client_secret.
A daemon acting on its own behalf should use the client credentials grant and authenticate directly to the token endpoint with its client_id and client_secret. The authorization code flow with a stored refresh token is designed for scripts acting on behalf of a user, not for non-interactive service-to-service calls.
Read the full bite: Implement OAuth 2.0 flow to get an access token for API requests
Question 16 of 30
When you fit a StandardScaler on the full dataset before cross-validation, what is the specific leakage problem?
Show the answer
Answer: c · Validation fold statistics influence the training phase through the global mean and standard deviation
Fitting the scaler on the entire dataset incorporates validation fold statistics into the global mean and standard deviation, constituting feature leakage. Distractor C describes target leakage, which involves the target variable, whereas the card emphasizes feature leakage through preprocessing steps like scaling.
Read the full bite: What is data leakage in preprocessing and cross-validation?
Question 17 of 30
A decision tree's split on a feature remains unchanged if that feature is multiplied by 100 because...
Show the answer
Answer: b · Information gain and Gini impurity depend only on the relative ordering of feature values, not their absolute scale
Decision trees split based on rank order, so rescaling a feature leaves information gain and Gini impurity unchanged. The distractor about Euclidean distances confuses combinatorial tree splitting with the geometric distance objectives that make scaling critical for SVMs and K-Means.
Read the full bite: Why is scaling unnecessary for trees but critical for SVM or K-Means?
Question 18 of 30
Which practice best ensures safe recovery from a mid-job crash in an idempotent daily batch pipeline loading API data into a partitioned data lake?
Show the answer
Answer: a · Use an idempotency key per partition, checkpoint progress, and atomically overwrite only failed partitions on retry
Checkpointing and atomic overwrites let retries resume exactly where they left off without corrupting data or exposing partial states. Deleting the partition first seems clean but creates a window where downstream consumers see missing data.
Read the full bite: What is data pipeline idempotency and how do you design for it?
Question 19 of 30
Analysts query an events table with date-range filters and event_type filters. Which layout best minimizes bytes scanned?
Show the answer
Answer: b · Partition by event_date and cluster by event_type and user_id
Partitioning by event_date prunes irrelevant time ranges, while clustering by event_type and user_id speeds up filters within each day. Partitioning by user_id is a classic anti-pattern that explodes metadata with millions of tiny partitions and does not help time-based queries.
Read the full bite: How would you partition a massive user events table?
Question 20 of 30
Which pairing best illustrates when streaming is genuinely justified over batch, alongside a critical infrastructure challenge that arises specifically in streaming?
Show the answer
Answer: c · Fraud detection during payment authorization; managing backpressure during traffic spikes
Fraud detection requires sub-minute reaction time that batch cannot provide, and backpressure is a core operational challenge specific to streaming. Distractor D correctly identifies a low-latency use case but incorrectly assumes streaming pipelines have nightly downtime windows, whereas they actually impose a 24/7 operational burden with no batch-style maintenance window.
Read the full bite: When is streaming better than batch, and what are its infrastructure challenges?
Question 21 of 30
You detect a multivariate outlier formed by a rare feature combination. What is the appropriate first step before choosing whether to keep or remove it?
Show the answer
Answer: b · Investigate whether it results from measurement error or a legitimate extreme event
The card emphasizes starting with a root-cause check to distinguish errors from legitimate extremes before any removal or modeling decision. Sensitivity analysis is reserved for highly influential points only after this initial investigation, making it the most tempting distractor because it is valid but premature as a first response.
Read the full bite: How do you detect and handle outliers in multivariate datasets?
Question 22 of 30
You standardize 100 numerical features and find PCA's first two components capture 90% of variance with visually distinct clusters. What is the most appropriate next step?
Show the answer
Answer: b · Rely primarily on PCA for visualization, as t-SNE adds little value when clusters are linearly separable with high variance capture.
When PCA captures most variance and reveals clear clusters, the structure is globally linear, so t-SNE is unnecessary and can mislead. Option D is tempting but wrong because it assumes PCA's linear projection is insufficient and falsely requires t-SNE validation, losing the global variance context.
Read the full bite: How do you visualize clusters in 100-dimensional numerical data?
Question 23 of 30
EDA reveals a U-shaped relationship between user_age and monthly_spend. Which approach best enables a linear regression to capture this pattern?
Show the answer
Answer: d · Introduce an age-squared term or spline expansion
A linear model needs explicit non-linear terms such as age-squared or splines to fit a direction-reversing U-shape. Centering age alone cannot create curvature; it only helps reduce multicollinearity after the squared term is added.
Read the full bite: How does a U-shaped EDA pattern influence feature engineering?
Question 24 of 30
How do L2 regularization and shallow trees affect the bias-variance tradeoff according to the decomposition?
Show the answer
Answer: b · They lower variance by accepting slightly higher bias to constrain model behavior.
Regularization and depth limits constrain the hypothesis space, which reduces variance by preventing memorization of training noise while slightly increasing bias from missed interactions. The distractor describing coefficient shrinkage as bias reduction is wrong because these techniques intentionally increase bias to lower variance, not the other way around.
Read the full bite: Explain bias-variance tradeoff and how regularization or tree depth manage it
Question 25 of 30
When encoding a nominal categorical feature for logistic regression versus LightGBM, what is the key mechanical difference driving the choice?
Show the answer
Answer: a · Logistic regression learns weights that imply direction and magnitude across a continuous space, so one-hot encoding is needed to avoid false ordinality.
Logistic regression computes dot products in a continuous input space where numeric distance between codes would falsely imply order and magnitude, making one-hot encoding necessary for nominal variables. Option C is a common red flag because LightGBM does not mandate ordinal encoding for every categorical feature and also offers native categorical support.
Question 26 of 30
What is the key reason gradient boosting can overfit more easily than a random forest?
Show the answer
Answer: a · It sequentially fits each tree to the prior ensemble's residual errors
Boosting fits trees sequentially to remaining errors, so without regularization it can chase noise and overfit. A random forest averages independent trees, which reduces variance rather than aggressively fitting residuals.
Question 27 of 30
What is the main reason k-fold cross-validation is more robust than a single train-test split for estimating generalization performance?
Show the answer
Answer: b · It averages multiple performance scores from different partitions, lowering estimate variance while using all data for both training and testing.
Cross-validation reduces variance in the performance estimate by averaging scores across k rotations where every observation serves in both training and validation. It does not create a single final model trained on all folds—its purpose is evaluation, not producing a production estimator.
Read the full bite: What is cross-validation and why is it more robust than a holdout split?
Question 28 of 30
You run a 30-day A/B test and peek daily, stopping early if p < 0.05. What is the principal statistical issue?
Show the answer
Answer: b · The overall false positive rate inflates because each look gives random noise another chance to appear significant
Peeking gives random noise multiple chances to cross the significance threshold, compounding the false positive rate far above the nominal 5% level. Distractor D is tempting but wrong because a 5% alpha is only valid for a single pre-specified analysis, not for repeated uncorrected looks.
Read the full bite: Why not stop an A/B test when it looks significant early?
Question 29 of 30
When testing a social-network feature, why is cluster randomization along the social graph preferred over geographic clustering?
Show the answer
Answer: b · Geography rarely maps to the interference mechanism, so cross-border spillover remains high
Social-graph clustering is preferred because geographic borders rarely capture the peer-to-peer edges that carry spillover, leaving control users contaminated. The intuition that friends live nearby is unreliable on global platforms, and graph clustering still does not eliminate all cross-cluster interference.
Read the full bite: How do network effects violate A/B tests and how to mitigate them?
Question 30 of 30
Why does heavy skew from whale users reduce the power of a standard t-test on revenue per user?
Show the answer
Answer: d · It inflates variance, widening the standard error and confidence interval
Extreme values raise the metric's variance, which enlarges the standard error and confidence interval, so real effects are harder to detect. It does not bias randomized assignment, which stays balanced in expectation.
Read the full bite: Analyzing skewed revenue-per-user experiments
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.