An MLOps engineer takes models from notebooks to reliable production services and keeps them healthy. The work covers training pipelines, experiment tracking, model registries, CI/CD, containerised serving, monitoring for drift and latency, and controlling compute cost. Interviews test Python and software engineering, Docker and Kubernetes basics, deployment strategies like canary and shadow, data validation and how you handle production incidents and rollbacks.
Docker and Kubernetes CI/CD for ML pipelines Model registry and experiment tracking Monitoring and drift detection Python API development
Solved for this roleStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
✓ 3 questions free • Unlock the rest in seconds
01
What is DBSCAN and when is it better than K-means?
DBSCAN is a density-based clustering algorithm. It groups points that have at least min_samples neighbours within distance eps, and marks isolated points as noise. Unlike K-means, it does not need the number of clusters, finds clusters of any shape, and handles outliers. It struggles when clusters have very different densities and in high dimensions. It suits location data, like finding delivery hotspots from GPS points.
02
Pandas: find customers whose monthly spend increased for three consecutive months.
Raising the threshold improves precision but lowers recall. Fraud detection leans to recall, while spam filters often prefer precision; choose by the cost of each error.
04
Pandas: find the top 3 products by revenue in each region.
An optimisation method that updates weights in the opposite direction of the loss gradient. The learning rate sets the step size: too high and it diverges, too low and it is slow. Variants include SGD, mini-batch and Adam.
The ROC curve plots true positive rate against false positive rate across thresholds. AUC is the probability that a random positive is ranked above a random negative; 0.5 is chance.
07
What is the difference between hard voting and soft voting in ensembles?
In hard voting each model predicts a class and the majority wins. In soft voting each model gives class probabilities, they are averaged, and the class with the highest average wins. Soft voting usually works better because it uses each model's confidence, but it needs calibrated probabilities from all models. Hard voting is simpler and works even with models that only output labels.
NULL means unknown, so any comparison with NULL, even NULL = NULL, gives unknown and the row is filtered out. Use IS NULL or IS NOT NULL instead. Aggregates like SUM, AVG and COUNT(column) skip NULLs, so AVG may be computed over fewer rows than you expect. NOT IN with a subquery that contains a NULL returns no rows. COALESCE replaces NULLs with a default value.
10
Your notebook runs on your laptop but fails on a colleague's machine. How do you make the work reproducible?
First pin the environment: a requirements.txt or conda environment file with exact versions, or a Docker image. Set random seeds for NumPy, scikit-learn and any framework you use. Remove hard-coded local paths and read them from a config file. Make sure data comes from a shared, versioned location. Finally, restart the kernel and run the notebook top to bottom, so hidden cell order bugs are caught before sharing.
SVM finds the maximum-margin separating hyperplane. Kernels such as RBF compute similarity in a higher-dimensional space implicitly, so non-linear boundaries are possible.
It projects data onto orthogonal directions of maximum variance to reduce dimensions, remove correlation and speed up models, at some cost of interpretability.
Calibration checks whether predicted probabilities match real frequencies (e.g. 70% predictions are right about 70% of the time). Fix with Platt scaling or isotonic regression.
It predicts from the k nearest labelled points. It is simple but slow at prediction time, sensitive to scaling and irrelevant features, and weak in high dimensions.
16
How do you make a machine learning experiment reproducible?
Version the code with Git, the data with a tool like DVC or dated snapshots, and the environment with pinned requirements or Docker. Set random seeds for every library. Log parameters, metrics and the exact data version for each run with a tracker like MLflow. Keep preprocessing inside a pipeline rather than manual notebook steps. Then anyone should be able to rebuild the same model from a commit and a data version.
17
What is the difference between saving a model with pickle, joblib and ONNX?
pickle serialises Python objects; it is simple but tied to Python and library versions, and loading untrusted pickle files is a security risk. joblib is similar but more efficient for objects with large NumPy arrays, like scikit-learn models. ONNX is an open, language-neutral format that runs in optimised runtimes across languages and hardware, useful for fast serving. Always store library versions alongside pickle or joblib files.
18
Write SQL to find the top 3 products by revenue in each category.
WITH rev AS (
SELECT category, product_id, SUM(price * qty) AS revenue
FROM order_items
GROUP BY category, product_id
), ranked AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) AS rn
FROM rev
)
SELECT category, product_id, revenue
FROM ranked
WHERE rn <= 3;
19
Write SQL to find customers who ordered in January 2026 but not in February 2026.
SELECT DISTINCT o.customer_id
FROM orders o
WHERE o.order_date >= '2026-01-01' AND o.order_date < '2026-02-01'
AND NOT EXISTS (
SELECT 1 FROM orders f
WHERE f.customer_id = o.customer_id
AND f.order_date >= '2026-02-01' AND f.order_date < '2026-03-01'
);
20
Difference between a shallow copy and a deep copy?
A shallow copy duplicates the outer object but shares nested objects. A deep copy (copy.deepcopy) recursively duplicates everything, so changes to nested items do not leak.
21
A 10 million row DataFrame with a city column is using too much memory. How can the category dtype help?
The category dtype stores each unique value once and keeps small integer codes for every row. For a column like city with 50 unique values in 10 million rows, this can cut memory by more than 90 percent and speed up groupby and sorting. It helps when a column has low cardinality. It does not help for unique IDs or free text, and adding new categories later needs extra handling.
22
What is the difference between a subquery and a correlated subquery?
A normal subquery runs once on its own and its result is used by the outer query, for example WHERE price > (SELECT AVG(price) FROM products). A correlated subquery refers to columns of the outer query, so it is logically evaluated once per outer row, for example comparing each product with its own category average. Correlated subqueries can be slow; joins or window functions are usually faster alternatives.
They store same-type values in contiguous memory and run vectorised operations in compiled C, avoiding Python loop overhead and per-object type checks.
Use stratified splits, class weights, resampling such as SMOTE, threshold tuning and judge models with precision, recall, F1 or PR-AUC instead of accuracy.
25
What are lambda functions and where are they useful?
Experiment tracking records each training run's parameters, code version, data version, metrics and output artefacts. Tools like MLflow or Weights and Biases store this in one place, so you can compare runs, reproduce the best model and see why something improved. Without it, results live in notebook outputs and memory. MLflow also offers a model registry to move approved models through staging and production.
28
What is the F1 score and when can it be misleading?
F1 is the harmonic mean of precision and recall, so it is high only when both are high. It is useful for imbalanced classes where accuracy hides poor performance. It can mislead because it ignores true negatives and treats precision and recall as equally important. If missing a fraud case costs far more than a false alarm, use an F-beta score with beta above 1, or choose metrics based on real costs.
29
What does the axis parameter mean in NumPy and Pandas?
axis tells an operation which direction to work along. axis=0 works down the rows, so df.sum(axis=0) gives one total per column. axis=1 works across columns, so df.sum(axis=1) gives one total per row. In df.drop, axis=1 means drop columns and axis=0 means drop rows. A simple way to remember it: the axis you name is the one that gets collapsed or removed.
30
What is an isolation forest and how does it detect anomalies?
An isolation forest builds many random trees that split data on random features at random thresholds. Anomalies are rare and different, so they get isolated in very few splits, giving a short average path length. Normal points need many splits. The anomaly score comes from that path length. It is fast, works without labels and scales to large data, but you must choose a contamination rate or score threshold carefully.
A decorator wraps a function to add behaviour such as logging, timing or caching without changing its code. It is applied with the @name syntax above the function.
A range built from sample data that would contain the true parameter in a stated percentage (for example 95%) of repeated samples. It is not the probability that the parameter lies inside this one interval.
Split the data into k folds, train on k−1 folds and validate on the remaining one, rotate and average the scores. It gives a more reliable estimate than one split and helps tune hyperparameters without touching the test set.
34
Your fraud model has 99 percent accuracy, but the business says it catches almost no fraud. Why?
If only 1 percent of transactions are fraud, a model that predicts not fraud for everything is 99 percent accurate and useless. Accuracy hides the minority class. I would check the confusion matrix, recall on fraud cases and precision-recall AUC. Then fix it with class weights, resampling or a lower decision threshold, and choose the threshold based on the cost of missed fraud versus false alerts.
It models the log-odds of a binary outcome as a linear function and passes it through a sigmoid to give probabilities, trained by maximising likelihood.
36
Write pytest unit tests for a feature function that computes days since last purchase.
SELECT
customer_id,
MIN(order_date) AS first_order,
MAX(order_date) AS last_order,
MAX(order_date) - MIN(order_date) AS days_between,
COUNT(*) AS orders
FROM orders
GROUP BY customer_id
ORDER BY days_between DESC;
-- PostgreSQL: DATE minus DATE gives days; use DATEDIFF in other engines
38
Tell me about a time your model did not perform as expected after deployment.
Situation: my demand forecasting model had 8 percent error offline, but 20 percent in the first month live. Task: find out why quickly. Action: I compared live inputs with training data and found a promotions feature arrived a day late in production, so the model saw zeros. I added a data freshness check and a fallback. Result: error returned to 9 percent. Since then I always test with production-like pipelines before launch.
39
Tell me about a feature you engineered that significantly improved a model.
Situation: our delivery time model kept underestimating late-night orders. Task: reduce large errors. Action: I noticed restaurant prep time depended on how busy the kitchen was, so I built a feature for active orders at that restaurant in the last 30 minutes, computed point in time. Result: MAE dropped by 14 percent and late-night errors fell the most. It taught me to study the worst errors before adding generic features.
40
How do you work with domain experts to find good features?
Situation: on an insurance claims model, my first features gave average results. Task: improve fraud detection. Action: I sat with two claim investigators for a day and asked what made them suspicious. They mentioned claims filed soon after policy start and repeated garage names. I turned these into features and checked them with the team. Result: recall at the same precision rose by 12 points. Experts often know signals the data hides.
Frequently asked questions
What does a MLOps Engineer do?
An MLOps engineer takes models from notebooks to reliable production services and keeps them healthy. The work covers training pipelines, experiment tracking, model registries, CI/CD, containerised serving, monitoring for drift and latency, and controlling compute cost. Interviews test Python and software engineering, Docker and Kubernetes basics, deployment strategies like canary and shadow, data validation and how you handle production incidents and rollbacks.
Which skills are tested in a MLOps Engineer interview?
Expect questions on Docker and Kubernetes, CI/CD for ML pipelines, Model registry and experiment tracking, Monitoring and drift detection, Python API development. Most rounds also ask you to explain a project and solve one practical problem live.
How do I prepare for a MLOps Engineer interview?
Revise MLOps and Model Deployment, Python for Data Science, Machine Learning, SQL for Data Science first using the topic sheets, practise the questions on this page aloud, then do one full mock interview to practise timing.