Exam2pass
0 items Sign In or Register
  • Home
  • IT Exams
  • Guarantee
  • FAQs
  • Reviews
  • Contact Us
  • Demo
Exam2pass > Databricks > Databricks Certifications > DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK > DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Online Practice Questions and Answers

DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Online Practice Questions and Answers

Questions 4

The code block shown below should store DataFrame transactionsDf on two different executors, utilizing the executors' memory as much as possible, but not writing anything to disk. Choose the answer that correctly fills the blanks in the code block to accomplish this.

1.from pyspark import StorageLevel 2.transactionsDf.__1__(StorageLevel.__2__).__3__

A. 1. cache

2.

MEMORY_ONLY_2

3.

count()

B. 1. persist

2.

DISK_ONLY_2

3.

count()

C. 1. persist

2.

MEMORY_ONLY_2

3.

select()

D. 1. cache

2.

DISK_ONLY_2

3.

count()

E. 1. persist

2.

MEMORY_ONLY_2

3.

count()

Buy Now

Correct Answer: E

Questions 5

In which order should the code blocks shown below be run in order to read a JSON file from location jsonPath into a DataFrame and return only the rows that do not have value 3 in column productId?

1.

importedDf.createOrReplaceTempView("importedDf")

2.

spark.sql("SELECT * FROM importedDf WHERE productId != 3")

3.

spark.sql("FILTER * FROM importedDf WHERE productId != 3")

4.

importedDf = spark.read.option("format", "json").path(jsonPath)

5.

importedDf = spark.read.json(jsonPath)

A. 4, 1, 2

B. 5, 1, 3

C. 5, 2

D. 4, 1, 3

E. 5, 1, 2

Buy Now

Correct Answer: E

Questions 6

Which of the following code blocks returns a DataFrame with an added column to DataFrame transactionsDf that shows the unix epoch timestamps in column transactionDate as strings in the format month/day/year in column transactionDateFormatted?

Excerpt of DataFrame transactionsDf:

A. transactionsDf.withColumn("transactionDateFormatted", from_unixtime("transactionDate", format="dd/ MM/yyyy"))

B. transactionsDf.withColumnRenamed("transactionDate", "transactionDateFormatted", from_unixtime ("transactionDateFormatted", format="MM/dd/yyyy"))

C. transactionsDf.apply(from_unixtime(format="MM/dd/yyyy")).asColumn("transactionDateFor matted")

D. transactionsDf.withColumn("transactionDateFormatted", from_unixtime("transactionDate", format="MM/ dd/yyyy"))

E. transactionsDf.withColumn("transactionDateFormatted", from_unixtime("transactionDate"))

Buy Now

Correct Answer: D

Questions 7

Which of the following describes a valid concern about partitioning?

A. A shuffle operation returns 200 partitions if not explicitly set.

B. Decreasing the number of partitions reduces the overall runtime of narrow transformations if there are more executors available than partitions.

C. No data is exchanged between executors when coalesce() is run.

D. Short partition processing times are indicative of low skew.

E. The coalesce() method should be used to increase the number of partitions.

Buy Now

Correct Answer: A

Questions 8

Which of the following describes a way for resizing a DataFrame from 16 to 8 partitions in the most efficient way?

A. Use operation DataFrame.repartition(8) to shuffle the DataFrame and reduce the number of partitions.

B. Use operation DataFrame.coalesce(8) to fully shuffle the DataFrame and reduce the number of partitions.

C. Use a narrow transformation to reduce the number of partitions.

D. Use a wide transformation to reduce the number of partitions.

E. Use operation DataFrame.coalesce(0.5) to halve the number of partitions in the DataFrame.

Buy Now

Correct Answer: C

Questions 9

Which of the following code blocks reduces a DataFrame from 12 to 6 partitions and performs a full shuffle?

A. DataFrame.repartition(12)

B. DataFrame.coalesce(6).shuffle()

C. DataFrame.coalesce(6)

D. DataFrame.coalesce(6, shuffle=True)

E. DataFrame.repartition(6)

Buy Now

Correct Answer: E

Questions 10

Which of the following code blocks returns a DataFrame where columns predError and productId are removed from DataFrame transactionsDf?

Sample of 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.+-------------+---------+-----+-------+---------+----+

A. transactionsDf.withColumnRemoved("predError", "productId")

B. transactionsDf.drop(["predError", "productId", "associateId"])

C. transactionsDf.drop("predError", "productId", "associateId")

D. transactionsDf.dropColumns("predError", "productId", "associateId")

E. transactionsDf.drop(col("predError", "productId"))

Buy Now

Correct Answer: D

The key here is to understand that columns that are passed to DataFrame.drop() are ignored if they do not exist in the DataFrame. So, passing column name associateId to transactionsDf.drop() does not have any effect. Passing a list to transactionsDf.drop() is not valid. The documentation (link below) shows the call structure as DataFrame.drop(*cols). The * means that all arguments that are passed to DataFrame.drop() are read as columns. However, since a list of columns, for example ["predError", "productId", "associateId"] is not a column, Spark will run into an error. More info: pyspark.sql.DataFrame.drop -- PySpark 3.1.1 documentation Static notebook | Dynamic notebook: See test 1, 50 (Databricks import instructions)

Questions 11

Which of the following statements about data skew is incorrect?

A. Spark will not automatically optimize skew joins by default.

B. Broadcast joins are a viable way to increase join performance for skewed data over sort- merge joins.

C. In skewed DataFrames, the largest and the smallest partition consume very different amounts of memory.

D. To mitigate skew, Spark automatically disregards null values in keys when joining.

E. Salting can resolve data skew.

Buy Now

Correct Answer: D

To mitigate skew, Spark automatically disregards null values in keys when joining. This statement is incorrect, and thus the correct answer to the question. Joining keys that contain null values is of particular concern with regard to data skew. In real-world applications, a table may contain a great number of records that do not have a value assigned to the column used as a join key. During the join, the data is at risk of being heavily skewed. This is because all records with a null-value join key are then evaluated as a single large partition, standing in stark contrast to the potentially diverse key values (and therefore small partitions) of the non-null-key records. Spark specifically does not handle this automatically. However, there are several strategies to mitigate this problem like discarding null values temporarily, only to merge them back later (see last link below). In skewed DataFrames, the largest and the smallest partition consume very different amounts of memory. This statement is correct. In fact, having very different partition sizes is the very definition of skew. Skew can degrade Spark performance because the largest partition occupies a single executor for a long time. This blocks a Spark job and is an inefficient use of resources, since other executors that processed smaller partitions need to idle until the large partition is processed. Salting can resolve data skew. This statement is correct. The purpose of salting is to provide Spark with an opportunity to repartition data into partitions of similar size, based on a salted partitioning key. A salted partitioning key typically is a column that consists of uniformly distributed random numbers. The number of unique entries in the partitioning key column should match the number of your desired number of partitions. After repartitioning by the salted key, all partitions should have roughly the same size. Spark does not automatically optimize skew joins by default. This statement is correct. Automatic skew join optimization is a feature of Adaptive Query Execution (AQE). By default, AQE is disabled in Spark. To enable it, Spark's spark.sql.adaptive.enabled configuration option needs to be set to true instead of leaving it at the default false. To automatically optimize skew joins, Spark's spark.sql.adaptive.skewJoin.enabled options also needs to be set to true, which it is by default. When skew join optimization is enabled, Spark recognizes skew joins and optimizes them by splitting the bigger partitions into smaller partitions which leads to performance increases. Broadcast joins are a viable way to increase join performance for skewed data over sort- merge joins. This statement is correct. Broadcast joins can indeed help increase join performance for skewed data, under some conditions. One of the DataFrames to be joined needs to be small enough to fit into each executor's memory, along a partition from the other DataFrame. If this is the case, a broadcast join increases join performance over a sort-merge join. The reason is that a sort-merge join with skewed data involves excessive shuffling. During shuffling, data is sent around the cluster, ultimately slowing down the Spark application. For skewed data, the amount of data, and thus the slowdown, is particularly big. Broadcast joins, however, help reduce shuffling data. The smaller table is directly stored on all executors, eliminating a great amount of network traffic, ultimately increasing join performance relative to the sort-merge join. It is worth noting that for optimizing skew join behavior it may make sense to manually adjust Spark's spark.sql.autoBroadcastJoinThreshold configuration property if the smaller DataFrame is bigger than the 10 MB set by default. More info:

-Performance Tuning - Spark 3.0.0 Documentation

-Data Skew and Garbage Collection to Improve Spark Performance

-Section 1.2 - Joins on Skewed Data ?GitBook

Questions 12

Which of the following code blocks returns a 2-column DataFrame that shows the distinct values in column productId and the number of rows with that productId in DataFrame transactionsDf?

A. transactionsDf.count("productId").distinct()

B. transactionsDf.groupBy("productId").agg(col("value").count())

C. transactionsDf.count("productId")

D. transactionsDf.groupBy("productId").count()

E. transactionsDf.groupBy("productId").select(count("value"))

Buy Now

Correct Answer: D

transactionsDf.groupBy("productId").count()

Correct. This code block first groups DataFrame transactionsDf by column productId and then counts the

rows in each group.

transactionsDf.groupBy("productId").select(count("value")) Incorrect. You cannot call select on a

GroupedData object (the output of a groupBy) statement.

transactionsDf.count("productId")

No. DataFrame.count() does not take any arguments.

transactionsDf.count("productId").distinct()

Wrong. Since DataFrame.count() does not take any arguments, this option cannot be right.

transactionsDf.groupBy("productId").agg(col("value").count()) False. A Column object, as returned by col

("value"), does not have a count() method. You can see all available methods for Column object linked in

the Spark documentation below. More info: pyspark.sql.DataFrame.count -- PySpark 3.1.2 documentation,

pyspark.sql.Column -- PySpark 3.1.2 documentation

Static notebook | Dynamic notebook: See test 3, 41 (Databricks import instructions)

Questions 13

Which of the following describes characteristics of the Spark UI?

A. Via the Spark UI, workloads can be manually distributed across executors.

B. Via the Spark UI, stage execution speed can be modified.

C. The Scheduler tab shows how jobs that are run in parallel by multiple users are distributed across the cluster.

D. There is a place in the Spark UI that shows the property spark.executor.memory.

E. Some of the tabs in the Spark UI are named Jobs, Stages, Storage, DAGs, Executors, and SQL.

Buy Now

Correct Answer: D

Exam Code: DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK
Exam Name: Databricks Certified Associate Developer for Apache Spark 3.0
Last Update: Jul 01, 2026
Questions: 180

PDF (Q&A)

$45.99
ADD TO CART

VCE

$49.99
ADD TO CART

PDF + VCE

$59.99
ADD TO CART

Exam2Pass----The Most Reliable Exam Preparation Assistance

There are tens of thousands of certification exam dumps provided on the internet. And how to choose the most reliable one among them is the first problem one certification candidate should face. Exam2Pass provide a shot cut to pass the exam and get the certification. If you need help on any questions or any Exam2Pass exam PDF and VCE simulators, customer support team is ready to help at any time when required.

Home | Guarantee & Policy |  Privacy & Policy |  Terms & Conditions |  How to buy |  FAQs |  About Us |  Contact Us |  Demo |  Reviews

2026 Copyright @ exam2pass.com All trademarks are the property of their respective vendors. We are not associated with any of them.