wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Spark

Total questions: 9

Worksheet time: 5mins

Name
Class
Date
1.

We can have as many spark sessions as we want per application

a)

Yes

b)

No

2.

Spark works best in which file format?

a)

ORC

b)

CSV

c)

Parquet

d)

Avro

3.

Which one of the following is an action?

a)

groupBy()

b)

count()

c)

where

d)

join

4.

Which of the following operation does NOT involve shuffling?

a)

join

b)

count

c)

groupBy

d)

Window Functions

5.

A New Stage is created in a DAG when

a)

A Narrow Transformation is triggered

b)

A Wide Transformation is Triggered

c)

Any transformation

d)

Cannot be determined

6.

A file size is 588 MB. Spark tries to divide this into how many partitions?

a)

5

b)

4

c)

6

d)

8

7.

In the code below, what lines of code actually get executed when df2.show() is called??

Line1: df=spark.read.csv("sample.csv")

Line2: df2=df.where("dept=='cs'")

Line3: df3=df2.join(df1, ["id"])

Line4: df4=df4.groupBy("name").count()

Line5: df2.show()

a)

All 4 Lines

b)

Line 2-4 Only

c)

Line 1-3 Only

d)

Line 1-2 Only

8.

Give the following code, what is the first step that gets executed when df3.show() is called?

df1 = spark.read.csv("file.csv")

df2 = df1.groupBy("book_id").count()

df3 = df2.where("book_id==2")

df3.show()

a)

It will start grouping the data by book_id df1.groupBy("book_id")

b)

It will first fetch all the counts per book id using df1.groupBy("book_id").count()

c)

It will first get the overall file count and then continue

d)

It will first apply the filter df2.where("book_id==2") and then group by is executed

9.

What is the disadvantage of Spark compared to MapReduce?

a)

Spark is slower than MR

b)

Spark is more resource intensive

c)

Spark doesn't work well with all systems as well as MR does

d)

Spark has no disadvantages at all