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 operations can be used to create a DataFrame containing only the specified columns (by name) from the existing DataFrame storesDF?

Exam-Like




Explanation:

To create a DataFrame with a subset of columns specified by name, the correct operations are:

  1. select(): This method is used to select specific columns by name to include in the new DataFrame.
  2. drop(): This method is used to exclude specific columns by name, resulting in a new DataFrame with the remaining columns.
  • A (subset()): Incorrect, as there is no such method in Spark.
  • B (select()): Correct, as it allows selecting columns by name.
  • C (selectColumn()): Incorrect, as this is not a valid method in Spark.
  • D (filter()): Incorrect, as it is used for filtering rows, not selecting columns.
  • E (drop()): Correct, as it allows excluding columns by name, effectively creating a subset of the remaining columns.
Powered ByGPT-5