DP-203 Develop data processing Practice Question
You are optimizing a Spark DataFrame transformation in Azure Synapse Analytics. The DataFrame has 20 columns and 100 million rows. You notice that the job is slow due to many small files being written to the output. Which two actions can you take to reduce the number of output files? (Choose two.)
⚠ Common exam trap
Watch out — candidates often confuse `coalesce()` with `repartition()`, assuming both cause a shuffle, or they mistakenly think increasing partitions (Option D) will improve performance when it actually exacerbates the small-file issue.
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 coalesce() to reduce the number of partitions without a shuffle.
`coalesce()` reduces the number of partitions without triggering a full shuffle, which minimizes the number of output files while preserving performance. Since the DataFrame already has 100 million rows and 20 columns, coalescing to fewer partitions directly reduces the number of files written, addressing the small-file problem efficiently.
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 coalesce() to reduce the number of partitions without a shuffle.
Why this is correct
Coalesce reduces partitions and thus output files, minimizing shuffle.
- ✗
Enable caching on the DataFrame before writing.
Why it's wrong here
Caching does not reduce the number of output files.
- ✗
Apply bucketing on a column to group data.
Why it's wrong here
Bucketing organizes data into buckets but does not necessarily reduce file count; it can increase it.
- ✗
Increase the number of partitions using repartition() with a larger number.
Why it's wrong here
More partitions result in more output files.
- ✓
Use repartition() with a smaller number of partitions.
Why this is correct
Fewer partitions mean fewer files written.
Go deeper
Related to this question
About these practice questions
This DP-203 question is part of Courseiva's 760-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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DP-203 practice question is part of Courseiva's free Microsoft 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 DP-203 exam.