Question 157 of 507
Data Preparation for Machine LearninghardMultiple ChoiceObjective-mapped

Quick Answer

The answer is that the output S3 path is missing a trailing slash. This error occurs because AWS Glue ETL’s `pyWriteDynamicFrame` method interprets the path as a file name rather than a directory when the trailing slash is omitted, causing the job to fail with a 'No such file or directory' error when it tries to write Parquet files. On the AWS Certified Machine Learning Engineer Associate MLA-C01 exam, this tests your understanding of how Glue handles S3 output paths during ETL jobs—a common trap where candidates overlook the slash and assume any valid S3 prefix works. The exam often presents this as a script snippet with a path like `s3://bucket/output` instead of `s3://bucket/output/`, and the key is recognizing that Glue requires the slash to create the directory structure for partitioned or dynamic frame writes. Memory tip: think of the trailing slash as a “door” for Glue to open the directory—without it, the door is just a wall.

MLA-C01 Data Preparation for Machine Learning Practice Question

This MLA-C01 practice question tests your understanding of data preparation for machine learning. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Exhibit

import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job

args = getResolvedOptions(sys.argv, ['JOB_NAME'])
sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.init(args['JOB_NAME'], args)

raw = glueContext.create_dynamic_frame.from_options(
    connection_type="s3",
    connection_options={"paths": ["s3://bucket/input/year=2023/month=01/"]},
    format="json")

transformed = raw.select_fields(["col1", "col2"]).rename_field("col1", "new_col")

glueContext.write_dynamic_frame.from_options(
    frame=transformed,
    connection_type="s3",
    connection_options={"path": "s3://bucket/output/transformed"},
    format="parquet")

job.commit()

Refer to the exhibit. A data engineer runs an AWS Glue ETL job with the following script portion. The job fails with an error: 'An error occurred while calling o113.pyWriteDynamicFrame. No such file or directory'. What is the most likely cause?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "most likely"

    Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

Question 1hardmultiple choice
Full question →

Exhibit

import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job

args = getResolvedOptions(sys.argv, ['JOB_NAME'])
sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.init(args['JOB_NAME'], args)

raw = glueContext.create_dynamic_frame.from_options(
    connection_type="s3",
    connection_options={"paths": ["s3://bucket/input/year=2023/month=01/"]},
    format="json")

transformed = raw.select_fields(["col1", "col2"]).rename_field("col1", "new_col")

glueContext.write_dynamic_frame.from_options(
    frame=transformed,
    connection_type="s3",
    connection_options={"path": "s3://bucket/output/transformed"},
    format="parquet")

job.commit()

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 output S3 path is missing a trailing slash

The error 'No such file or directory' when calling `pyWriteDynamicFrame` typically occurs because AWS Glue expects the output S3 path to end with a trailing slash to denote a directory. Without it, Glue may interpret the path as a file name rather than a directory, leading to a failure when attempting to write the Parquet files. Adding a trailing slash (e.g., `s3://bucket/output/`) resolves the issue.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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 output format 'parquet' is not supported by Glue

    Why it's wrong here

    Parquet is supported.

  • The input partition path is incorrect because it includes the partition key

    Why it's wrong here

    Including partition key in path is acceptable.

  • The output S3 path is missing a trailing slash

    Why this is correct

    Glue DynamicFrame write expects a directory path ending with '/'.

    Clue confirmation

    The clue word "most likely" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The schema contains a column with a reserved name

    Why it's wrong here

    Error message does not indicate schema issue.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often focus on data format or schema issues, overlooking the subtle file system requirement for a trailing slash in the output path, which is a common source of runtime errors in Spark-based ETL jobs.

Detailed technical explanation

How to think about this question

Under the hood, AWS Glue uses Apache Spark's DataFrame writer, which requires the output path to be a directory. When the path lacks a trailing slash, Spark may treat it as a file path, causing a `FileNotFoundException` when it tries to create subdirectories for partitions or metadata. This is a common pitfall when constructing S3 paths programmatically, especially when concatenating strings without ensuring a trailing delimiter.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A startup's cloud architect reviews their monthly bill and notices costs are higher than expected for a long-running batch job. Switching from on-demand instances to Reserved Instances — or using Spot/Preemptible VMs — can reduce compute costs by up to 72 %. Questions like this test whether you understand the tradeoffs between commitment, flexibility, and cost across cloud pricing models.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related MLA-C01 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free MLA-C01 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this MLA-C01 question test?

Data Preparation for Machine Learning — This question tests Data Preparation for Machine Learning — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: The output S3 path is missing a trailing slash — The error 'No such file or directory' when calling `pyWriteDynamicFrame` typically occurs because AWS Glue expects the output S3 path to end with a trailing slash to denote a directory. Without it, Glue may interpret the path as a file name rather than a directory, leading to a failure when attempting to write the Parquet files. Adding a trailing slash (e.g., `s3://bucket/output/`) resolves the issue.

What should I do if I get this MLA-C01 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 24, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This MLA-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 MLA-C01 exam.