nerdexam
MicrosoftMicrosoft

DP-203 · Question #114

DP-203 Question #114: Real Exam Question with Answer & Explanation

The correct sequence uses COLLATE to handle string comparison/ordering, PIVOT to transform row-based temperature data into a columnar format (rotating distinct values from a column into multiple columns), and CAST to convert data types (such as converting numeric temperature valu

Submitted by cyberguy42· Mar 30, 2026Transform and process data using Apache Spark SQL - specifically reshaping tabular data using PIVOT, type conversion with CAST, and string collation with COLLATE, commonly tested in Azure Data Engineer Associate (DP-203) or Databricks certifications.

Question

Drag and Drop Question You have an Apache Spark DataFrame named temperatures. A sample of the data is shown in the following table. You need to produce the following table by using a Spark SQL query. How should you complete the query? To answer, drag the appropriate values to the correct targets. Each value may be used once more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point. Answer:

Explanation

The correct sequence uses COLLATE to handle string comparison/ordering, PIVOT to transform row-based temperature data into a columnar format (rotating distinct values from a column into multiple columns), and CAST to convert data types (such as converting numeric temperature values to the appropriate type for display). PIVOT is the core operation here - it reshapes the DataFrame by turning row values (e.g., city or month names) into column headers, which is exactly what produces the target table structure from the source data.

Topics

#Spark SQL#PIVOT#DataFrame transformations#Data reshaping

Community Discussion

No community discussion yet for this question.

Full DP-203 PracticeBrowse All DP-203 Questions