Courseiva
Data Preparation for Machine LearningmediumMultiple ChoiceObjective-mapped

MLA-C01 Data Preparation for Machine Learning Practice Question

A company is building a machine learning model on customer transaction data stored in Amazon S3. The data includes columns with missing values in the 'age' field. The data scientist wants to impute missing values with the median age across all customers. Which approach is MOST efficient for preparing the data at scale?

⚠ Common exam trap

Test-takers frequently assume AWS Glue Transform's FillMissingValues supports median, but it only supports mean or static values, leading them to choose Option A without verifying the available strategies.

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

Use a custom PySpark script in AWS Glue to compute median and fill missing values

AWS Glue with PySpark provides a distributed, scalable environment that can efficiently compute the median and fill missing values across large datasets stored in S3. PySpark's DataFrame API handles the median computation natively, and the Glue job runs on a managed Spark cluster, making it the most efficient approach for data preparation at scale without moving data out of the AWS ecosystem.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use AWS Glue Transform with the FillMissingValues transform specifying the median strategy

    Why it's wrong here

    This is incorrect because Glue's FillMissingValues does not support median strategy; it uses mean or mode. The actual correct approach is to use a custom transform or SageMaker Data Wrangler.

  • Use a custom Python script with pandas to compute median and fill missing values, then upload to S3

    Why it's wrong here

    Pandas runs on a single machine and may not scale to large datasets.

  • Use a custom PySpark script in AWS Glue to compute median and fill missing values

    Why this is correct

    PySpark provides the scalability of Spark with the ability to compute median (e.g., using approxQuantile) and fill missing values, making it efficient for large datasets.

  • Use Amazon Athena SQL query to compute median and update the table

    Why it's wrong here

    Athena is a query engine and does not support updating tables; creating a new table requires additional steps.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

This MLA-C01 question is part of Courseiva's 835-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.