



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















PracticeExam Databricks Certified Associate Developer for Apache Spark 3.0 – Python NOTE: ANSWERS KEY PROVIDED ON LAST PAGES Overview This is a practice exam for the Databricks Certified Associate Developer for Apache Spark 3.0 - Python exam. The questions here are retired questions from the actual exam that are representative of the questions one will receive while taking the actual exam. After taking this practice exam, one should know what to expect while taking the actual Associate Developer for Apache Spark 3.0 - Python exam. Just like the actual exam, it contains 60 multiple-choice questions. Each of these questions has one correct answer. The correct answer for each question is listed at the bottom in the Correct Answers section. There are a few more things to be aware of:
D. There will be a lot of overhead associated with managing resources for data processing within each task. E. There might be risk of out-of-memory errors depending on the size of the executors in the cluster. Question 8 Which of the following operations will trigger evaluation? A. DataFrame.filter() B. DataFrame.distinct() C. DataFrame.intersect() D. DataFrame.join() E. DataFrame.count() Question 9 Which of the following describes the difference between transformations and actions? A. Transformations work on DataFrames/Datasets while actions are reserved for native language objects. B. There is no difference between actions and transformations. C. Actions are business logic operations that do not induce execution while transformations are execution triggers focused on returning results. D. Actions work on DataFrames/Datasets while transformations are reserved for native language objects. E. Transformations are business logic operations that do not induce execution while actions are execution triggers focused on returning results. Question 10 Which of the following DataFrame operations is always classified as a narrow transformation? A. DataFrame.sort() B. DataFrame.distinct() C. DataFrame.repartition() D. DataFrame.select() E. DataFrame.join() Question 11 Spark has a few different execution/deployment modes: cluster, client, and local. Which of the following describes Spark's execution/deployment mode?
A. Spark's execution/deployment mode determines where the driver and executors are physically located when a Spark application is run B. Spark's execution/deployment mode determines which tasks are allocated to which executors in a cluster C. Spark's execution/deployment mode determines which node in a cluster of nodes is responsible for running the driver program D. Spark's execution/deployment mode determines exactly how many nodes the driver will connect to when a Spark application is run E. Spark's execution/deployment mode determines whether results are run interactively in a notebook environment or in batch Question 12 Which of the following cluster configurations will ensure the completion of a Spark application in light of a worker node failure? Note: each configuration has roughly the same compute power using 100GB of RAM and 200 cores. A. Scenario # B. They should all ensure completion because worker nodes are fault-tolerant. C. Scenario # D. Scenario # E. Scenario # Question 13 Which of the following describes out-of-memory errors in Spark? A. An out-of-memory error occurs when either the driver or an executor does not have enough memory to collect or process the data allocated to it.
D. DataFrame.coalesce(n) E. DataFrame.persist() Question 17 Which of the following data structures are Spark DataFrames built on top of? A. Arrays B. Strings C. RDDs D. Vectors E. SQL Tables Question 18 Which of the following code blocks returns a DataFrame containing only column storeId and column division from DataFrame storesDF? A. storesDF.select("storeId").select("division") B. storesDF.select(storeId, division) C. storesDF.select("storeId", "division") D. storesDF.select(col("storeId", "division")) E. storesDF.select(storeId).select(division) Question 19 Which of the following code blocks returns a DataFrame containing all columns from DataFrame storesDF except for column sqft and column customerSatisfaction? A sample of DataFrame storesDF is below: A. storesDF.drop("sqft", "customerSatisfaction")
B. storesDF.select("storeId", "open", "openDate", "division") C. storesDF.select(-col(sqft), - col(customerSatisfaction)) D. storesDF.drop(sqft, customerSatisfaction) E. storesDF.drop(col(sqft), col(customerSatisfaction)) Question 20 The below code shown block contains an error. The code block is intended to return a DataFrame containing only the rows from DataFrame storesDF where the value in DataFrame storesDF 's "sqft" column is less than or equal to 25,000. Assume DataFrame storesDF is the only defined language variable. Identify the error. Code block: storesDF.filter(sqft <= 25000) A. The column name sqft needs to be quoted like storesDF.filter("sqft" <= 25000). B. The column name sqft needs to be quoted and wrapped in the col() function like storesDF.filter(col("sqft") <= 25000). C. The sign in the logical condition inside filter() needs to be changed from <= to >. D. The sign in the logical condition inside filter() needs to be changed from <= to >=. E. The column name sqft needs to be wrapped in the col() function like storesDF.filter(col(sqft) <= 25000). Question 21 The code block shown below should return a DataFrame containing only the rows from DataFrame storesDF where the value in column sqft is less than or equal to 25,000 OR the value in column customerSatisfaction is greater than or equal to 30. Choose the response that correctly fills in the numbered blanks within the code block to complete this task. Code block: storesDF. 1 ( 2 3 4 ) A.
Question 24 Which of the following code blocks returns a new DataFrame from DataFrame storesDF where column numberOfManagers is the constant integer 1? A. storesDF.withColumn("numberOfManagers", col(1)) B. storesDF.withColumn("numberOfManagers", 1) C. storesDF.withColumn("numberOfManagers", lit(1)) D. storesDF.withColumn("numberOfManagers", lit("1")) E. storesDF.withColumn("numberOfManagers", IntegerType(1)) Question 25 The code block shown below contains an error. The code block intends to return a new DataFrame where column storeCategory from DataFrame storesDF is split at the underscore character into column storeValueCategory and column storeSizeCategory. Identify the error. A sample of DataFrame storesDF is displayed below: Code block: (storesDF.withColumn( "storeValueCategory", col("storeCategory").split("")[0] ).withColumn( "storeSizeCategory", col("storeCategory").split("")[1] ) ) A. The split() operation comes from the imported functions object. It accepts a string column name and split character as arguments. It is not a method of a Column object.
B. The split() operation comes from the imported functions object. It accepts a Column object and split character as arguments. It is not a method of a Column object. C. The index values of 0 and 1 should be provided as second arguments to the split() operation rather than indexing the result. D. The index values of 0 and 1 are not correct — they should be 1 and 2, respectively. E. The withColumn() operation cannot be called twice in a row. Question 26 Which of the following operations can be used to split an array column into an individual DataFrame row for each element in the array? A. extract() B. split() C. explode() D. arrays_zip() E. unpack() Question 27 Which of the following code blocks returns a new DataFrame where column storeCategory is an all-lowercase version of column storeCategory in DataFrame storesDF? Assume DataFrame storesDF is the only defined language variable. A. storesDF.withColumn("storeCategory", lower(col("storeCategory"))) B. storesDF.withColumn("storeCategory", col("storeCategory").lower()) C. storesDF.withColumn("storeCategory", tolower(col("storeCategory"))) D. storesDF.withColumn("storeCategory", lower("storeCategory")) E. storesDF.withColumn("storeCategory", lower(storeCategory)) Question 28 The code block shown below contains an error. The code block is intended to return a new DataFrame where column division from DataFrame storesDF has been renamed to column state and column managerName from DataFrame storesDF has been renamed to column managerFullName. Identify the error. Code block:
A. storesDF.agg(approx_count_distinct(col("division")).alias("divi sionDistinct")) B. storesDF.agg(approx_count_distinct(col("division"), 0).alias("divisionDistinct")) C. storesDF.agg(countDistinct(col("division")).alias("divisionDist inct")) D. storesDF.select("division").dropDuplicates().count() E. storesDF.select("division").distinct().count()
Question 32 The code block shown below should return a new DataFrame with the mean of column sqft from DataFrame storesDF in column sqftMean. Choose the response that correctly fills in the numbered blanks within the code block to complete this task. Code block: storesDF. 1 ( 2 ( 3 ).alias("sqftMean")) A.
B. There is no argument specified to the withReplacement parameter. C. The sample() operation does not sample without replacement — sampleby() should be used instead. D. The sample() operation is not reproducible. E. The first argument True sets the sampling to be with replacement. Question 38 Which of the following operations can be used to return the top n rows from a DataFrame? A. DataFrame.n() B. DataFrame.take(n) C. DataFrame.head D. DataFrame.show(n) E. DataFrame.collect(n) Question 39 The code block shown below should extract the value for column sqft from the first row of DataFrame storesDF. Choose the response that correctly fills in the numbered blanks within the code block to complete this task. Code block:
storesDF
first
col("sqft") B.
storesDF
first
sqft C.
storesDF
first
["sqft"] D.
storesDF
first()
D. spark.createDataFrame(years) E. spark.createDataFrame(years, IntegerType) Question 45 Which of the following operations can be used to cache a DataFrame only in Spark’s memory assuming the default arguments can be updated? A. DataFrame.clearCache() B. DataFrame.storageLevel C. StorageLevel D. DataFrame.persist() E. DataFrame.cache() Question 46 The code block shown below contains an error. The code block is intended to return a new 4 - partition DataFrame from the 8 - partition DataFrame storesDF without inducing a shu e. Identify the error. Code block: storesDF.repartition(4) A. The repartition operation will only work if the DataFrame has been cached to memory. B. The repartition operation requires a column on which to partition rather than a number of partitions. C. The number of resulting partitions, 4, is not achievable for an 8 - partition DataFrame. D. The repartition operation induced a full shu e. The coalesce operation should be used instead. E. The repartition operation cannot guarantee the number of result partitions. Question 47 Which of the following code blocks will always return a new 12 - partition DataFrame from the 8 - partition DataFrame storesDF? A. storesDF.coalesce(12) B. storesDF.repartition() C. storesDF.repartition(12) D. storesDF.coalesce() E. storesDF.coalesce(12, "storeId")
Question 48 Which of the following Spark config properties represents the number of partitions used in wide transformations like join()? A. spark.sql.shuffle.partitions B. spark.shuffle.partitions C. spark.shuffle.io.maxRetries D. spark.shuffle.file.buffer E. spark.default.parallelism Question 49 In what order should the below lines of code be run in order to return a DataFrame containing a column openDateString , a string representation of Java’s SimpleDateFormat? Note that column openDate is of type integer and represents a date in the UNIX epoch format — the number of seconds since midnight on January 1st, 1970. An example of Java's SimpleDateFormat is "Sunday, Dec 4, 2008 1:05 PM". A sample of storesDF is displayed below: Lines of code: