Databricks Certified Associate Developer for Apache Spark — Question 62

The code block shown below contains an error. The code block intended to create a single-column DataFrame from Scala List years which is made up of integers. Identify the error.

Code block:

spark.createDataset(years)

Answer options

Correct answer: D

Explanation

The correct answer is D because the createDataset method generates a Dataset, while the requirement is for a DataFrame. The others are incorrect as they either refer to incorrect operations, data types, or structural requirements that do not apply to the situation described.