Download our latest MNC Answers Application at Play Store. Download Now

Scala Constructs MCQs Solution | TCS Fresco Play

Disclaimer: The primary purpose of providing this solution is to assist and support anyone who are unable to complete these courses due to a technical issue or a lack of expertise. This website's information or data are solely for the purpose of knowledge and education.

Make an effort to understand these solutions and apply them to your Hands-On difficulties. (It is not advisable that copy and paste these solutions).

All Question of the MCQs Present Below for Ease Use Ctrl + F with the question name to find the Question. All the Best!


1. Which of the following are the key concepts of Functional Programming a. Immutability b. Pure functions c. Inheritance d. Referential Transparency .

a,b,d


2. Functional programming language cannot be an object oriented language too (True/False)

False


3. Scala is a pure functional programming language (True/False)

False


4. You can modify an immutable object once created (Yes/No)

No


5. Can the following pseudo function be considered a pure function ? function getMeTimeAdded(arg Integer) = currentTime + Integer

No


6. For the given statement,

val s = List(1,2,3)


7. What would be the type of s?

.......List[Int]


8. Is this a valid expression val f: Int = (x: Int) => x + 1

No


9. What is the preferred qualifier for defining a variable in Scala.

val


10. What would be the output of following snippet

val s = List(1,2,3,4)

val t = List(5,6,7,8)

val n = s ++ t

println(n)

.......List(1, 2, 3, 4, 5, 6, 7, 8)


11. What is the default class List is imported from ?

scala.collection.immutable


12. What would be the output of following code snippet.

val l = List(1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 5, 5, 8)

println(l.take(3))

.............List(1,1,1)


13. AnyVal is best type of all primitive data types

True


14. Scala supports only single inheritance

False


15. Scalability is an important trait of a functional programming language?

False


16. Consider the following code snippet

def prnt = {print("scala"); 1}

def fun(a:Int,b: => Int) = print(a)


17. What will be the output for function call fun(prnt,5)?

............scala1


18. Is this operation valid

var s = "String 1"

...

...

s = "String 2"

................Yes



19. Which of the following programming paradigm does Scala support?

All the above


20. Scala classes can contain static members

False


21. AnyVal is best type of all primitive data types

False


22. Which of the following type allows only single instance to exist in global scope

def.....object


23. Which of the following cannot have a constructor

trait


24. Functions are first class objects in function programming

True


25. Consider the following code snippet (a: Int) => a*a. Above code snippet is an example of

anonymous function


26. Which one is the correct expression?

val f = (x: Int) => x + 1


27. Expressions in Scala evaluated using method called?

substitution


28. Scala compiler will compile the following expression successfully

val s: Int = 5.5

False


29. Which all frameworks are developed using Scala

Spark


30. Object keyword is used to define a singleton class in Scala

True


31. Given the following snippet, what would be the output

val l = List(1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 5, 5, 8)

println(l.drop(10)

................List(3, 5, 5, 8)


32. Which of the following expression has side effect

var y = 0; def Inc = y=y+1


33. Which of the following feature in Java resembles trait in Scala

abstract class


34. Scala can be run only on JVM.

False


35. Singleton is created in Scala using keyword

Object


36. In functional programming language functions can be

can only be passed as call by value.....can pass as an argument


37. Singleton object in Scala can be made executable

by extending App or with the main function


38. Scala has immutable collections

True


39. What would be the output of this code

val n = List(1,2,3,4,5)

println(n.map(_ % 2))

............List(1, 0, 1, 0, 1)


40. Mentioning function return type is optional in Scala

True


41. Mathematical functions are best implemented in?

functional programming language



If you have any queries, please feel free to ask on the comment section.

If you want MCQs and Hands-On solutions for any courses, Please feel free to ask on the comment section too.

Please share and support our page!