What is the output of the following code ?

Note: Assume necessary imports have been done

object DemoApp extends App {
def findDivision(number: Int) =
Future {
5 / number
}
val response = findDivision(0)
response.onSuccess { case value => print(value) } //Line1
Thread.sleep(5)
}

Nothing will be printed on screen

java.lang.ArithmeticException: / by zero

Failure("java.lang.ArithmeticException: / by zero")

Success("java.lang.ArithmeticException: / by zero")

Verified Answer
Correct Option - a

To get all Infosys Certified Scala Programmer Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in