Exam Certified Associate Developer for Apache Spark All QuestionsBrowse all questions from this exam
Question 146

The code block shown below should read a CSV 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__)

    Correct Answer: E

    To read a CSV file into a DataFrame with a specified schema using PySpark, the correct sequence of methods and arguments is as follows: First, 'spark' is the entry point for Spark. The 'read' method should be used next, as it is a property of 'spark' without parentheses. The 'schema' method should be applied to specify the schema before specifying the format of the file, here 'csv', followed by the 'load' method to finally read the file at the path specified in 'filePath'.

Discussion
5effea7Option: E

E is correct. read is a property of spark. so spark.read(). is wrong. B is wrong.

SaiPavan10Option: E

E definetly

azure_bimonsterOption: E

E is right

AnweeeOption: E

It is E, 100 %

gowthamsaraOption: E

E is correct