Certified Associate Developer for Apache Spark Practice Test
Certified Associate Developer for Apache Spark Practice Test practice questions, page 7 of 14, with answer review and explanations.
Question 31
Which of the following code blocks will most quickly return an approximation for the number of distinct values in column division in DataFrame storesDF?
The code block shown below contains an error. The code block is intended to return a new DataFrame with the mean of column sqft from DataFrame storesDF in column sqftMean. Identify the error. Code block: storesDF.agg(mean("sqft").alias("sqftMean"))
The argument to the mean() operation should be a Column abject rather than a string column name.
The argument to the mean() operation should not be quoted.
The mean() operation is not a standalone function – it’s a method of the Column object.
The agg() operation is not appropriate here – the withColumn() operation should be used instead.
The only way to compute a mean of a column is with the mean() method from a DataFrame.
Question 33
Which of the following operations can be used to return the number of rows in a DataFrame?
DataFrame.numberOfRows()
DataFrame.n()
DataFrame.sum()
DataFrame.count()
DataFrame.countDistinct()
Question 34
Which of the following operations returns a GroupedData object?
DataFrame.GroupBy()
DataFrame.cubed()
DataFrame.group()
DataFrame.groupBy()
DataFrame.grouping_id()
Question 35
Which of the following code blocks returns a collection of summary statistics for all columns in DataFrame storesDF?