Databricks Certified Associate Developer for Apache Spark — Question 61

Which of the following code blocks returns a DataFrame sorted alphabetically based on column division?

Answer options

Correct answer: A

Explanation

The correct answer, A, uses the sort method directly on the division column, which sorts it in ascending alphabetical order. Options B, C, and E sort the division column in descending order, which doesn't meet the requirement. Option D has a syntax error with 'ascending - true' and also attempts to sort in ascending order but is incorrect due to the improper syntax.