Bird
Raised Fist0
Apache Sparkdata~20 mins

Medallion architecture (bronze, silver, gold) in Apache Spark - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Medallion Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Purpose of the Bronze Layer in Medallion Architecture

What is the main purpose of the Bronze layer in the Medallion architecture?

AAggregate data into summarized reports for dashboards.
BStore fully cleaned and enriched data ready for business use.
CStore raw, unprocessed data as it arrives from source systems.
DArchive old data that is no longer needed for analysis.
Attempts:
2 left
💡 Hint

Think about where data lands first before any cleaning or transformation.

❓ data_output
intermediate
1:30remaining
Data Count After Silver Layer Transformation

Given the following Spark code that reads from the Bronze layer and applies a filter to create the Silver layer, what is the count of records in the Silver DataFrame?

Apache Spark
bronze_df = spark.createDataFrame([
  (1, 'Alice', 25, 'NY'),
  (2, 'Bob', 30, 'CA'),
  (3, 'Charlie', 35, 'NY'),
  (4, 'David', 40, 'TX')
], ['id', 'name', 'age', 'state'])
silver_df = bronze_df.filter(bronze_df.state == 'NY')
A2
B3
C1
D4
Attempts:
2 left
💡 Hint

Count how many rows have state equal to 'NY'.

❓ visualization
advanced
2:00remaining
Visualizing Data Quality Improvements Across Layers

You have data quality scores for each Medallion layer: Bronze (60%), Silver (85%), Gold (95%). Which visualization best shows the improvement in data quality from Bronze to Gold?

AA pie chart showing the percentage of data quality for the Gold layer only.
BA scatter plot showing age vs. income for Gold layer data.
CA line chart with time on x-axis and data volume on y-axis.
DA bar chart with three bars labeled Bronze, Silver, Gold showing scores 60, 85, 95 respectively.
Attempts:
2 left
💡 Hint

Think about how to compare data quality scores across layers clearly.

🔧 Debug
advanced
2:00remaining
Identify the Error in Gold Layer Aggregation Code

What error will this Spark code produce when aggregating data in the Gold layer?

Apache Spark
gold_df = silver_df.groupBy('state').agg({'age': 'avg', 'salary': 'sum'})
AAnalysisException: cannot resolve 'salary' given input columns
BSyntaxError: invalid syntax in agg function
CTypeError: unsupported operand type(s) for +: 'int' and 'str'
DNo error, code runs successfully
Attempts:
2 left
💡 Hint

Check if all columns used in aggregation exist in silver_df.

🚀 Application
expert
2:00remaining
Choosing the Correct Layer for Real-Time Dashboard Data

You need to build a real-time dashboard that shows the latest sales data with minimal delay. Which Medallion layer should you query to get the freshest data with basic cleaning applied?

AArchive layer, because it stores historical data for analysis.
BSilver layer, because it has cleaned data and is updated frequently.
CGold layer, because it has aggregated and business-ready data.
DBronze layer, because it has raw data with no delay.
Attempts:
2 left
💡 Hint

Consider freshness and data quality balance for dashboards.

Practice

(1/5)
1. What is the primary purpose of the bronze layer in the Medallion architecture?
easy
A. Store metadata about data quality
B. Store cleaned and enriched data
C. Store raw, unprocessed data as it arrives
D. Store aggregated business-level data

Solution

  1. Step 1: Understand the role of the bronze layer

    The bronze layer is the first stage where raw data is ingested without transformation.
  2. Step 2: Differentiate from silver and gold layers

    Silver contains cleaned data, and gold contains aggregated data, so they are not raw.
  3. Final Answer:

    Store raw, unprocessed data as it arrives -> Option C
  4. Quick Check:

    Bronze = Raw data [OK]
Hint: Bronze = raw data layer, first step [OK]
Common Mistakes:
  • Confusing bronze with silver or gold layers
  • Thinking bronze stores aggregated data
  • Assuming bronze is cleaned data
2. Which of the following is the correct order of layers in the Medallion architecture from raw to business-ready data?
easy
A. Bronze -> Silver -> Gold
B. Silver -> Bronze -> Gold
C. Gold -> Silver -> Bronze
D. Silver -> Gold -> Bronze

Solution

  1. Step 1: Recall the Medallion architecture flow

    Data flows from raw to cleaned to aggregated: bronze, then silver, then gold.
  2. Step 2: Match the order to options

    Bronze -> Silver -> Gold correctly lists bronze first, then silver, then gold.
  3. Final Answer:

    Bronze -> Silver -> Gold -> Option A
  4. Quick Check:

    Order = Bronze, Silver, Gold [OK]
Hint: Remember: Bronze first, then Silver, then Gold [OK]
Common Mistakes:
  • Reversing the order of layers
  • Mixing silver and bronze positions
  • Assuming gold comes before silver
3. Given the following PySpark code snippet, which layer does the resulting DataFrame most likely represent?
bronzeDF = spark.read.format('json').load('/data/raw/events')
silverDF = bronzeDF.filter('event_type IS NOT NULL').dropDuplicates()
goldDF = silverDF.groupBy('event_type').count()
medium
A. goldDF is gold layer
B. silverDF is bronze layer
C. bronzeDF is gold layer
D. bronzeDF is silver layer

Solution

  1. Step 1: Analyze each DataFrame's transformation

    bronzeDF loads raw JSON data (raw data = bronze). silverDF filters and removes duplicates (cleaned data = silver). goldDF groups and counts (aggregated data = gold).
  2. Step 2: Identify the layer of goldDF

    goldDF performs aggregation, which matches the gold layer's purpose.
  3. Final Answer:

    goldDF is gold layer -> Option A
  4. Quick Check:

    Aggregation = Gold layer [OK]
Hint: Aggregation means gold layer [OK]
Common Mistakes:
  • Confusing raw load as silver
  • Thinking filtering is aggregation
  • Mixing up silver and gold transformations
4. You have a silver layer DataFrame but notice it still contains duplicate records. Which change will best fix this issue in your Spark code?
medium
A. Add .dropDuplicates() after loading raw data in bronze layer
B. Add .dropDuplicates() after cleaning transformations in silver layer
C. Add .groupBy() in bronze layer to aggregate data
D. Add .filter() in gold layer to remove duplicates

Solution

  1. Step 1: Understand where duplicates should be removed

    Duplicates should be removed during cleaning, which happens in the silver layer.
  2. Step 2: Evaluate options for removing duplicates

    Adding .dropDuplicates() in silver layer after cleaning transformations is the correct fix.
  3. Final Answer:

    Add .dropDuplicates() after cleaning transformations in silver layer -> Option B
  4. Quick Check:

    Remove duplicates in silver layer [OK]
Hint: Clean data (silver) removes duplicates [OK]
Common Mistakes:
  • Removing duplicates too early in bronze layer
  • Using groupBy instead of dropDuplicates
  • Filtering duplicates only in gold layer
5. You want to build a dashboard showing total sales by region updated daily. Which Medallion architecture layer should you query for the most accurate and business-ready data?
hard
A. Query the bronze layer for raw sales data
B. Query the bronze layer after filtering duplicates
C. Query the silver layer for cleaned sales data
D. Query the gold layer for aggregated sales data

Solution

  1. Step 1: Identify the dashboard data needs

    The dashboard requires aggregated, business-ready data (total sales by region).
  2. Step 2: Match data needs to Medallion layers

    Gold layer contains aggregated and business-level data, ideal for dashboards.
  3. Final Answer:

    Query the gold layer for aggregated sales data -> Option D
  4. Quick Check:

    Dashboard needs gold layer data [OK]
Hint: Dashboards use gold layer data [OK]
Common Mistakes:
  • Using raw or cleaned data instead of aggregated
  • Querying bronze layer directly for reports
  • Filtering bronze layer instead of using gold
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard