MLS-C01 Practice Question: Machine Learning Implementation and Operations
Exhibit
Refer to the exhibit.
{
"ContainerDefinitions": [
{
"Image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/my-custom-image:latest",
"ModelDataUrl": "s3://my-bucket/model.tar.gz",
"Environment": {
"SAGEMAKER_PROGRAM": "train.py"
}
}
],
"InferenceSpecification": {
"Containers": [
{
"Image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/my-custom-image:latest",
"ModelDataUrl": "s3://my-bucket/model.tar.gz",
"Environment": {}
}
]
}
}A data scientist creates a model resource in SageMaker using the JSON configuration in the exhibit. When creating an endpoint, the deployment fails with an error 'ModelError: Cannot find inference code'. What is the MOST likely cause?
⚠ Common exam trap
Candidates often confuse missing model weights (Option A) with missing inference code, but SageMaker's error message explicitly states 'Cannot find inference code', which points to the entry-point script, not the model artifacts.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The inference container environment does not specify SAGEMAKER_PROGRAM
The error 'Cannot find inference code' occurs because SageMaker requires the `SAGEMAKER_PROGRAM` environment variable in the inference container to specify the entry-point script (e.g., `inference.py`) inside the `model.tar.gz`. Without this variable, SageMaker does not know which script to execute for inference, causing the deployment to fail. Option C correctly identifies this missing environment variable as the root cause.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The model.tar.gz file is missing the model weights
Why it's wrong here
Missing weights would cause runtime error, not 'Cannot find inference code'.
- ✗
The ECR image does not exist
Why it's wrong here
That would give a CannotPullContainerError.
- ✓
The inference container environment does not specify SAGEMAKER_PROGRAM
Why this is correct
The inference container needs the SAGEMAKER_PROGRAM variable to point to the inference script.
- ✗
The training container does not have the SAGEMAKER_PROGRAM variable
Why it's wrong here
Training container is separate from inference.
Go deeper
Related to this question
About these practice questions
Courseiva writes every MLS-C01 question from scratch — 1,672 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLS-C01 exam.