Home / CSE MCQs / Scala-1 ::

CSE MCQs :: Scala-1

  1. How should we end a stream to calculate sum of elements?
  2. A.
    Sink.sum_
    B.
    Sink.fold[Int, Int](0)(_ + _)
    C.
    Sink.sum[Int](_)
    D.
    Sink.map(_ + _)

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is the advantage of Scala?
  4. A.
    Less error prone functional style
    B.
    High maintainability and productivity
    C.
    High scalability
    D.
    All of these

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What are the Scala variables?
  6. A.
    var myVar : Int=0;
    B.
    val myVal: Int=1;
    C.
    Both A and B
    D.
    None

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. When can you use traits?
  8. A.
    If the behaviour will not be reused, then make it a concrete class. Anyhow it is not a reusable behaviour
    B.
    In order to inherit from it in Java code, an abstract class can be used
    C.
    If efficiency is a priority then lean towards using a class
    D.
    All of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Programming language which uses both object-oriented programming and functional programming paradigms is
  10. A.
    Scala
    B.
    Ada
    C.
    Pascal
    D.
    Machine language

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Scala is a short form of
  12. A.
    Scalable language
    B.
    Sequential language
    C.
    Script language
    D.
    Scalar language

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What are the few collections in Scala?
  14. A.
    Array
    B.
    List
    C.
    Sets
    D.
    All of these

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. One of the following is an erroneous function definition, can you spot it
  16. A.
    def functionName(x:Int,y:Int):Int=x+y
    B.
    def functionName(x:Int,y:Int):Int={return x+y}
    C.
    def functionName(x:Int,y:Int):Int{x+y} ()
    D.
    def functionName(x:Int,y:Int)={x+y}

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. A FUNCTOR must have?
  18. A.
    map function
    B.
    flatMap function
    C.
    map and flatMap both
    D.
    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What are three main part of akka streams?
  20. A.
    Source, Flow, Sink
    B.
    Source, Flow, BidirectionalFlow
    C.
    ReactiveStream, Source, Flow
    D.
    Stream, Source, Reactive

    View Answer

    Workspace

    Discuss Discuss in Forum