Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
Option
:
Content language: English
Русский
What will be the result of applying fold to Option in the following code? val number: Option[Int] = Some(3) val noNumber: Option[Int] = None val result1 = number.fold(1)(_ * 3) val result2 = noNumber.fold(1)(_ * 3) println(result1) println(result2)
Option
What will be the result of applying map function to the values of type Option in the following code? val number: Option[Int] = Some(3) val noNumber: Option[Int] = None val result1 = number.map(_ * 1.5) val result2 = noNumber.map(_ * 1.5) println(result1) println(result2)
Option
What will be the result of calling method forall on empty Option? val a = None a.forall(_ == "text")
Option
What will be the result of calling method exists on empty Option? val a = None a.exists(_ == "text")
Option
What will be the result of applying function combine for options, one of which is empty? import cats.implicits._ import cats.kernel.Semigroup Semigroup[Option[Int]].combine(Option(1), None)
Option
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes