Databricks Certified Associate Developer for Apache Spark — Question 124

The code block shown below should return a DataFrame containing all columns from DataFrame storesDF except for column sqft and column customerSatisfaction. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

__1__.__2__(__3__)

Answer options

Correct answer: C

Explanation

The correct answer is C because it properly uses the 'drop' method on storesDF to exclude the specified columns by their names in string format. Options A and E incorrectly use the 'col' function which is unnecessary for dropping columns. Options B and D do not encapsulate the column names in quotes, which is required for them to be recognized as string literals.