Certified Associate Developer for Apache Spark Practice Test 21
Question 200
At Bayfront Markets, during a pipeline migration (fictional study case R280-C040-1), a data engineer hand-implements per-row Python reductions for a grouped sales report although built-in Spark SQL aggregation exists. The change owner wants to avoid damaging unrelated tables, jobs or access. Which change boundary BEST limits the correction to the affected Spark workload? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Replace only the custom aggregation routine.
- Change the modeling stage, not existing SQL extraction.
- Change the graph stage while preserving node/edge semantics.
- Migrate only the relevant streaming pipeline.
Explanation
Correct Answer
A:Replace only the custom aggregation routine. This limits the change while addressing: The generic Python loop gives up Catalyst optimization and native distributed aggregate planning. The expected outcome is: The native aggregate returns matching grouped totals with reduced overhead.
Incorrect Answers
B:Change the modeling stage, not existing SQL extraction. The action does not preserve the identified scope boundary: Replace only the custom aggregation routine.
C:Change the graph stage while preserving node/edge semantics. This does not enforce the required scope: Replace only the custom aggregation routine. The specific failure is: The generic Python loop gives up Catalyst optimization and native distributed aggregate planning.
D:Migrate only the relevant streaming pipeline. This does not enforce the required scope: Replace only the custom aggregation routine. The specific failure is: The generic Python loop gives up Catalyst optimization and native distributed aggregate planning.
Question 201
At Horizon Logistics, during a performance incident (fictional study case R280-C041-1), a daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. Which corrective Spark operation or design change BEST addresses the reported failure? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Write with the explicitly approved overwrite mode after validating destination ownership and schema.
- Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout.
- Define an explicit `StructType` schema that stores identifier fields as strings.
- Configure supported JDBC partition column, bounds, and partition count with source database capacity limits.
Explanation
Correct Answer
A:The observed defect follows from: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement. The appropriate correction is: Write with the explicitly approved overwrite mode after validating destination ownership and schema. Confirm the result by verifying: Only the intended snapshot appears and the source row count reconciles.
Incorrect Answers
B:Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout. That would not resolve the reported problem: A daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. The source-supported intervention is: Write with the explicitly approved overwrite mode after validating destination ownership and schema.
C:Define an explicit `StructType` schema that stores identifier fields as strings. The option targets a different stage or condition. The relevant failure is: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement. The needed repair is: Write with the explicitly approved overwrite mode after validating destination ownership and schema.
D:Configure supported JDBC partition column, bounds, and partition count with source database capacity limits. That would not resolve the reported problem: A daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. The source-supported intervention is: Write with the explicitly approved overwrite mode after validating destination ownership and schema.
Question 202
At Aspen Public Services, during a distributed-job recovery test (fictional study case R280-C041-2), a daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. The engineer wants to distinguish the mechanism before changing code. Which underlying Spark mechanism BEST explains the observed symptom? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- The writer omitted `.partitionBy('country')` even though country is a desired output directory partition.
- Automatic CSV schema inference treated business IDs as numeric measurements.
- JDBC partitioning options were omitted, preventing bounded parallel range reads.
- The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement.
Explanation
Correct Answer
D:The reported symptom is: A daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. Its direct cause is: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement. Test that conclusion using: Read back both old and new record IDs after the write and inspect the actual write mode.
Incorrect Answers
A:The writer omitted `.partitionBy('country')` even though country is a desired output directory partition. This is not the root cause established for the reported condition: A daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. The cause is: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement.
B:Automatic CSV schema inference treated business IDs as numeric measurements. The observed failure instead follows from: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement. The alternative does not explain the same dependency.
C:JDBC partitioning options were omitted, preventing bounded parallel range reads. That explanation needs evidence of another fault. The specific mechanism here is: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement.
Question 203
At Juniper Foods, while reconciling a reporting dataset (fictional study case R280-C041-1), a daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. Competing explanations are being considered; choose the most discriminating check. Which evidence check BEST distinguishes this cause from a different Spark problem? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Read back both old and new record IDs after the write and inspect the actual write mode.
- Inspect destination paths and predicate-filtered scan behavior.
- Compare raw CSV samples with inferred types and explicit-schema readback.
- Inspect JDBC read task count, query predicates and source connection load.
Explanation
Correct Answer
A:The needed observation is: Read back both old and new record IDs after the write and inspect the actual write mode. The suspected failure is: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement. The repair should only follow that check.
Incorrect Answers
B:Inspect destination paths and predicate-filtered scan behavior. That does not establish whether the stated cause is present: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement. The diagnostic is: Read back both old and new record IDs after the write and inspect the actual write mode.
C:Compare raw CSV samples with inferred types and explicit-schema readback. The case requires a discriminating check before any change, not the offered alternative. Use: Read back both old and new record IDs after the write and inspect the actual write mode.
D:Inspect JDBC read task count, query predicates and source connection load. This is not the focused evidence-gathering step. Verify the suspected mechanism with: Read back both old and new record IDs after the write and inspect the actual write mode.
Question 204
At Silverpeak Bioinformatics, during a pipeline migration (fictional study case R280-C041-2), a daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. A proposed fix has been applied; its result still needs validation. Which measurable outcome BEST confirms the fix works without violating the data contract? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Only the intended snapshot appears and the source row count reconciles.
- Country folders exist and filtering still returns complete matching records.
- Identifiers retain leading zeros and other fields conform to schema.
- The extract completes with stable database load and no missing or overlapping rows.
Explanation
Correct Answer
A:A passing check shows: Only the intended snapshot appears and the source row count reconciles. This is evidence for the scoped change: Write with the explicitly approved overwrite mode after validating destination ownership and schema.
Incorrect Answers
B:Country folders exist and filtering still returns complete matching records. This is not the observed recovery outcome. Acceptance requires: Only the intended snapshot appears and the source row count reconciles.
C:Identifiers retain leading zeros and other fields conform to schema. Implementation or a check alone is not proof of success. The measurable end state is: Only the intended snapshot appears and the source row count reconciles.
D:The extract completes with stable database load and no missing or overlapping rows. The alternative cannot demonstrate that the issue has been corrected: A daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. The required result is: Only the intended snapshot appears and the source row count reconciles.
Question 205
At Willowbank Software, after a Spark runtime upgrade (fictional study case R280-C041-1), a daily output is expected to replace the prior snapshot but old partitions remain alongside the new data. The change owner wants to avoid damaging unrelated tables, jobs or access. Which change boundary BEST limits the correction to the affected Spark workload? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Partition the target output path without changing source-country values.
- Apply the schema to the affected CSV source only.
- Overwrite only the designated snapshot destination, not neighboring datasets.
- Partition only this fact-table extract under the approved database quota.
Explanation
Correct Answer
C:The relevant boundary is: Overwrite only the designated snapshot destination, not neighboring datasets. The correction remains: Write with the explicitly approved overwrite mode after validating destination ownership and schema.
Incorrect Answers
A:Partition the target output path without changing source-country values. The action does not preserve the identified scope boundary: Overwrite only the designated snapshot destination, not neighboring datasets.
B:Apply the schema to the affected CSV source only. The action does not preserve the identified scope boundary: Overwrite only the designated snapshot destination, not neighboring datasets.
D:Partition only this fact-table extract under the approved database quota. This does not enforce the required scope: Overwrite only the designated snapshot destination, not neighboring datasets. The specific failure is: The writer used `append` instead of `mode('overwrite')` for a full snapshot replacement.
Question 206
At Seabrook Education, during a performance incident (fictional study case R280-C042-1), a 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. Which corrective Spark operation or design change BEST addresses the reported failure? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Define an explicit `StructType` schema that stores identifier fields as strings.
- Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout.
- Configure supported JDBC partition column, bounds, and partition count with source database capacity limits.
- Define or revise the nested Spark schema against representative raw JSON structures.
Explanation
Correct Answer
B:Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout. The technical or governance gap is: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition. Check the affected state using: Inspect destination paths and predicate-filtered scan behavior.
Incorrect Answers
A:Define an explicit `StructType` schema that stores identifier fields as strings. That would not resolve the reported problem: A 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The source-supported intervention is: Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout.
C:Configure supported JDBC partition column, bounds, and partition count with source database capacity limits. The recorded mechanism is: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition. The proposed action does not correct that mechanism; use: Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout.
D:Define or revise the nested Spark schema against representative raw JSON structures. The option targets a different stage or condition. The relevant failure is: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition. The needed repair is: Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout.
Question 207
At Bluewater Energy, during a distributed-job recovery test (fictional study case R280-C042-2), a 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The engineer wants to distinguish the mechanism before changing code. Which underlying Spark mechanism BEST explains the observed symptom? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Automatic CSV schema inference treated business IDs as numeric measurements.
- The writer omitted `.partitionBy('country')` even though country is a desired output directory partition.
- JDBC partitioning options were omitted, preventing bounded parallel range reads.
- The supplied schema does not match the actual `struct` and array nesting of the source records.
Explanation
Correct Answer
B:The writer omitted `.partitionBy('country')` even though country is a desired output directory partition. This accounts for the observed condition: A 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The relevant verification is: Inspect destination paths and predicate-filtered scan behavior.
Incorrect Answers
A:Automatic CSV schema inference treated business IDs as numeric measurements. This is not the root cause established for the reported condition: A 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The cause is: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition.
C:JDBC partitioning options were omitted, preventing bounded parallel range reads. This is not the root cause established for the reported condition: A 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The cause is: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition.
D:The supplied schema does not match the actual `struct` and array nesting of the source records. This is not the root cause established for the reported condition: A 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The cause is: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition.
Question 208
At Meridian Commerce, while reconciling a reporting dataset (fictional study case R280-C042-1), a 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. Competing explanations are being considered; choose the most discriminating check. Which evidence check BEST distinguishes this cause from a different Spark problem? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Compare raw CSV samples with inferred types and explicit-schema readback.
- Inspect destination paths and predicate-filtered scan behavior.
- Inspect JDBC read task count, query predicates and source connection load.
- Inspect raw JSON paths, `printSchema()` and sample nested field extraction.
Explanation
Correct Answer
B:Diagnose the affected path with: Inspect destination paths and predicate-filtered scan behavior. This tests the case-specific cause: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition.
Incorrect Answers
A:Compare raw CSV samples with inferred types and explicit-schema readback. This is not the focused evidence-gathering step. Verify the suspected mechanism with: Inspect destination paths and predicate-filtered scan behavior.
C:Inspect JDBC read task count, query predicates and source connection load. The case requires a discriminating check before any change, not the offered alternative. Use: Inspect destination paths and predicate-filtered scan behavior.
D:Inspect raw JSON paths, `printSchema()` and sample nested field extraction. This is not the focused evidence-gathering step. Verify the suspected mechanism with: Inspect destination paths and predicate-filtered scan behavior.
Question 209
At Copperline Finance, during a pipeline migration (fictional study case R280-C042-2), a 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. A proposed fix has been applied; its result still needs validation. Which measurable outcome BEST confirms the fix works without violating the data contract? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Identifiers retain leading zeros and other fields conform to schema.
- The extract completes with stable database load and no missing or overlapping rows.
- Valid nested attributes appear at the correct paths without inventing missing values.
- Country folders exist and filtering still returns complete matching records.
Explanation
Correct Answer
D:Country folders exist and filtering still returns complete matching records. This demonstrates the intended effect of: Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout. The prior failure was: A 200-country Parquet archive is written as one flat directory, making selective country reads inefficient.
Incorrect Answers
A:Identifiers retain leading zeros and other fields conform to schema. Implementation or a check alone is not proof of success. The measurable end state is: Country folders exist and filtering still returns complete matching records.
B:The extract completes with stable database load and no missing or overlapping rows. Implementation or a check alone is not proof of success. The measurable end state is: Country folders exist and filtering still returns complete matching records.
C:Valid nested attributes appear at the correct paths without inventing missing values. The alternative cannot demonstrate that the issue has been corrected: A 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The required result is: Country folders exist and filtering still returns complete matching records.
Question 210
At Pinecrest Media, after a Spark runtime upgrade (fictional study case R280-C042-1), a 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The change owner wants to avoid damaging unrelated tables, jobs or access. Which change boundary BEST limits the correction to the affected Spark workload? Select ONE best answer. This is unofficial original Spark educational practice, not a real certification item.
- Apply the schema to the affected CSV source only.
- Partition only this fact-table extract under the approved database quota.
- Partition the target output path without changing source-country values.
- Correct only this JSON feed's schema and downstream references.
Explanation
Correct Answer
C:The relevant boundary is: Partition the target output path without changing source-country values. The correction remains: Apply `.partitionBy('country')` to the DataFrameWriter and verify the partition directory layout.
Incorrect Answers
A:Apply the schema to the affected CSV source only. This does not enforce the required scope: Partition the target output path without changing source-country values. The specific failure is: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition.
B:Partition only this fact-table extract under the approved database quota. This does not enforce the required scope: Partition the target output path without changing source-country values. The specific failure is: The writer omitted `.partitionBy('country')` even though country is a desired output directory partition.
D:Correct only this JSON feed's schema and downstream references. It is not the bounded choice for the stated condition: A 200-country Parquet archive is written as one flat directory, making selective country reads inefficient. The permitted change must remain: Partition the target output path without changing source-country values.