Тесты
Язык сайта: Русский
Українська
English
Русский
Тесты по программированию
Вход
Регистрация
Тесты по программированию
Теория
сниппеты
Статьи
Главная
Android
Цены
FAQ
История Cosmo
Правила и условия сервиса
Политика конфиденциальности
Политика в отношении файлов cookie
Обратная Связь
list
:
Язык контента: English
Русский
What is the result of code execution? def init[A](l: List[A]): List[A] = l match { case Nil => sys.error("init of empty list") case Cons(_, Nil) => Nil case Cons(h, t) => Cons(h, init(t)) } init(List(1, 2, 3)) Assuming the following code is available for your reference sealed trait List[+A] case object Nil extends List[Nothing] case class Cons[+A](head: A, tail: List[A]) extends List[A]
list
What is the result of code execution? def init[A](l: List[A]): List[A] = l match { case Nil => sys.error("init of empty list") case Cons(_, Nil) => Nil case Cons(h, t) => Cons(h, init(t)) } init(List(1)) Assuming the following code is available for your reference sealed trait List[+A] case object Nil extends List[Nothing] case class Cons[+A](head: A, tail: List[A]) extends List[A]
list
What will be the result of comparing Lists using eq function? val a = List(1, 2, 3) val b = List(1, 2, 3) a eq b
list
What will be the result of comparing Lists using == function? val a = List(1, 2, 3) val b = List(1, 2, 3) a == b
list
What will be the result of comparing empty lists (Nil)? val a: List[String] = Nil val b: List[Int] = Nil a == Nil // 1 a eq Nil // 2 b == Nil // 3 b eq Nil // 4 a == b // 5 a eq b // 6
list
← Предыдущая
1
2
3
4
Следующая →
Зарегистрируйся сейчас
или
Подпишись на будущие тесты