Databricks Certified Associate Developer for Apache Spark — Question 173

Which of the following code blocks fails to return a DataFrame sorted alphabetically based on column division?

Answer options

Correct answer: C

Explanation

The correct answer is C because it sorts the DataFrame in descending order using col("division").desc(), rather than alphabetically. The other options (A, B, D, E) all sort the DataFrame in ascending order based on the 'division' column, thus returning the desired alphabetical order.