Scala Quiz - 2

Beschreibung

This is the 2nd quiz for Scala.IO
himanshu arora
Quiz von himanshu arora, aktualisiert more than 1 year ago
himanshu arora
Erstellt von himanshu arora vor etwa 7 Jahre
58
0

Zusammenfassung der Ressource

Frage 1

Frage
What's a higher order function ?
Antworten
  • A function that takes another function as argument
  • A function that returns a function
  • Any of the above two
  • None of above

Frage 2

Frage
Which of the following is most adapted for parallel processing ?
Antworten
  • Akka Actors
  • Scala Futures
  • Scala Options
  • Scala Either

Frage 3

Frage
val result = for { x <- Future(20) y <- Future(10) if y > 10 } yield x + y what's the value of result ?
Antworten
  • Success(30)
  • 30
  • Failure

Frage 4

Frage
Which one is FALSE about an actor akka ?
Antworten
  • Can communicate with an actor using tell function
  • Can communicate with an actor using ask pattern
  • Messages can be passed to an actor using ActorRef handle of that actor
  • Messages can be passed to an actor using Actor instance of that actor

Frage 5

Frage
A monad is a functor which also has a flatMap ?
Antworten
  • True
  • False

Frage 6

Frage
What's NOT true about a type class in scala ?
Antworten
  • It enables ad hoc polymorphism
  • It uses implicts, implicitly and bound context syntax
  • Addition of a new functionality in type class can be done without any changes to the original code
  • Type class is an abstract class

Frage 7

Frage
SBT performs incremental recompilations ?
Antworten
  • True
  • False

Frage 8

Frage
val mySeq = Seq("Hello world", "Hello how are you", "Are you well", "Hello guys") val result = mySeq.flatMap(_.split(" ")).map(_.length).filter(v => v < 4).reduce(_ + _) What's result ?
Antworten
  • 28
  • 43
  • 15
  • None of the above

Frage 9

Frage
trait F[-A] { } What does -A represent ?
Antworten
  • Covariant type parameter
  • Contravariant type parameter
  • Lower bound
  • Upper bound

Frage 10

Frage
Choose right responses for a partial function (multiple responses possible)
Antworten
  • A PartialFunction must provide a method isDefinedAt
  • A PartialFunction must provide a method apply
  • Can be lifted to a normal function with return type wrapped in an option
  • Akka actor's receive method is not an example of partial function
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

CCNA Security 210-260 IINS - Exam 3
Mike M
Application of technology in learning
Jeff Wall
Innovative Uses of Technology
John Marttila
Ch1 - The nature of IT Projects
mauricio5509
The Internet
Gee_0599
CCNA Answers – CCNA Exam
Abdul Demir
SQL Quiz
R M
Professional, Legal, and Ethical Issues in Information Security
mfundo.falteni
System Analysis
R A
Flash Cards Networks
JJ Pro Wrestler
EDUC260- Multimodal Literacies for a Digital Age
angelwoo2002