Pass the Databricks Databricks Certification Databricks-Certified-Associate-Developer-for-Apache-Spark-3.0 Questions and answers with CertsForce

Viewing page 6 out of 6 pages
Viewing questions 51-60 out of questions
Questions # 51:

The code block displayed below contains an error. The code block should read the csv file located at path data/transactions.csv into DataFrame transactionsDf, using the first row as column header

and casting the columns in the most appropriate type. Find the error.

First 3 rows of transactions.csv:

1.transactionId;storeId;productId;name

2.1;23;12;green grass

3.2;35;31;yellow sun

4.3;23;12;green grass

Code block:

transactionsDf = spark.read.load("data/transactions.csv", sep=";", format="csv", header=True)

Options:

A.

The DataFrameReader is not accessed correctly.


B.

The transaction is evaluated lazily, so no file will be read.


C.

Spark is unable to understand the file type.


D.

The code block is unable to capture all columns.


E.

The resulting DataFrame will not have the appropriate schema.


Expert Solution
Questions # 52:

The code block displayed below contains an error. The code block should count the number of rows that have a predError of either 3 or 6. Find the error.

Code block:

transactionsDf.filter(col('predError').in([3, 6])).count()

Options:

A.

The number of rows cannot be determined with the count() operator.


B.

Instead of filter, the select method should be used.


C.

The method used on column predError is incorrect.


D.

Instead of a list, the values need to be passed as single arguments to the in operator.


E.

Numbers 3 and 6 need to be passed as string variables.


Expert Solution
Questions # 53:

The code block shown below should return only the average prediction error (column predError) of a random subset, without replacement, of approximately 15% of rows in DataFrame

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

transactionsDf.__1__(__2__, __3__).__4__(avg('predError'))

Options:

A.

1. sample

2. True

3. 0.15

4. filter


B.

1. sample

2. False

3. 0.15

4. select


C.

1. sample

2. 0.85

3. False

4. select


D.

1. fraction

2. 0.15

3. True

4. where


E.

1. fraction

2. False

3. 0.85

4. select


Expert Solution
Questions # 54:

Which of the following statements about executors is correct, assuming that one can consider each of the JVMs working as executors as a pool of task execution slots?

Options:

A.

Slot is another name for executor.


B.

There must be less executors than tasks.


C.

An executor runs on a single core.


D.

There must be more slots than tasks.


E.

Tasks run in parallel via slots.


Expert Solution
Viewing page 6 out of 6 pages
Viewing questions 51-60 out of questions