Free Databricks-Certified-Associate-Developer-for-Apache-Spark-3.0 Practice Test Questions and Answers (2026) | Cert Empire Practice Questions
Free preview: 20 questions.
Databricks Certified Associate Developer…
Q: 1
In which order should the code blocks shown below be run in order to create a DataFrame that
shows the mean of column predError of DataFrame transactionsDf per column storeId and productId,
where productId should be either 2 or 3 and the returned DataFrame should be sorted in ascending
order by column storeId, leaving out any nulls in that column?
DataFrame transactionsDf:
1.
+-------------+---------+-----+-------+---------+----+
2.
|transactionId|predError|value|storeId|productId| f|
3.
+-------------+---------+-----+-------+---------+----+
4.
|
1|
3|
4|
25|
1|null|
5.
|
2|
6|
7|
2|
2|null|
6.
|
3|
3| null|
25|
3|null|
7.
|
4|
null| null|
3|
2|null|
8.
|
5|
null| null| null|
2|null|
9.
|
6|
3|
2|
25|
2|null|
10.
+-------------+---------+-----+-------+---------+----+
1. .mean("predError")
2. .groupBy("storeId")
3. .orderBy("storeId")
4. transactionsDf.filter(transactionsDf.storeId.isNotNull())
5. .pivot("productId", [2, 3])
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 2
Which of the following describes the characteristics of accumulators?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 3
Which of the following code blocks removes all rows in the 6-column DataFrame transactionsDf that
have missing data in at least 3 columns?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 4
The code block displayed below contains an error. The code block is intended to perform an outer join of DataFrames transactionsDf and itemsDf on columns productId and itemId, respectively. Find the error. Code block: transactionsDf.join(itemsDf, [itemsDf.itemId, transactionsDf.productId], "outer")
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 5
The code block displayed below contains an error. When the code block below has executed, it
should have divided DataFrame transactionsDf into 14 parts, based on columns storeId and
transactionDate (in this order). Find the error.
Code block:
transactionsDf.coalesce(14, ("storeId", "transactionDate"))
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 6
Which of the following code blocks returns only rows from DataFrame transactionsDf in which values
in column productId are unique?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 7
Which of the following code blocks returns about 150 randomly selected rows from the 1000-row
DataFrame transactionsDf, assuming that any row can appear more than once in the returned
DataFrame?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 8
Which of the following code blocks stores a part of the data in DataFrame itemsDf on executors?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 9
The code block displayed below contains an error. The code block should display the schema of
DataFrame transactionsDf. Find the error.
Code block:
transactionsDf.rdd.printSchema
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 10
The code block displayed below contains an error. The code block should return all rows of
DataFrame transactionsDf, but including only columns storeId and predError. Find the error.
Code block:
spark.collect(transactionsDf.select("storeId", "predError"))
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 11
The code block displayed below contains an error. The code block should use Python method
find_most_freq_letter to find the letter present most in column itemName of DataFrame itemsDf
and
return it in a new column most_frequent_letter. Find the error.
Code block:
1. find_most_freq_letter_udf = udf(find_most_freq_letter)
2. itemsDf.withColumn("most_frequent_letter", find_most_freq_letter("itemName"))
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 12
Which of the following code blocks returns a one-column DataFrame of all values in column supplier
of DataFrame itemsDf that do not contain the letter X? In the DataFrame, every value should
only be listed once.
Sample of DataFrame itemsDf:
1.
+------+--------------------+--------------------+-------------------+
2.
|itemId|
itemName|
attributes|
supplier|
3.
+------+--------------------+--------------------+-------------------+
4.
|
1|Thick Coat for Wa...|[blue, winter, cozy]|Sports Company Inc.|
5.
|
2|Elegant Outdoors ...|[red, summer, fre...|
YetiX|
6.
|
3| Outdoors Backpack|[green, summer, t...|Sports Company Inc.|
7.
+------+--------------------+--------------------+-------------------+
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 13
Which of the following options describes the responsibility of the executors in Spark?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 14
Which of the following describes slots?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 15
Which of the following code blocks returns a DataFrame with a single column in which all items in
column attributes of DataFrame itemsDf are listed that contain the letter i?
Sample of DataFrame itemsDf:
1.
+------+----------------------------------+-----------------------------+-------------------+
2.
|itemId|itemName
|attributes
|supplier
|
3.
+------+----------------------------------+-----------------------------+-------------------+
4.
|1
|Thick Coat for Walking in the Snow|[blue, winter, cozy]
|Sports Company Inc.|
5.
|2
|Elegant Outdoors Summer Dress
|[red, summer, fresh, cooling]|YetiX
|
6.
|3
|Outdoors Backpack
|[green, summer, travel]
|Sports Company Inc.|
7.
+------+----------------------------------+-----------------------------+-------------------+
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 16
The code block shown below should return a DataFrame with columns transactionsId, predError,
value, and f from DataFrame transactionsDf. Choose the answer that correctly fills the blanks in the
code block to accomplish this.
transactionsDf.__1__(__2__)
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 17
Which of the following statements about executors is correct?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 18
Which of the following code blocks returns a copy of DataFrame transactionsDf in which column
productId has been renamed to productNumber?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 19
Which of the following is a viable way to improve Spark's performance when dealing with large
amounts of data, given that there is only a single application running on the cluster?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 20
Which of the following DataFrame methods is classified as a transformation?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Question 1 of 20