Professional Machine Learning Engineer Free Practice Questions — Page 17
Question 116
Your company manages an ecommerce website. You developed an ML model that recommends additional products to users in near real time based on items currently in the user’s cart. The workflow will include the following processes:
1. The website will send a Pub/Sub message with the relevant data and then receive a message with the prediction from Pub/Sub
2. Predictions will be stored in BigQuery
3. The model will be stored in a Cloud Storage bucket and will be updated frequently
You want to minimize prediction latency and the effort required to update the model. How should you reconfigure the architecture?
A. Write a Cloud Function that loads the model into memory for prediction. Configure the function to be triggered when messages are sent to Pub/Sub.
B. Create a pipeline in Vertex AI Pipelines that performs preprocessing, prediction, and postprocessing. Configure the pipeline to be triggered by a Cloud Function when messages are sent to Pub/Sub.
C. Expose the model as a Vertex AI endpoint. Write a custom DoFn in a Dataflow job that calls the endpoint for prediction.
D. Use the RunInference API with WatchFilePattern in a Dataflow job that wraps around the model and serves predictions.
Show Answer
Correct Answer: D
Explanation: RunInference in a streaming Dataflow pipeline is designed for low-latency in-pipeline inference, and WatchFilePattern allows the model stored in Cloud Storage to be refreshed automatically without stopping the pipeline. This directly addresses minimizing operational effort for frequent model updates while keeping predictions close to the streaming data flow. Cloud Functions are not ideal for sustained low-latency inference with frequent model updates, Vertex AI Pipelines are for orchestration rather than online prediction, and calling a Vertex AI endpoint from Dataflow adds network hops and still requires endpoint model deployment management.
Question 117
You have built a custom model that performs several memory-intensive preprocessing tasks before it makes a prediction. You deployed the model to a Vertex AI endpoint, and validated that results were received in a reasonable amount of time. After routing user traffic to the endpoint, you discover that the endpoint does not autoscale as expected when receiving multiple requests. What should you do?
A. Use a machine type with more memory
B. Decrease the number of workers per machine
C. Increase the CPU utilization target in the autoscaling configurations.
D. Decrease the CPU utilization target in the autoscaling configurations
Show Answer
Correct Answer: D
Explanation: Vertex AI endpoint autoscaling is driven primarily by CPU utilization rather than memory usage. If preprocessing is memory-intensive and CPU utilization does not reach the scaling threshold, the endpoint may fail to scale out under load. Lowering the target CPU utilization causes autoscaling to add replicas earlier, improving responsiveness to concurrent requests. Increasing the CPU target would delay scaling, while changing machine memory or worker count does not directly address the autoscaling trigger.
Question 118
Your team frequently creates new ML models and runs experiments. Your team pushes code to a single repository hosted on Cloud Source Repositories. You want to create a continuous integration pipeline that automatically retrains the models whenever there is any modification of the code. What should be your first step to set up the CI pipeline?
A. Configure a Cloud Build trigger with the event set as "Pull Request"
B. Configure a Cloud Build trigger with the event set as "Push to a branch"
C. Configure a Cloud Function that builds the repository each time there is a code change
D. Configure a Cloud Function that builds the repository each time a new branch is created
Show Answer
Correct Answer: B
Explanation: Cloud Build is the managed CI service for Cloud Source Repositories. To automatically retrain models whenever code is modified, the first step is to create a Cloud Build trigger that fires on pushes to a branch. A pull request trigger only runs for PR events, while Cloud Functions are unnecessary because Cloud Build provides native repository event triggers.
Question 119
You are creating a model training pipeline to predict sentiment scores from text-based product reviews. You want to have control over how the model parameters are tuned, and you will deploy the model to an endpoint after it has been trained. You will use Vertex AI Pipelines to run the pipeline. You need to decide which Google Cloud pipeline components to use. What components should you choose?
A. TabularDatasetCreateOp, CustomTrainingJobOp, and EndpointCreateOp
B. TextDatasetCreateOp, AutoMLTextTrainingOp, and EndpointCreateOp
C. TabularDatasetCreateOp. AutoMLTextTrainingOp, and ModelDeployOp
D. TextDatasetCreateOp, CustomTrainingJobOp, and ModelDeployOp
Show Answer
Correct Answer: D
Explanation: The data consists of text reviews, so TextDatasetCreateOp is the appropriate dataset component. The requirement to control model parameter tuning rules out AutoMLTextTrainingOp in favor of CustomTrainingJobOp, which allows custom training code and hyperparameter control. To deploy the trained model to an endpoint within Vertex AI Pipelines, ModelDeployOp is the deployment component that uploads and deploys the model. EndpointCreateOp only creates an endpoint and does not perform model deployment.
Question 120
You work for an online retailer. Your company has a few thousand short lifecycle products. Your company has five years of sales data stored in BigQuery. You have been asked to build a model that will make monthly sales predictions for each product. You want to use a solution that can be implemented quickly with minimal effort. What should you do?
A. Use Prophet on Vertex AI Training to build a custom model.
B. Use Vertex AI Forecast to build a NN-based model.
C. Use BigQuery ML to build a statistical ARIMA_PLUS model.
D. Use TensorFlow on Vertex AI Training to build a custom model.
Show Answer
Correct Answer: C
Explanation: BigQuery ML's ARIMA_PLUS is the fastest, lowest-effort solution for time series forecasting when the historical data is already stored in BigQuery. It supports scalable forecasting for many time series with SQL-based model creation, avoiding the custom code and infrastructure required for Vertex AI Training or TensorFlow. Vertex AI Forecast is a stronger option for complex forecasting problems but is not the minimal-effort choice requested.
Question 121
You are developing an ML pipeline using Vertex AI Pipelines. You want your pipeline to upload a new version of the XGBoost model to Vertex AI Model Registry and deploy it to Vertex AI Endpoints for online inference. You want to use the simplest approach. What should you do?
A. Use the Vertex AI REST API within a custom component based on a vertex-ai/prediction/xgboost-cpu image
B. Use the Vertex AI ModelEvaluationOp component to evaluate the model
C. Use the Vertex AI SDK for Python within a custom component based on a python:3.10 image
D. Chain the Vertex AI ModelUploadOp and ModelDeployOp components together
Show Answer
Correct Answer: D
Explanation: The simplest approach is to use the pre-built Vertex AI Pipelines components. Chain ModelUploadOp to register a new model version in Vertex AI Model Registry, then ModelDeployOp to deploy the uploaded model to a Vertex AI Endpoint. This avoids writing custom components with the REST API or Python SDK. ModelEvaluationOp is for evaluating models, not uploading or deploying them.
Question 122
You are building a TensorFlow text-to-image generative model by using a dataset that contains billions of images with their respective captions. You want to create a low maintenance, automated workflow that reads the data from a Cloud Storage bucket collects statistics, splits the dataset into training/validation/test datasets performs data transformations trains the model using the training/validation datasets, and validates the model by using the test dataset. What should you do?
A. Use the Apache Airflow SDK to create multiple operators that use Dataflow and Vertex AI services. Deploy the workflow on Cloud Composer.
B. Use the MLFlow SDK and deploy it on a Google Kubernetes Engine cluster. Create multiple components that use Dataflow and Vertex AI services.
C. Use the Kubeflow Pipelines (KFP) SDK to create multiple components that use Dataflow and Vertex AI services. Deploy the workflow on Vertex AI Pipelines.
D. Use the TensorFlow Extended (TFX) SDK to create multiple components that use Dataflow and Vertex AI services. Deploy the workflow on Vertex AI Pipelines.
Show Answer
Correct Answer: D
Explanation: TFX is specifically designed for end-to-end TensorFlow ML pipelines and provides standard components for data ingestion, statistics generation, schema inference, data validation, transformation, dataset splitting, training, evaluation, and serving. It integrates with Dataflow for scalable data processing and can be orchestrated on Vertex AI Pipelines, making it the lowest-maintenance and most automated option for a TensorFlow-based workflow.
Question 123
You are pre-training a large language model on Google Cloud. This model includes custom TensorFlow operations in the training loop. Model training will use a large batch size, and you expect training to take several weeks. You need to configure a training architecture that minimizes both training time and compute costs. What should you do?
A. Implement 8 workers of a2-megagpu-16g machines by using tf.distribute.MultiWorkerMirroredStrategy.
B. Implement a TPU Pod slice with -accelerator-type=v4-l28 by using tf.distribute.TPUStrategy.
C. Implement 16 workers of c2d-highcpu-32 machines by using tf.distribute.MirroredStrategy.
D. Implement 16 workers of a2-highgpu-8g machines by using tf.distribute.MultiWorkerMirroredStrategy.
Show Answer
Correct Answer: A
Explanation: TPUs generally provide the best performance for large-scale training, but the question explicitly states that the training loop includes custom TensorFlow operations. TPU execution has important restrictions around custom TensorFlow operations in the main training loop, making a TPU Pod slice unsuitable here. CPU-only training is clearly not appropriate for LLM pre-training. Between the GPU options, MultiWorkerMirroredStrategy is the correct distributed strategy, and 8 a2-megagpu-16g instances provide larger GPU memory per worker, which better supports very large batch sizes while reducing the number of workers and associated communication overhead compared to 16 smaller GPU workers.
Question 124
You need to develop a custom TensorFlow model that will be used for online predictions. The training data is stored in BigQuery You need to apply instance-level data transformations to the data for model training and serving. You want to use the same preprocessing routine during model training and serving. How should you configure the preprocessing routine?
A. Create a BigQuery script to preprocess the data, and write the result to another BigQuery table.
B. Create a pipeline in Vertex AI Pipelines to read the data from BigQuery and preprocess it using a custom preprocessing component.
C. Create a preprocessing function that reads and transforms the data from BigQuery. Create a Vertex AI custom prediction routine that calls the preprocessing function at serving time.
D. Create an Apache Beam pipeline to read the data from BigQuery and preprocess it by using TensorFlow Transform and Dataflow.
Show Answer
Correct Answer: D
Explanation: TensorFlow Transform (tf.Transform) is specifically designed to define preprocessing once and apply the identical transformations during both training and serving. It runs with Apache Beam (commonly on Dataflow) and produces transformation artifacts that ensure consistency. The other options either preprocess only for training, duplicate preprocessing logic, or do not provide a single shared preprocessing graph for both training and serving.
Question 125
You have trained a model by using data that was preprocessed in a batch Dataflow pipeline. Your use case requires real-time inference. You want to ensure that the data preprocessing logic is applied consistently between training and serving. What should you do?
A. Perform data validation to ensure that the input data to the pipeline is the same format as the input data to the endpoint.
B. Refactor the transformation code in the batch data pipeline so that it can be used outside of the pipeline. Use the same code in the endpoint.
C. Refactor the transformation code in the batch data pipeline so that it can be used outside of the pipeline. Share this code with the end users of the endpoint.
D. Batch the real-time requests by using a time window and then use the Dataflow pipeline to preprocess the batched requests. Send the preprocessed requests to the endpoint.
Show Answer
Correct Answer: B
Explanation: Refactor the preprocessing/transformation logic into reusable code and invoke the same code from the online serving endpoint. This ensures that the identical feature engineering and preprocessing steps are applied during both training and real-time inference, avoiding training-serving skew. Data validation alone does not enforce identical transformations, sharing preprocessing with end users is unnecessary and unreliable, and routing online requests through a batch Dataflow pipeline adds latency that conflicts with real-time inference.
$19
Get all 367 questions with detailed answers and explanations
Instant download HTML + PDF delivered the moment payment clears.
Secure Stripe checkout we never see or store your card details.
7-day refund if files are defective see our refund policy.