Databricks Certified Associate Developer for Apache Spark — Question 170
Which of the following code blocks prints the schema of DataFrame storesDF?
Answer options
- A. print(storesDF)
- B. storesDF.printSchema()
- C. print(storesDF.schema())
- D. storesDF.schema
- E. storesDF.schema()
Correct answer: B
Explanation
The correct option is B, as the method printSchema() is specifically designed to output the schema of a DataFrame in Spark. Option A just prints the DataFrame itself, while options C, D, and E do not execute the correct function to display the schema directly in the intended manner.