What is the output of the following block of code | Scala Question 13

89. What is the output of the following block of code -

object myObject { 
	def main(args: Array[String]) { 
		println((  div(mul(452)) ))
	} 
	
	val mul = (a: Int)=> { 
		a * 100
	} 
	
	val div = (a: Int) =>{ 
		a / 500
	} 
}
  1. 45200
  2. 0
  3. 90
  4. Error

Answer: C) 90

Explanation:

Here, functions are used in composition and the result is an integer value that causes the loss in data.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.