Databricks Certified Associate Developer for Apache Spark — Question 111
Which of the following code blocks writes DataFrame storesDF to file path filePath as CSV?
Answer options
- A. storesDF.write().csv(filePath)
- B. storesDF.write(filePath)
- C. storesDF.write.csv(filePath)
- D. storesDF.write.option("csv").path(filePath)
- E. storesDF.write.path(filePath)
Correct answer: C
Explanation
The correct answer is C because it directly calls the csv method on the write object to save the DataFrame as a CSV file at the specified path. The other options either have incorrect method chaining or use methods that do not conform to the expected syntax for writing a DataFrame as CSV.