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

Programming with Scala MCQs Solution | TCS Fresco Play

Programming with Scala MCQs Solution | TCS Fresco Play


Programming with Scala 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)
What would be the type of s?
.......List[Int]

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

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

9. 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)

10. What is the default class List is imported from ?
scala.collection.immutable



11. 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)

12. AnyVal is best type of all primitive data types
True

13. Scala supports only single inheritance
False

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

15. Consider the following code snippet
def prnt = {print("scala"); 1}
def fun(a:Int,b: => Int) = print(a)

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



17. Is this operation valid
var s = "String 1"
...
...
s = "String 2"
................Yes

18. Which of the following programming paradigm does Scala support?
All the above

19. Scala classes can contain static members
False

20. AnyVal is best type of all primitive data types
False

21. Which of the following type allows only single instance to exist in global scope
def.....object



22. Which of the following cannot have a constructor
trait

23. Functions are first class objects in function programming
True

24. Consider the following code snippet (a: Int) => a*a. Above code snippet is an example of anonymous function. Which one is the correct expression?
val f = (x: Int) => x + 1

25. Expressions in Scala evaluated using method called?
substitution

26. Scala compiler will compile the following expression successfully
val s: Int = 5.5
False

27. Which all frameworks are developed using Scala
Spark

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

29. 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)



30. Which of the following expression has side effect
var y = 0; def Inc = y=y+1

31. Which of the following feature in Java resembles trait in Scala
abstract class

32. Scala can be run only on JVM.
False

33. Singleton is created in Scala using keyword
Object

34. In functional programming language functions can be
can only be passed as call by value.....can pass as an argument
Singleton object in Scala can be made executable
by extending App or with the main function
Scala has immutable collections
True



35. 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)

36. Mentioning function return type is optional in Scala
True

37. Mathematical functions are best implemented in?
functional programming language


**************************************************
Credit for the above notes, goes to the respective owners. 

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!