Q1. What is a pure function?
A1. A pure function is a function where the following conditions are met:
1) The Input solely determines the output.
…
Q1. What is a pure function?
A1. A pure function is a function where the following conditions are met:
1) The Input solely determines the output.
…
This extends Scala Functional Programming basics – pure functions, referential transparency, side effects, etc.
Q1. What is a first-class function?
A1.
…
Q. Can you explain the concepts used in the below code? Output: A. The above code runs the function “(x:Int) =x + 2” … Read more ›...
100+ FAQ Scala interview questions answered with code. Learn more about FP – 6 tips to transforming your thinking from OOP/imperative programming to functional programming (i.e. FP). … Read more...
Let’s see how we can wire up functions with & without currying, and then touch on functional composition. Without currying Here are simple functions example that add, add10, … Read...
This extends Q1 – Q5 Scala Functional Programming basics interview questions & answers Q6. What is a curried function in Scala? A6. … Read more ›...
Q13. What are the different approaches in Scala to solve the following task?
Given numbers 1 to 6, and you need to extract out the odd numbers and double them,
…
Java has idioms like Try-Catch-Finally, Scala has idioms like 1) “Option-Some-None”, 2) Either-Left-Right 3) Try-Success-Failure. Q27. How does Scala try to solve the problem of getting rid of null values...
Q1. Given the below Person.scala file with Person.calss, what will be the output?
A1. It prints the below text as when a Scala class is instantiated the statements in the body are executed after the object is constructed via the constructor defined in the class signature itself as “Person(name: String,
…
Q33. What is a “Future” object in Scala? Is it an immutable object? A33. A Future is a holder object that holds a value (i.e. … Read more ›...