Top 30 AI & ML Interview Questions and Answers
30 multiple-choice questions on AI & ML, of the kind that come up in a technical interview, drawn from 30 bites in the AI & ML 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.
Artificial intelligence, machine learning, and data science
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
Why does replacing sigmoid with ReLU in a deep network reduce vanishing gradients?
Show the answer
Answer: c · ReLU has a derivative of 1 for positive inputs, so it does not shrink gradients there
ReLU's unit derivative in its active region avoids the sub-one multiplications that cause sigmoid's gradients to vanish across depth. ReLU is unbounded above, does not normalize, and does not amplify gradients beyond one.
Question 2 of 30
Why is HSV often preferred over RGB for segmenting a colored object across a scene with mixed sunlight and shadow?
Show the answer
Answer: b · Hue stays relatively stable under lighting changes, so color separates from brightness
HSV isolates hue from value, so a color keeps its hue under varying illumination, easing thresholding. Both spaces cover the same color gamut, so the capacity claim is false.
Question 3 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
The card defines a strong framework as linking DAU/MAU, adoption, retention, and stickiness to trial conversion and churn. Tracking total page views is a red-flag vanity metric because it is untied to those outcomes.
Read the full bite: What metrics track e-commerce user engagement and how do you prioritize them?
Question 4 of 30
How should a healthy production ML lifecycle be structured from start to finish?
Show the answer
Answer: c · As an iterative loop starting with business problem framing and continuing through post-deployment monitoring
The correct answer is B because the card describes the lifecycle as an end-to-end engineering process that begins with business goal definition and requires continuous monitoring and feedback loops after deployment. The most tempting distractor is D because treating packaging as the final step omits critical monitoring, retraining, and validation stages that keep a production model healthy.
Read the full bite: Describe the key stages of a typical ML lifecycle
Question 5 of 30
Which property of one-hot vectors prevents a model from inferring that 'excellent' and 'outstanding' are similar?
Show the answer
Answer: a · They are mutually orthogonal, giving every pair zero cosine similarity
One-hot vectors are orthogonal by design, so every pair has zero cosine similarity and shares no geometric structure, meaning the model receives no hint that excellent and outstanding are related. Distractor A mistakes a practical symptom (huge size) for the root representational limitation.
Question 6 of 30
A photography platform archives original images for future editing and serves compressed previews. Which strategy best preserves fidelity while optimizing delivery?
Show the answer
Answer: d · Store originals in a lossless format and serve previews as lossy JPEG to reduce bandwidth.
Lossless storage preserves bit-exact originals for future editing and avoids generational degradation, while lossy JPEG cuts preview sizes for faster web delivery. Option C is tempting because PNG guarantees exact pixels, but serving previews losslessly wastes bandwidth without perceptible quality gains over a well-compressed lossy image.
Read the full bite: What is the difference between lossy and lossless image compression?
Question 7 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?
Question 8 of 30
Which scenario would trigger an automated MLOps deployment but typically not a traditional DevOps pipeline?
Show the answer
Answer: b · Production monitoring detecting drift in input data distributions
The card states that MLOps deployments add triggers like data drift detection, unlike DevOps pipelines that react to code commits, dependency patches, or infrastructure changes. The GPU driver update is a tempting distractor because a common misconception is that MLOps is simply DevOps plus GPUs.
Read the full bite: What are the primary differences between traditional DevOps and MLOps?
Question 9 of 30
Which statement best describes how histogram equalization remaps grayscale intensities?
Show the answer
Answer: d · It applies the cumulative distribution function to redistribute intensities toward a uniform histogram.
Histogram equalization uses the cumulative distribution function of the original histogram to remap intensities so the output approximates a uniform distribution, maximizing global contrast. The first option describes linear contrast stretching, which merely rescales the minimum and maximum values without considering the frequency of each intensity level.
Read the full bite: Describe a grayscale histogram and its use in exposure and equalization
Question 10 of 30
When training a large transformer, training loss falls while validation loss rises. Which action most directly addresses the root cause?
Show the answer
Answer: b · Apply early stopping or add regularization like weight decay
The divergence signals overfitting, where the model memorizes training noise instead of generalizable patterns. Early stopping and regularization directly combat this, whereas longer training or more parameters typically worsens the gap, and a lower learning rate does not directly fix memorization.
Read the full bite: Validation loss increases while training loss decreases: what is this?
Question 11 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 12 of 30
A deployed fraud model degrades. Using immutable lineage best practices, what is the most reliable way to isolate data drift from a code bug?
Show the answer
Answer: a · Reproduce the exact training run by combining the manifest's commit SHA, dataset hash, and locked dependencies, then verify the metrics match production logs
Reproducing the full training context from the manifest proves the model still yields the same metrics, confirming that production degradation is due to data drift rather than a code bug. Option B is tempting because it uses the exact dataset, but swapping in the latest code introduces a new variable and breaks the lineage chain needed for a valid comparison.
Read the full bite: Why version code, data, and models in MLOps?
Question 13 of 30
How are the intrinsic parameters fx and fy in K derived from physical camera properties?
Show the answer
Answer: a · They equal the focal length divided by pixel width and height respectively
fx and fy convert the physical focal length into pixel units by dividing by pixel width and height, making C correct. A is a common misconception because K stores focal length in pixel units, not millimeters, and D is wrong since distortion is modeled outside the idealized pinhole matrix.
Read the full bite: Explain the pinhole camera model and intrinsic matrix K
Question 14 of 30
An e-commerce company notices prediction accuracy dropping on a model whose serving code hasn't changed. What is the most appropriate first step in a mature MLOps setup?
Show the answer
Answer: a · Trigger the CT pipeline to validate data, train, evaluate against the champion, and promote if blessed
When model performance decays but serving code is unchanged, the CT pipeline should validate data, retrain, and evaluate before promotion. Option D is wrong because it bypasses evaluation gates and data validation, and B is wrong because models are separate deployable units from serving code.
Read the full bite: Explain ML pipelines and typical CI/CD/CT components
Question 15 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 16 of 30
In full BPTT, what is the primary reason memory usage grows linearly with sequence length T?
Show the answer
Answer: c · All intermediate hidden states from the forward pass must be kept for the backward pass.
During BPTT the backward pass flows through every time step, so every forward hidden state must be retained, yielding O(T) memory. Option D repeats the common misconception that training memory is constant like inference memory, while option A confuses unrolling with parameter duplication.
Read the full bite: Explain BPTT and its computational and memory challenges for long sequences
Question 17 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 18 of 30
Which event should trigger an automated CI/CD retraining pipeline rather than just an alert or manual review?
Show the answer
Answer: c · Sustained accuracy drop of 5% over a rolling window or business metric degradation past a predefined cost threshold
The card specifies that automated retraining launches on sustained accuracy drops of 5% or more or business metric degradation exceeding a cost threshold, whereas latency spikes and missing features should page an on-call engineer for infrastructure issues. Weekly manual reviews and overly sensitive single-hour drift alerts are red flags that signal immature operational practices.
Read the full bite: What production metrics and auto-thresholds trigger model retraining?
Question 19 of 30
During checkerboard calibration, why must you capture many images of the board at different orientations rather than a single frontal shot?
Show the answer
Answer: b · Varied views provide the geometric diversity needed to solve stably for intrinsics and distortion
Multiple poses constrain the parameter estimation enough to recover intrinsics and distortion coefficients reliably. One frontal view is degenerate and underdetermines the solution; it has nothing to do with resolution.
Question 20 of 30
What core limitation of a vanilla RNN encoder-decoder does the attention mechanism specifically address?
Show the answer
Answer: a · Compressing the entire input into one fixed-size vector loses detail on long sequences
Attention removes the single fixed-context-vector bottleneck by letting the decoder weight all encoder states per step. Parallelism and positional encodings are Transformer concerns, not what classic seq2seq attention was introduced to fix.
Read the full bite: Attention in Sequence-to-Sequence Models
Question 21 of 30
Why are positional encodings necessary before the first self-attention layer in a standard Transformer?
Show the answer
Answer: a · Because self-attention computes unordered pairwise dot products, leaving attention scores unchanged when tokens are permuted
Self-attention is permutation-invariant: swapping tokens does not change their dot-product attention scores, so the model receives no sequence-order signal without positional encodings. Distractor A represents the common misconception that feed-forward layers can learn implicit order, but they process each position independently and cannot recover shuffled order.
Read the full bite: Explain positional encodings in Transformers and their necessity
Question 22 of 30
When scoping an MLOps platform for a mid-sized company with 5-15 engineers, which approach best demonstrates mature build-vs-buy reasoning?
Show the answer
Answer: a · Prioritize data governance, feature store, model registry, CI/CD/CT, and monitoring before the serving layer; buy commodity tools like orchestration and monitoring while investing engineering effort only in proprietary feature engineering and model architectures.
This option correctly sequences foundational components before serving and applies the buy-commodity, build-differentiator rule. Option C is tempting because avoiding vendor lock-in feels engineering-savvy, but maintaining a custom feature store and registry would consume two to three full-time engineers and ignores total cost of ownership.
Question 23 of 30
Why is demosaicing necessary after a Bayer sensor captures an image?
Show the answer
Answer: a · Because each photosite records only one color channel, leaving missing values to estimate.
Demosaicing is required because every photosite measures only a single color channel, so the missing two channels must be interpolated from neighbors. Option D represents the common misconception that Bayer pixels already contain complete RGB data.
Read the full bite: How does a Bayer filter capture color and what is demosaicing?
Question 24 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?
Question 25 of 30
Beyond modeling long-range dependencies, what key training advantage does self-attention have over an LSTM?
Show the answer
Answer: c · It can process all sequence positions in parallel rather than step by step
Self-attention computes all token interactions simultaneously, enabling parallel training that sequential LSTMs cannot match. It actually needs added positional encodings and is quadratic, not cheaper, in sequence length.
Read the full bite: Self-Attention versus Recurrent Architectures
Question 26 of 30
Which promotion flow best reflects a robust automated testing strategy for a weekly retrained production model?
Show the answer
Answer: a · Offline per-slice thresholds and bias checks, data validation for training-serving skew and drift, shadow deployment comparing latency and prediction distributions, then canary gated on business metrics with automatic rollback
This option captures the four-layer strategy from the card: offline statistical validation, data validation, shadow deployment, and canary gated on business metrics with automatic rollback. Option D is the most tempting distractor because it uses correct terminology but reverses the order and incorrectly uses offline accuracy as the final promotion gate rather than live business metrics.
Read the full bite: Design a robust automated testing strategy for ML models before production
Question 27 of 30
Switching from RGB to YCbCr does not reduce uncompressed frame size, yet 4:2:0 YCbCr cuts bandwidth roughly in half. What best explains where the savings come from?
Show the answer
Answer: d · Separating luma from chroma allows chroma planes to be stored at lower spatial resolution because human eyes have lower color spatial acuity.
The YCbCr transform is lossless and does not reduce uncompressed size; savings come from chroma subsampling, which exploits the human visual system's lower spatial resolution for color versus brightness. Distractor B is wrong because the transform does not inherently use fewer bits per pixel—it merely enables efficient subsampling and quantization.
Read the full bite: Compare YCbCr and RGB. Why chroma subsampling for compression?
Question 28 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
Question 29 of 30
Why does self-attention use three separate learned projections of the same input rather than the raw embeddings directly?
Show the answer
Answer: a · It allows the model to learn which token features to use for matching versus which to pass forward as content
The correct answer reflects that learned projections decouple the matching process from content retrieval, letting the model decide which aspects of a token to use for scoring and which to propagate forward. The distractor describing a decoder query with encoder key and value defines cross-attention, not self-attention, where all three matrices are derived from the same input sequence.
Read the full bite: Explain Q, K, and V matrices in self-attention
Question 30 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?
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.