MCQs > IT & Programming > Scala > What would be returned by the following function: def foo(l:List[Int]) = { var x=l.head; l.collect{ case a:Int if a>x => x=a; a }; x } When passed: List(2,4,6,8,6,3,1)

Scala MCQs

What would be returned by the following function: def foo(l:List[Int]) = { var x=l.head; l.collect{ case a:Int if a>x => x=a; a }; x } When passed: List(2,4,6,8,6,3,1)

Answer

Correct Answer: 8

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Scala Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Scala Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it