Free AI, ML & Data Science interview questions

150 questions from the AIMLPrep bank, free to read, each with the correct answer and a detailed explanation of the reasoning and the common traps. They cover the topics interviewers ask about for data scientist, ML engineer and AI engineer roles. To practice them as a quiz with progress tracking, or to unlock all 4,000 questions, start free or see the plans.

Probability & Math interview questions

  1. An image-augmentation step applies a 2 × 2 linear map M to pixel coordinates. The plot shows the unit square (dashed) and its image under M (solid), with the…medium
  2. The table shows a telecom operator's customer mix and the average monthly revenue per user (ARPU) in each segment. What is the expected monthly revenue of a…easy
  3. How many times is an SVC model fitted in total when this grid search runs?medium
  4. An LLM routing service samples one of three candidate reply types from logits with the snippet below, at temperature T = 0.5. Up to simulation noise, what…hard
  5. A labelling vendor's error rate is either 2% (prior 0.7) or 10% (prior 0.3). You audit two batches of 10 independent labels: the first has 1 error, the second…medium
  6. A bank fine-tunes a multilingual support assistant on a corpus that is 90% English and 10% Turkish by tokens. Following common multilingual practice, it…medium
  7. A churn network maps four features x ∈ ℝ⁴ through a = W₁x + b₁ (W₁ is 3 × 4), h = ReLU(a) and z = W₂h + b₂ (W₂ is 2 × 3). Writing the Jacobian with entry (i,…easy
  8. Each week a loyalty-app user is either Engaged or Idle. An Engaged user becomes Idle the next week with probability 0.10, and an Idle user becomes Engaged…easy
  9. In RLHF you need the gradient of J(θ) = E[R(y)], where y is a token sequence sampled from the policy LLM π_θ and R is a reward model's score treated as a…hard
  10. What is the difference between independent events and mutually exclusive events?basic
  11. What is the dot product of the vectors [1, 2, 3] and [4, 5, 6]?basic
  12. In the gradient descent update θ ← θ − η∇L(θ), what is the role of the learning rate η?basic

Statistics interview questions

  1. To stress-test a ratio metric, a data scientist simulates 10,000 draws of the ratio of two independent standard normal noise terms (a standard Cauchy…hard
  2. before and after hold the weekly spend of the same 40 customers before and after a loyalty-tier change, in the same customer order. What does this ttest_ind…easy
  3. A pricing team fits the demand model below on weekly store data. How should the coefficient on ln(price) be interpreted?medium
  4. Two analysts plot kernel density estimates (KDEs) of the same 5,000 basket values from a grocery chain, one with a bandwidth of 10 € and one with 2 €. The two…medium
  5. A telecom emails a satisfaction survey to a random sample of the customers who have an email address on file (about 70% of all customers). About 12% respond,…easy
  6. A product team wants to correlate customers' satisfaction rating (1–5 stars) with their number of support contacts last quarter. What are the requirements for…easy
  7. Crashes on an inference cluster are modelled as a Poisson process, so the 50 observed times between crashes are i.i.d. exponential with rate λ. Their mean is…medium
  8. An A/B test of a new recommendation widget gives a two-sided p = 0.03 (z ≈ 2.17). Suppose the true effect exactly equals the observed estimate, and you rerun…hard
  9. A streaming service checks how well a user's recommendation list matches their taste. The user's viewing history p splits drama / comedy / documentary as 0.5…hard
  10. Two trained fraud models are scored on the same 5,000-transaction test set: AUC 0.912 for the gradient-boosted model and 0.904 for the logistic model. You…medium
  11. A bank's prior for the mean monthly card spend μ of a new customer segment, based on similar segments, is μ ~ N(400, 20²) €. A pilot with 64 customers gives a…medium
  12. Which measure of central tendency is more robust to outliers, the mean or the median, and why?basic
  13. Which statement about the normal distribution is correct?basic
  14. What does the central limit theorem (CLT) state?basic
  15. What is the correct definition of a p-value?basic
  16. When is a one-sample t-test the appropriate test?basic
  17. What is the correct interpretation of a 95% confidence interval for a population mean?basic
  18. What does Spearman's rank correlation coefficient measure?basic
  19. Which set of conditions is the standard list of assumptions behind classical linear regression inference?basic
  20. In information theory, what does the Shannon entropy H(X) of a discrete random variable measure?basic
  21. What is the difference between descriptive and inferential statistics?basic

Data Science interview questions

  1. An inventory agent asks an LLM for a JSON reorder decision and passes the fields to a typed helper. This time the model returned units as a string. What…medium
  2. The chart plots weekly active users of a new GenAI app on a log scale (the y-axis shows log10 of users). How should the change after week 10 be interpreted?medium
  3. A test ran at 10% treatment on Friday and was ramped to 50% for the weekend. Treatment converts better within each period but worse when the data are pooled…hard
  4. In PostgreSQL, converted is an INTEGER column holding 0 or 1. This daily conversion-rate query shows 0 for almost every day, and 1 only on days where every…easy
  5. A retailer's marketing mix model (MMM) transforms weekly TV spend with geometric adstock aₜ = xₜ + λ·aₜ₋₁, with λ = 0.6 and a₀ = 0, and then passes the…hard
  6. A telecom's plan names are s = pd.Series(["Max+ 10GB", "Max 20GB", None, "Mini 5GB"]). What do print(s.str.contains("Max+", na=False).sum()) and…medium
  7. A retailer exports product reviews to CSV with the columns review_id, product_id, rating, review_text, created_at and loads them into a staging table that…easy
  8. A loyalty system stores points as pts = np.array([1201, 350, 85], dtype=np.int64). For a 1.5× points campaign, a notebook runs boosted = pts 1.5 and then pts…medium
  9. A bank automatically offers a premium card to customers with an internal score of 700 or higher. You compare customers just above and just below 700 to…medium
  10. An online grocer's eight baskets in a pilot region have values 12, 15, 18, 22, 30, 41, 55 and 1,007. In PostgreSQL, what do PERCENTILE_CONT(0.5) WITHIN GROUP…medium
  11. What is an A/B test (an online controlled experiment)?basic
  12. In product analytics, what is meant by a north star metric?basic
  13. In a query that uses GROUP BY, how does the WHERE clause differ from the HAVING clause?basic
  14. In Python, what is the main difference between a list and a tuple?basic

Preprocessing & Feature Engineering interview questions

  1. A temperature sensor produced 20 readings: 17 between 48 and 52, plus 99, 100 and 101. The table shows their summary statistics. A rule that flags z > 3 using…hard
  2. A colleague reports a cross-validated AUC of 0.91 with this code on 200 customers and 10,000 features. As a sanity check you rerun it with randomly permuted…hard
  3. For an offline consumption report (not a forecasting feature), an analyst fills gaps in a building's daily energy readings. The readings were logged on…medium
  4. A card-fraud dataset was extracted on 30 June. A transaction's label is 1 if a chargeback had arrived by the extraction date, and chargebacks can arrive up to…medium
  5. A retailer's click model has 200M impressions, 2M of them clicks. To cut training cost, you keep every click and 1 in 10 non-clicks, and give each kept…medium
  6. A bank vectorizes 2 million support tickets with TF-IDF over a 500,000-term vocabulary; the sparse matrix has about 100 non-zeros per row (≈ 2.4 GB in CSR…medium
  7. A retailer's store_id has 1,000 levels. Instead of one-hot encoding, a colleague proposes binary encoding: give each store an integer code and write that code…easy
  8. Your features include age (years), income (TRY) and num_logins (count), on very different scales. For which group of models is feature scaling generally…easy
  9. A gradient-boosted house-price model for Istanbul uses raw latitude and longitude as features. Prices are highest around a few prime districts and along the…easy
  10. How do MCAR, MAR and MNAR differ in what the probability of a value being missing depends on?basic
  11. What does one-hot encoding do to a categorical feature such as color with the values red, green and blue?basic
  12. In model training and evaluation, what does the term data leakage mean?basic
  13. What is a main reason to perform feature selection before training a model?basic

Machine Learning interview questions

  1. Both series below rise at a similar average rate. Series A was generated as a linear trend plus stationary noise; Series B is a random walk with drift. Which…medium
  2. A churn model produced this confusion matrix on 10,000 customers, and a manager celebrates its 98.8% accuracy. What is the model's balanced accuracy, and what…easy
  3. For the query "waterproof hiking boots", assessors graded four products as relevant: Boot-X (3), Boot-Y (3), Boot-Z (2) and Sock-K (1); every other product is…hard
  4. A gradient-boosted tree model was trained on months 1–36 of demand, using month_index as a feature. Its forecast for months 37–48 is the flat line in the…hard
  5. A telecom churn model (3% churners) is evaluated with the code below and reports a mean CV recall of 0.99. On customers that were set aside before any…medium
  6. An insurer has 3,000 claims confirmed as fraud and 120,000 claims nobody has investigated. A calibrated classifier trained to separate confirmed (s = 1) from…hard
  7. A helpdesk routes tickets with a KNN classifier using Euclidean distance on TF-IDF vectors built with norm=None (no length normalisation). Tickets range from…medium
  8. For a declined credit-card application, an Anchors explainer returns the rule IF utilization > 0.80 AND missed_payments_12m ≥ 2 THEN decline, with precision…medium
  9. A payments company's fraud team reports F1 and ROC-AUC, yet trains its classifier with gradient descent on log loss. A product manager asks: "Why not minimise…easy
  10. A food-delivery app ranks restaurants with a Wide & Deep model: the wide part is a linear model on crossed features such as user_last_cuisine ×…medium
  11. A telecom wants k = 20 segments for 50 million subscribers described by 40 numeric features stored as float64. Full-batch k-means (Lloyd's algorithm)…medium
  12. An e-commerce team trains pricing agents in a simulator and keeps a large buffer of transitions collected by older versions of its policies. Which grouping of…easy
  13. A telecom team tunes a churn network with successive halving: 81 configurations, a minimum budget of 1 epoch, a maximum of 81 epochs and η = 3 (keep the best…easy
  14. What is the difference between model parameters and hyperparameters?basic
  15. What does the bias–variance trade-off describe?basic
  16. What does the mean squared error cost J(w) = (1/n) Σ (yᵢ − ŷᵢ)² measure for a linear regression model?basic
  17. What does the Gini impurity of a decision-tree node measure?basic
  18. Which statement correctly contrasts bagging and boosting?basic
  19. What is the "naive" assumption in Naive Bayes?basic
  20. Which description matches the standard k-means (Lloyd's) algorithm?basic
  21. What does precision measure for a binary classifier?basic
  22. How does k-fold cross-validation work?basic
  23. How does grid search look for good hyperparameters?basic
  24. What is the difference between batch gradient descent and stochastic gradient descent (SGD)?basic
  25. In reinforcement learning vocabulary, what is the reward?basic

Deep Learning interview questions

  1. Two system outputs are scored against a single reference in the table. Which interpretation of the scores is correct?medium
  2. A telecom's search-box autocomplete uses a bigram language model with add-one (Laplace) smoothing, P(w prev) = (c(prev, w) + 1) / (c(prev) + V). The table…medium
  3. The table shows how two tokenizers split the same text. What do the ## and Ġ markers mean?medium
  4. A retailer wants to cut the mobile-app download size of a product-image classifier (dense top-1 76.1%) by pruning it and shipping the weights in a compressed…medium
  5. A retailer's Stable Diffusion 1.5 pipeline uses classifier-free guidance, ε̂ = ε_uncond + w·(ε_cond − ε_uncond), with w = 7.5. For one latent element at one…medium
  6. An LLM interpretability team trains a sparse autoencoder (SAE) on residual-stream activations of size 4,096, with a 65,536-unit ReLU code layer and an L1…easy
  7. As an ablation, you delete every self-attention sublayer from a trained BERT-style encoder but keep the token and position embeddings, the feed-forward (FFN)…easy
  8. A grocery chain trains a CNN to grade bananas on a conveyor belt as unripe, ripe or overripe from camera images. Which augmentation is most likely to hurt the…easy
  9. In a deep MLP with sigmoid activations, the error signal reaching the first layer's weights has passed through ten sigmoid derivatives. Ignoring the weight…hard
  10. A teammate multiplies a recommender's training loss by 100 so the dashboard shows larger numbers. For one weight the gradient has been steady at g = 0.004 per…hard
  11. In neural network training, what is an epoch?basic
  12. What is the ReLU activation, and why is it a popular default for hidden layers?basic
  13. In neural network training, what is backpropagation?basic
  14. What does dropout do while a neural network is being trained?basic
  15. What does a 2-D convolutional layer compute at each output position?basic
  16. In a vanilla recurrent neural network, what is the hidden state?basic
  17. What is the core idea of an attention mechanism in a neural network?basic
  18. Which statement best defines transfer learning?basic

Generative AI interview questions

  1. Asked for "revenue and number of orders that contain electronics, by customer segment", a text-to-SQL bot generated the query below. The Gold segment has…medium
  2. The table shows the next-token distribution at one decoding step for the context "The customer wants to ___". With top-p = 0.9 (nucleus sampling, no top-k),…medium
  3. A team reports that a new prompt raised RAGAS faithfulness on a 300-question set from 0.81 to 0.86: the old score is from last month, the new one was computed…hard
  4. A loan pre-screening step uses the schema below with constrained decoding, which emits properties in schema order. Reviewers find that reasoning usually…easy
  5. The flow shows one generation step of a decoder-only LLM (GPT- or Llama-style). What happens at the highlighted step?easy
  6. From the same logits, a teacher LLM gives these next-token probabilities after "I want to ___ my subscription" (restricted to five candidate tokens): cancel…hard
  7. A retail client wants a customer-facing assistant over ~5,000 public help-center pages and product PDFs, live in six weeks, with a team of two engineers.…medium
  8. To save tokens, a bank adds an LLM extractor after retrieval that keeps only the sentences relevant to the question from each of the top 8 chunks. Context…hard
  9. A telecom's support assistant has no reference answers for live traffic, so the team wants implicit signals as quality proxies: the user rephrases the…medium
  10. A retailer trained a LoRA adapter on acme-8b (the base model). The serving team loads it onto acme-8b-instruct, which has the same architecture. It loads…easy
  11. Which statement about the HNSW parameters M, efConstruction and efSearch is correct?medium
  12. An e-commerce team writes product descriptions with a prompt that includes three example descriptions, all for one brand's running shoes. New descriptions for…easy
  13. What is a large language model (LLM)?basic
  14. What is the difference between zero-shot and few-shot prompting?basic
  15. What is retrieval-augmented generation (RAG)?basic
  16. What does it mean to fine-tune a pretrained LLM?basic
  17. A chatbot's conversation history is growing longer than the model's context window. What is a common way to handle it?basic

Agentic AI interview questions

  1. During an outage, a retailer's inventory API answers every request with HTTP 503. The shopping assistant reaches it through the three layers below; assume the…hard
  2. After one chat, a grocery-delivery assistant's memory extractor proposed the candidate long-term memories below. Which write policy keeps later recall precise?medium
  3. Trace mining of 50,000 runs of a telecom billing-support agent gives the tool paths below. The team will hard-code the three most frequent paths as…hard
  4. What control flow does this LangGraph graph implement?easy
  5. A retail client wants to benchmark a customer-service agent that must follow a written returns policy, call order-management APIs and handle multi-turn…easy
  6. You are building an MCP server for a retailer's merchandising team. (1) summarize_reviews needs an LLM to condense 500 reviews, but the server must not hold…medium
  7. A telecom network-diagnosis orchestrator fans out to 8 sub-agents in parallel (one per system: radio network, core, billing, …) and waits for all of them…easy
  8. A bank's document pipeline in Google's Agent Development Kit (ADK) must always run extract → validate → summarise, in that order. It is built as an LlmAgent…medium
  9. A bank moves its claims-triage planner from a general chat model to a reasoning model. The old prompt says "Think step by step", lists a fixed 10-step script…medium
  10. In LLM applications, what is an AI agent?basic
  11. Why do long-running agents checkpoint (persist) their state after each step?basic

AI Safety & Security interview questions

  1. A retailer's shopping app calls the LLM provider directly from the client with the code below; the key is injected from an environment variable at build time.…easy
  2. A consultancy's responsible-AI board reviews the five incidents below. Which mapping to harm types (allocation, quality of service, stereotyping, denigration,…medium
  3. In this enterprise RAG pipeline, users must never receive content from documents they are not permitted to read. Where should that rule primarily be enforced?medium
  4. Five banks plan to train a shared fraud model with federated learning: each bank trains on its own transactions and sends only model updates to a coordinating…medium
  5. An e-commerce company has trained a new jailbreak classifier for its shopping assistant. It scored well on an offline labelled set, but the team worries it…easy
  6. A bank's research agent answers each analyst question from k = 20 retrieved web chunks and produces 500,000 answers a month. Assume 1% of retrieved chunks…hard
  7. An open-weight general-purpose AI (GPAI) model was trained with 6 × 10²⁴ FLOP, as its developer documents. A telecom LoRA-fine-tunes it with 2 × 10²⁰ FLOP and…hard
  8. A retail assistant's release gate is a 2,000-prompt single-turn jailbreak suite plus a classifier that scores each user message on its own. A red-teamer asks…medium
  9. What is prompt injection in an LLM application?basic

MLOps & Production interview questions

  1. An 8B support model (≈ 16 GB of BF16 weights) is served with a vLLM-style engine as shown below. At peak, the time per output token (TPOT) spikes and the…hard
  2. Re-running the training job below from the same git commit one month later gives a validation AUC of 0.861 instead of the logged 0.874. The library versions,…medium
  3. Estimate the monthly LLM bill for this RAG chatbot workload. Every user turn is a separate API call that re-sends the full prompt.medium
  4. What does this symmetric INT8 quantization snippet print, and which statement about using an asymmetric (zero-point) scheme for ReLU outputs is correct?medium
  5. A telecom team adds a new feature, dropped_calls_7d, produced by a streaming job from network events starting today. To train on 18 months of history, past…hard
  6. A retailer's progressive-delivery pipeline shifts traffic to a new recommendation-API version in steps of 5% → 25% → 50% → 100%. At each step, automated…medium
  7. A telecom support bot on a self-hosted vLLM server sends a 3,000-token system prompt plus the growing chat history on every turn. After you enable automatic…easy
  8. A security review of a retail client's Google Cloud project finds that the Vertex AI training pipeline, a GKE scoring service and a nightly export job all run…easy
  9. On a GKE cluster you deploy a model server as a Deployment with 3 replicas and expose it with a Service. Which statement correctly describes these Kubernetes…easy
  10. Which statement best defines MLOps?basic