LeetQuiz Logo
Privacy Policy•contact@leetquiz.com
© 2025 LeetQuiz All rights reserved.
Databricks Certified Associate Developer for Apache Spark

Databricks Certified Associate Developer for Apache Spark

Get started today

Ultimate access to all questions.


Which of the following code blocks returns a DataFrame sorted in alphabetical order by the column division?

Exam-Like




Explanation:

To sort a DataFrame alphabetically based on a column in ascending order, the correct method is to use sort or orderBy without specifying a descending order. Option A correctly uses sort("division"), which sorts the DataFrame in ascending order by default. Options B, C, and E incorrectly sort the DataFrame in descending order due to the use of desc. Option D contains a syntax error with ascending - true instead of the correct ascending=True. Therefore, the only correct option is A.

Powered ByGPT-5