What is the output of the following code

0 votes
What is the output of the following code?

sc.parallelize(array(1L,("SFO")),(2L,("ORD")),(3L,("DFW"))))

va1 routes= sc.parallelize

(array(edge(1L,2L,1800),edge(2L,3L,800),edge(3L,1L,1400)))

va1 nowhere ="nowhere"

va1 graph - graph(airports,routes,nowhere)

graph.triplets.collect().foreach(ptintln)

Option a) (SFO,ORD,1800)

                (ORD,DFW,800)

                (DFW,SFO,1400)

Option b) (1,2,1800)

                (2,3,800)

                (3,1,1400)

Option c) ((1,SFO),(2,ORD),1800)

                ((2,ORD),(3,DFW),800)

                ((3,DFW),(1,SFO),1400)

Option d) run time error
Nov 25, 2020 in Apache Spark by ritu
• 960 points
953 views

1 answer to this question.

0 votes

After executing your code, there is an error I found:

: error: expected class or object definition
So, its Option d
answered Nov 25, 2020 by Gitika
• 65,770 points

Related Questions In Apache Spark

0 votes
0 answers

What is the output of the following code?

What is the output of the following ...READ MORE

Nov 25, 2020 in Apache Spark by Edureka
• 200 points

closed Nov 26, 2020 by MD 775 views
–1 vote
0 answers
0 votes
1 answer

What is the work of Yield Keyword in Scala?

Hey, Used with a loop, yield produces a value for ...READ MORE

answered Jul 26, 2019 in Apache Spark by Gitika
• 65,770 points
933 views
0 votes
1 answer

What is the use of App class in Scala?

Hi, Scala provides a helper class, called App, that ...READ MORE

answered Jul 31, 2019 in Apache Spark by Gitika
• 65,770 points
11,376 views
+1 vote
0 answers

What is the use case of map and flatMap?

What is the major use case for ...READ MORE

Aug 25, 2019 in Apache Spark by anonymous
• 130 points

closed Aug 26, 2019 by Omkar 1,660 views
0 votes
1 answer
0 votes
1 answer

2)What will be printed when the below code is executed ?

Hi, @Ritu, List(5,100,10) is printed. The take method returns the first n elements in ...READ MORE

answered Nov 23, 2020 in Apache Spark by Gitika
• 65,770 points
774 views
0 votes
1 answer
0 votes
1 answer

What is the output of the following code?

rror: expected class or object definition sc.parallelize(Array(1L,("SFO")),(2L,("ORD")),(3L,("DFW")))) ^ one error ...READ MORE

answered Nov 26, 2020 in Apache Spark by Gitika
• 65,770 points
885 views
0 votes
1 answer

What is the advantage of having immutability in design for Scala programming language?

Hi, Scala uses immutability by default in most ...READ MORE

answered Jul 24, 2019 in Apache Spark by Gitika
• 65,770 points
759 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP