Databricks Certified Associate Developer for Apache Spark — Question 71
The code block shown below should print the schema of DataFrame storesDF. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.
Code block:
__1__.__2__
Answer options
- A. 1. storesDF 2. printSchema(“all”)
- B. 1. storesDF 2. schema
- C. 1. storesDF 2. getAs[str]
- D. 1. storesDF 2. printSchema(true)
- E. 1. storesDF 2. printSchema
Correct answer: E
Explanation
The correct answer is E because the 'printSchema' method without any arguments is the proper way to display the schema of a DataFrame in Spark. Option A incorrectly uses 'printSchema' with an argument, while B incorrectly attempts to access the schema property directly, and C uses 'getAs' which is not applicable for printing the schema. Option D also incorrectly includes a boolean argument with 'printSchema'.