Databricks Certified Associate Developer for Apache Spark 3.0 Exam Practice Test

Page: 1 / 14
Total 180 questions

Question 1

Which of the following code blocks returns a single-column DataFrame of all entries in Python list throughputRates which contains only float-type values ?



Answer : E

Question 2

The code block shown below should return a DataFrame with all columns of DataFrame transactionsDf, but only maximum 2 rows in which column productId has at least the value 2. Choose the

answer that correctly fills the blanks in the code block to accomplish this.

transactionsDf.__1__(__2__).__3__



Answer : D

Question 3

Which of the following code blocks returns a single-row DataFrame that only has a column corr which shows the Pearson correlation coefficient between columns predError and value in DataFrame

transactionsDf?



Answer : D

Question 4

Which of the following code blocks applies the Python function to_limit on column predError in table transactionsDf, returning a DataFrame with columns transactionId and result?



Answer : A

Question 5

Which of the following code blocks reads in the JSON file stored at filePath, enforcing the schema expressed in JSON format in variable json_schema, shown in the code block below?

Code block:

1. json_schema = """

2. {"type": "struct",

3. "fields": [

4. {

5. "name": "itemId",

6. "type": "integer",

7. "nullable": true,

8. "metadata": {}

9. },

10. {

11. "name": "supplier",

12. "type": "string",

13. "nullable": true,

14. "metadata": {}

15. }

16. ]

17. }

18. """



Answer : B

Question 6

The code block shown below should return a new 2-column DataFrame that shows one attribute from column attributes per row next to the associated itemName, for all suppliers in column supplier

whose name includes Sports. Choose the answer that correctly fills the blanks in the code block to accomplish this.

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

Code block:

itemsDf.__1__(__2__).select(__3__, __4__)



Answer : E

Question 7

The code block shown below should add a column itemNameBetweenSeparators to DataFrame itemsDf. The column should contain arrays of maximum 4 strings. The arrays should be composed of

the values in column itemsDf which are separated at - or whitespace characters. Choose the answer that correctly fills the blanks in the code block to accomplish this.

Sample of DataFrame itemsDf:

1. +------+----------------------------------+-------------------+

2. |itemId|itemName |supplier |

3. +------+----------------------------------+-------------------+

4. |1 |Thick Coat for Walking in the Snow|Sports Company Inc.|

5. |2 |Elegant Outdoors Summer Dress |YetiX |

6. |3 |Outdoors Backpack |Sports Company Inc.|

7. +------+----------------------------------+-------------------+

Code block:

itemsDf.__1__(__2__, __3__(__4__, "[\s\-]", __5__))



Answer : A

Page:    1 / 14   
Total 180 questions