wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Pyspark day 1

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is Pyspark?

a)

A new species of snake

b)

A type of firework

c)

Python API for Apache Spark

d)

A type of computer virus

2.

What are the advantages of using Pyspark?

a)

Pyspark has no advantages compared to other big data tools

b)

Pyspark has limited APIs in Python

c)

Pyspark offers easy integration with other big data tools, high-level APIs in Python, and a powerful processing engine.

d)

Pyspark has a slow processing engine

3.

Explain the concept of Resilient Distributed Datasets (RDDs) in Pyspark.

a)

RDDs cannot be rebuilt if a partition is lost

b)

RDDs are only stored in a single node in a cluster

c)

RDDs are a fundamental data structure in Pyspark that represents a collection of items distributed across multiple nodes in a cluster, and they are resilient in the sense that they can be rebuilt if a partition is lost.

d)

RDDs are a type of database in Pyspark

4.

How can you create an RDD in Pyspark?

a)

sc.makeRDD(data)

b)

spark.createRDD(data)

c)

sc.parallelize(data)

5.

What are the different transformations in Pyspark?

a)

transform

b)

There are various transformations in Pyspark such as map, filter, reduce, flatMap, groupByKey, reduceByKey, sortByKey, join, and many more.

c)

aggregate

d)

sort

6.

Explain the map transformation in Pyspark.

a)

Map transformation only works on numeric data in Pyspark.

b)

Map transformation applies a function to the entire RDD at once.

c)

Map transformation applies a function to each element in the RDD and returns a new RDD.

d)

Map transformation returns the original RDD without any changes.

7.

What is the difference between map and flatMap transformations in Pyspark?

a)

The map transformation applies a function that returns an iterator and then flattens the result.

b)

The flatMap transformation applies a function to each element of the RDD independently.

c)

Map and flatMap transformations are the same and can be used interchangeably.

d)

The map transformation applies a function to each element of the RDD independently, while the flatMap transformation applies a function that returns an iterator and then flattens the result.

8.

What are actions in Pyspark?

a)

Statements that control the flow of the program

b)

Variables used to store data in Pyspark

c)

Functions that define the structure of the data

d)

Operations that trigger the execution of the Spark job

9.

What is the purpose of the collect action in Pyspark?

a)

To retrieve all the elements of a distributed dataset and bring them back to the driver program.

b)

To split the elements of a distributed dataset into multiple partitions

c)

To delete elements from a distributed dataset

d)

To shuffle the elements of a distributed dataset

10.

Explain the take action in Pyspark.

a)

Return a new RDD containing only the elements that satisfy a predicate function.

b)

Return a new RDD containing all elements

c)

Return a new DataFrame

d)

Return a new RDD containing elements that do not satisfy the predicate function