Blog Archives
1 2 3 4 5

01: Scala Functional Programming basics – pure functions, referential transparency, side effects, etc

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.

2) The function does not change its input.

3) The function does not do anything else except computing the output.

Read more ›



01A: Scala FP basics: First-class function, higher order function, statements Vs expressions, immutability & recursion

This extends Scala Functional Programming basics – pure functions, referential transparency, side effects, etc.

Q1. What is a first-class function?
A1. A first-class function is a function that can be treated like a value.

1) Can be assigned to a variable as a value can be assigned to a variable.

Read more ›



01C: Q1 – Q6 Scala interview Q&As on Functional Programming

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). Scala is very popular in Apache Spark programming to process Big Data. 70+ FAQ Bigdata & Hadoop interview questions &

Read more ›



01D: Scala Class Vs. Object and Companion object interview Q&As

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,

Read more ›



01E: Scala Factory Method Pattern & Trait Vs Abstract classes

This extends the Scala Class Vs. Object and Companion object interview Q&As to implement the factory method.

Q1. What is a factory method pattern?
A1. It is an Object Oriented Programming design pattern to instantiate objects. For example,

Read more ›



02: Q6 – Q12 Scala FP currying, closures & partial functions interview Q&As

This extends Q1 – Q5 Scala Functional Programming basics interview questions & answers

Q6. What is a curried function in Scala?
A6. Currying is the technique of transforming a function with multiple arguments into a function with just one argument,

Read more ›



02B: Currying, partial application & functional composition in Scala

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, multiply and multiplyBy10 without currying.

Output:

With currying & partial application with functional composition

Note: You can also do

Output:

What is Currying?

Read more ›



1 2 3 4 5

800+ Java Interview Q&As Menu

Learn by categories on the go...
Learn by categories such as FAQs – Core Java, Key Area – Low Latency, Core Java – Java 8, JEE – Microservices, Big Data – NoSQL, Architecture – Distributed, Big Data – Spark, etc. Some posts belong to multiple categories.
Top