DMLA
Free DMLA practice questions
10 questions from our DMLA practice tests, each with the correct answer and a written explanation. Read them with the answers shown, or switch to quiz mode and answer first.
Question 1 of 10, Databricks Machine Learning
A newly registered model version, ml.prod.fraud version 7, has passed validation and should replace version 5 as the version used by production scoring jobs that load 'models:/ml.prod.fraud@champion'. What is the recommended action?
- ACall client.set_registered_model_alias('ml.prod.fraud', 'champion', 7) Correct answer
- BCall client.transition_model_version_stage('ml.prod.fraud', 7, 'Production')
- CCall client.delete_model_version('ml.prod.fraud', 5) so that only version 7 remains
- DCall client.set_model_version_tag('ml.prod.fraud', '7', 'role', 'champion')
Answer and explanation: Aliases are mutable pointers in the Unity Catalog registry; reassigning 'champion' to version 7 makes every consumer of models:/ml.prod.fraud@champion pick up the new version, and the alias moves away from version 5 automatically. Stage transitions belong to the legacy workspace registry, a tag is descriptive metadata that does not change URI resolution, and deleting version 5 is destructive and removes the rollback option.
Question 2 of 10, Databricks Machine Learning
A team serves a model in real time that was trained with features from Unity Catalog feature tables. Request latency must be in milliseconds, and the client only knows the customer_id. What must be in place?
- AA nightly batch job that writes predictions so the endpoint simply returns the stored prediction
- BA larger SQL warehouse attached to the endpoint so each request can query the offline Delta table
- CA copy of the feature table embedded inside the model artifact so features ship with the version
- DThe feature table published to an online store so the endpoint can look up features by customer_id Correct answer
Answer and explanation: For automatic real-time feature lookup, the offline feature table is published to an online store, which provides millisecond key-value reads to the serving endpoint. Querying Delta through a warehouse per request is too slow, embedding a static copy of features in the artifact goes stale immediately, and precomputed predictions are a batch pattern that changes the design rather than enabling real-time lookup.
Question 3 of 10, Databricks Machine Learning
A team builds its models in a dev workspace and promotes them to production. Retraining the model takes three weeks on GPUs and is costly, and the production data is also available in dev. Which promotion approach is most suitable?
- APromote the notebook source only and ask the production team to rerun the training with their own settings
- BPromote the training code and retrain the model from scratch in the production workspace after every release
- CPromote the feature tables only, because production jobs rebuild the model automatically from feature lineage
- DPromote the trained model artifact, for example by copying the validated version into the production catalog Correct answer
Answer and explanation: When training is expensive and hard to reproduce, deploying the model itself avoids paying for training again in each environment; in Unity Catalog this can be done by copying a validated version into the production catalog. Retraining from code in production repeats a three-week GPU job, handing over notebooks invites inconsistent results, and feature lineage does not rebuild models.
Question 4 of 10, Databricks Machine Learning
A training notebook builds a training set with FeatureEngineeringClient.create_training_set and logs the model with fe.log_model, passing that training set. What does this enable at scoring time?
- AModel Serving endpoints read the offline Delta feature table directly for each request at prediction time
- BThe model can be scored with fe.score_batch only on the same cluster that ran the original training notebook
- CThe scoring job must rebuild the training set with create_training_set before every call to model.predict
- Dfe.score_batch can look up the required features by key, so the scoring DataFrame only needs the lookup keys Correct answer
Answer and explanation: Logging with fe.log_model packages the feature lookup metadata with the model, so score_batch joins the needed features from the feature tables and the input DataFrame only needs the keys. Scoring is not tied to the training cluster, rebuilding the training set is unnecessary, and real-time endpoints use an online store rather than scanning the offline Delta table on each request.
Question 5 of 10, Data Processing
A Spark ML OneHotEncoder with default settings is applied to an index column that holds 4 categories. How many elements does each output vector have, and why?
- A4, because each category always gets its own slot in the output vector
- B3, because dropLast=True by default encodes the last category as all zeros Correct answer
- C5, because one extra slot is reserved for unseen categories by default
- D1, because the encoder keeps only the category's numeric index in a vector
Answer and explanation: OneHotEncoder defaults to dropLast=True, so 4 categories produce vectors of length 3 and the last category is all zeros, which avoids perfectly collinear columns. A length of 4 requires dropLast=False, the encoder outputs indicator positions rather than the raw index, and an extra slot for unseen values only appears with handleInvalid='keep', not by default.
Question 6 of 10, Data Processing
A data scientist is preparing features for a gradient-boosted tree model, and one categorical feature, 'zip_code', has about 30,000 distinct values. Why is one-hot encoding a poor choice here?
- AIt removes the most frequent category, so the model loses information for most rows
- BIt creates a very wide, sparse feature set that trees split on poorly Correct answer
- CIt is undefined for string columns, so Spark ML refuses to encode zip codes in any form
- DIt forces trees to treat zip codes as ordered numbers, which creates misleading splits
Answer and explanation: With tens of thousands of levels, one-hot encoding yields an extremely wide and sparse representation, and tree models need many splits to use individual binary columns, so alternatives such as target or frequency encoding are preferred. Strings can be one-hot encoded after indexing, ordinal treatment is the problem of label encoding rather than one-hot, and dropping one level is a reference-category convention, not information loss.
Question 7 of 10, Model Development
A data scientist fits a StringIndexer and a StandardScaler on the full dataset and only then splits it into training and test sets. Test performance later turns out much worse in production. What is the main problem with this workflow?
- AStandardScaler cannot be used before tree-based models, so the test results are invalid for every model type
- BStringIndexer must always run after StandardScaler, because scaling changes the order of the category indices
- CThe split should have been done with randomSplit weights that sum to more than one to account for the scaling step
- DTest-row statistics leaked into preprocessing; preprocessors should be fit on training data only Correct answer
Answer and explanation: Fitting preprocessors on all the data lets information from test rows influence the training features, giving optimistic test metrics; fitting a Pipeline on training data only and applying it to test data avoids this leakage. Stage order does not affect index assignment that way, randomSplit weights are normalized, and scaling is harmless though unnecessary for trees.
Question 8 of 10, Model Development
A team has a 30-minute budget to tune five hyperparameters, and only two of them strongly affect performance. Why is random search often better than grid search here?
- ARandom search always finds the global optimum, while grid search only finds local optima in space
- BRandom search needs no evaluation metric, so it skips the validation step and finishes faster
- CRandom search learns from earlier trials to focus on promising regions as the search progresses
- DRandom search tries more distinct values of the important parameters for the same number of trials Correct answer
Answer and explanation: With a fixed budget, a grid spends many trials varying unimportant parameters while repeating the same few values of important ones; random sampling gives more distinct values on every dimension. Random search does not guarantee a global optimum, it does not adapt to past results (that is Bayesian search), and it still evaluates every trial on validation data.
Question 9 of 10, Model Development
A regression model predicts log(price) because the price target was log-transformed during training. The business wants RMSE reported in dollars. What must the data scientist do before calculating RMSE?
- ACompute RMSE on the log-scale values and multiply the result by the mean price to convert it into dollars
- BTake the log of the original dollar prices a second time so that both columns share the same double-log scale
- CReport R-squared instead, because RMSE cannot be calculated for any model that was trained on a log target
- DExponentiate the log-scale predictions back to dollars and compute RMSE against the original prices Correct answer
Answer and explanation: Predictions from a log-target model are in log units, so they must be exponentiated back to dollars and compared with dollar prices before RMSE is meaningful to the business. Scaling a log-space RMSE by the mean price is not a valid conversion, double-logging moves further from dollars, and RMSE can be calculated once the values are back on the original scale.
Question 10 of 10, Model Deployment
A custom model class subclasses mlflow.pyfunc.PythonModel and needs a tokenizer file at prediction time. How should the file be made available to the served model?
- APass it in the artifacts dict when logging and load it in load_context from context.artifacts Correct answer
- BUpload it to the endpoint's container after deployment with a shell command
- CStore the tokenizer bytes as a model version tag, then read it from the registry
- DHard-code the notebook's local driver file path to the tokenizer inside the predict method of the class
Answer and explanation: Artifacts passed when logging a pyfunc model are packaged with the model, and load_context receives their local paths via context.artifacts, so the served model can load them on startup. Local notebook paths do not exist in the serving container, tags are not meant for binary data, and serving containers are not modified manually after deployment.