17th
Apr
Scala MCQ

Scala MCQ

  • Admin
  • 17th Apr, 2021
  • 371 Followers

Scala MCQ

Following are mostly asked Scala MCQ test that are designed for professionals like you to crack you interviews. You can take this Scala online test before appearing to you real interview. This Scala quiz there are around 30+ multiple choice questions on Scala with four options.

1) What is a type class in Scala?

  • A. A class that performs boxing of a certain data type
  • B. A companion class
  • C. A trait with at least one type variable
  • D. None of the above

2) Which of the following statements are true about iterators?

  • A. To get the next item, we use next()
  • B. We can use the method hasNext to find out if it has another element left
  • C. They yield the next element in the iterator
  • D. All of the above

3) What is Scala?

  • A. programming language
  • B. framework
  • C. platform
  • D. All of the above

4) What is a monad in Scala?

  • A. A function with a single parameter
  • B. An object that wraps another
  • C. A singleton object
  • D. None of the above

5) Scala is a general-purpose programming language that provids support for both object-oriented programming and functional programming.

  • A. True
  • B. False
Download Free : Scala MCQ PDF

6) Scala is an acronym for “Scalable Language”.

  • A. True
  • B. False

7) Is Scala a pure object-oriented language?

  • A. Yes
  • B. No

8) What is the advantage of Scala?

  • A. Less error prone functional style
  • B. High maintainability and productivity
  • C. High scalability
  • D. All of these

9) A FUNCTOR must have ___.

  • A. map function
  • B. flatMap function
  • C. map and flatMap both
  • D. None of the above

10) What does the following code do with var countries=List("brazil", "argentina", "colombia")? println{ countries.reduceLeft[String]{(c1: String, c2: String)=> s"$c1, $c2" } }

  • A. It prints "$c1, $c2"
  • B. It prints List("brazil", "argentina", "colombia")
  • C. It prints "brazil", "argentina", "colombia"
  • D. It prints brazil, argentina, colombia

11) In Scala, apply() serves the purpose of closing the gap between Object-Oriented and Functional paradigms.

  • A. True
  • B. False

12) The ___ method is utilized to select an element in the list by its index.

  • A. apply()
  • B. unapply()
  • C. Both A and B
  • D. All of the above

13) Without an explicit import, maps in Scala are by default:

  • A. Immutable
  • B. Mutable

14) What is Scala’s programming paradigm?

  • A. Statically-Typed
  • B. Functional
  • C. Object-Oriented
  • D. All of these

15) Omitting a semicolon(;) at the end of a statement causes the compiler to throw an error.

  • A. False
  • B. True

16) Is UNIT a data type in Scala?

  • A. Yes
  • B. No

17) Which of the following not shows how to declare variables of the basic numeric types?

  • A. val b: Byte = 1
  • B. val s: Short = 1
  • C. val d: Double = 2.0
  • D. val f: Float = 3.0
  • E. None of the above

18) A list is a collection which contains ___ data.

  • A. immutable
  • B. mutable
  • C. Both A and B
  • D. None of the above

19) Which one of the following is a feature of Scala strings?

  • A. It can be changed.
  • B. It is mutable object.
  • C. It allows to create multiline strings by including the string inside three double-quotes.
  • D. All of the above

20) How can you format a string?

  • A. Val formatted= “%s %i”.format (mystring.myInt)
  • B. Val formatted= “%s %i”.formatted (mystring.myInt)
  • C. Val formatted= “%s %i”.formatstring(mystring.myInt)
  • D. Val formatted= “%s %i”.formatstrings(mystring.myInt)

21) Scala is designed by _______.

  • A. Guido van Rossum
  • B. John Von Neumann
  • C. Martin Odersky
  • D. None of the above

22) Scala runs on the _____ platform.

  • A. C
  • B. C++
  • C. JavaScript
  • D. Java

23) _____ is a Scala compiler that compiles to JavaScript.

  • A. Scala.py
  • B. Scala.js
  • C. Scala.tkt
  • D. None of the above

24) _____ is a Scala compiler that compiles to JavaScript.

  • A. Scala.py
  • B. Scala.js
  • C. Scala.tkt
  • D. None of the above

25) Scala has singleton objects, which are essentially classes with only one instance.

  • A. True
  • B. False

26) Scala was released in the year ______.

  • A. 2002
  • B. 2004
  • C. 2003
  • D. 2005

27) Which among the following is a Scala Web Frameworks?

  • A. The Lift Framework
  • B. The Bowler framework
  • C. The Play framework
  • D. All of the above

28) We can execute a Scala program in ______ modes.

  • A. interactive mode
  • B. script mode
  • C. Both A and B
  • D. None of the above

29) The ‘scalac’ command is used to compile the Scala program and it will generate a few class files in the current directory.

  • A. True
  • B. False

30) The null value is of type _______.

  • A. scala.Null
  • B. scl.Null
  • C. Both A and B
  • D. None of the above

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.