Databricks Certified Associate Developer for Apache Spark — Question 126

The code block shown below should read a JSON at the file path filePath into a DataFrame with the specified schema schema. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

__1__.__2__.__3__(__4__).format("csv").__5__(__6__)

Answer options

Correct answer: D

Explanation

The correct answer is D because it accurately calls the read method on the spark object, specifies the schema with the correct syntax, and uses the load method to read the file at filePath. Options A and C incorrectly use the 'read()' method and do not align with the expected method format, while B and E misplace the order of parameters and methods needed for this operation.