AnsweredAssumed Answered

MapR Certified Spark Developer v1 Study Guide - wrong answer to the sample question

Question asked by psw63 on Apr 11, 2016
Latest reply on Apr 27, 2016 by maprcommunity

Please double check the answer to the 6th Sample Question:


6. Given the pair RDD country that contains tuples of the form ((Country, count)),

which of the following is used to get the country with the lowest number of

refugees in Scala?


Sample Questions Answer Key for this question is Option D, which is not correct. It should be Option C.

Here is the proof:

val countryData = Array(("Afghanistan", 134), ("Albania", 540),("Algeria", 210))

val country = sc.parallelize(countryData)

val lowC =>(x._2,x._1)).sortByKey().first

println(lowC)       //(134,Afghanistan)

val lowD =>(x._2,x._1)).sortByKey(false).first

println(lowD)      //(540,Albania)