Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Databricks Certified Associate Developer for Apache Spark 3.5 Exam - Topic 3 Question 9 Discussion

Actual exam question for Databricks's Databricks Certified Associate Developer for Apache Spark 3.5 exam
Question #: 9
Topic #: 3
[All Databricks Certified Associate Developer for Apache Spark 3.5 Questions]

A Data Analyst needs to retrieve employees with 5 or more years of tenure.

Which code snippet filters and shows the list?

Show Suggested Answer Hide Answer
Suggested Answer: A

To filter rows based on a condition and display them in Spark, use filter(...).show():

employees_df.filter(employees_df.tenure >= 5).show()

Option A is correct and shows the results.

Option B filters but doesn't display them.

Option C uses Python's built-in filter, not Spark.

Option D collects the results to the driver, which is unnecessary if .show() is sufficient.

Final Answer: A


Contribute your Thoughts:

0/2000 characters
Ashley
1 day ago
Definitely A, it’s the most straightforward.
upvoted 0 times
...
Mona
6 days ago
Wait, can you really use .collect() like that?
upvoted 0 times
...
Santos
11 days ago
I think B is the best choice for clarity.
upvoted 0 times
...
Tanesha
17 days ago
Option A looks good for showing the results!
upvoted 0 times
...
Altha
22 days ago
Option B is the way to go, it's the most efficient and readable.
upvoted 0 times
...
Marvel
27 days ago
Haha, option C is just missing the DataFrame name, what a rookie mistake!
upvoted 0 times
...
Gianna
2 months ago
Option D seems like the best choice, it returns the full dataset instead of just showing it.
upvoted 0 times
...
Naomi
2 months ago
I'd go with option A, it's more explicit and easier to understand.
upvoted 0 times
...
Domitila
2 months ago
Option B looks good, it's clear and concise.
upvoted 0 times
...
Taryn
2 months ago
I feel like option D is also valid since .collect() would return the results, but I’m not sure if it’s necessary for just filtering.
upvoted 0 times
...
Dominga
2 months ago
Option C seems incomplete to me; I don't think you can just use filter like that without specifying the DataFrame.
upvoted 0 times
...
Patti
2 months ago
I remember practicing with the .where() method, so I feel like option B could be correct too.
upvoted 0 times
...
Theresia
3 months ago
I think option A looks familiar, but I'm not sure if it needs the .show() at the end.
upvoted 0 times
...
Vivienne
3 months ago
I'd go with option B. It's clear and concise, and the where() method is commonly used for filtering DataFrames.
upvoted 0 times
...
Kerry
3 months ago
I'm a bit confused by option C. Isn't filter() a DataFrame method, not a standalone function?
upvoted 0 times
...
Leanna
3 months ago
Option D might be good if I need to store the filtered results in a variable for later use. The collect() method will return a list of the matching rows.
upvoted 0 times
...
Odette
3 months ago
Hmm, I'm not sure about option A. Does the filter() method return a new DataFrame or just display the results?
upvoted 0 times
...
Natalya
3 months ago
I think option B looks the most straightforward. Just need to use the where() method to filter the DataFrame.
upvoted 0 times
...

Save Cancel