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

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__

    Correct Answer: E

    To print the schema of a DataFrame in Spark, you use the DataFrame's 'printSchema' method without any arguments. This method prints the schema of the DataFrame, including column names and types. Therefore, the code block should be filled with 'storesDF.printSchema'.

Discussion
SaiPavan10Option: B

B & E results an output. But using df.schema gives you the schema in more detail, df.printSchema just gives the columns that are present in the dataframe. df.printSchema() gives the detailed schema.

SaiPavan10Option: E

It is df.printSchema().

Sowwy1Option: B

I think it's B.

GluemrOption: E

E is correct. This question is for scala not python

cookiemonster42Option: B

should be B for printSchema() is should be DataFrame.printSchema() with parenthesis

newusername

interesting case, either the answer E is indeed not complete () is missing or it is B, though B doesn't print schema but returns schema object