Ifspark is running in client mode, which of the following statement about is correct ?
Correct Answer: D
Explanation:
Client mode is nearly the same as cluster mode except that the Spark driver remains on the client machine that
submitted the application.
Question 2
Which of the following code blocks reads from a csv file where values are separated with ‘;’ ?
Correct Answer: A
Explanation:
Correct syntax is; spark.read.format("csv").option("header", "true").option(“inferSchema”, “true”).option(“sep”, “;”).load(file) Get familiar with the syntax of reading and writing from/to files. You will be tested on this in your exam.
Question 3
Which of the following code blocks returns a DataFrame with a new column aSquared and all previously
existing columns from DataFrame df given that df has a column named a ?
Correct Answer: E
Explanation:
You will have such questions in the exam, be careful while reading the responses.
Question 4
If we want to create a constant integer 1 as a new column ‘new_column’ in a dataframe df, which code
block we should select ?
Correct Answer: E
Explanation:
The second argument for DataFrame.withColumn should be a Column so you have to use a literal to
add constant value 1:
Question 5
Which of the following code blocks returns a DataFrame with two new columns ‘a’ and ‘b’ from the existing
column ‘aSquared’ where the values of ‘a’ and ‘b’ is half of the column ‘aSquared’ ?
Correct Answer: E
Explanation:
Familiarize yourself with the syntax of withColumn and withColumnRenamed.
Demo Practice Mode
You are viewing only the questions marked as Demo.