Blog Archives
1 2 3 4 5

06: 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 ›



06: Coding Scala Way – Reduce & Compose functions

Example #14: Reduce operations Given a list of functions as shown below, how will you go about applying all the functions in the list to each input number and sum the result of each function?

For example, applying all 3 functions to first number in the list “1” …...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


06C: Q33 – Q40 Scala Futures and Promises Interview Q&As

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. success scenario) or an exception (i.e. failure) which may become available at some point. Future represents the result of an asynchronous computation. … Read more...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


07: Coding Scala Way – Regular Expressions

Example #16: Regular Expression Regular expression (aka regex) to identify numbers in a string. Invoking “findFirstIn” and “findAll” functions of the “Regex” class. “[0-9]+”.r is a short form instead of instantiating it as new Regex(“[0-9]+”).

Output

Example #17: Pattern matching with regex Split the given email address into...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


07: Q41 – Q48 Scala Async and Actor System Interview Q&As

Q41. What is the purpose of the “async” macro in Scala? A41. The 2.11 and later versions of Scala include the ability to transform code during compilation by using macros. The “async” macro is one of them, which transforms sequential code that uses “Futures” … Read more ›...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


07: 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 ›



08: Coding Scala Way – Recursion & Higher Order Function

Example #20: nth Fibonacci number

Q1 What is wrong with the following recursive approach to compute the nth Fibonacci number?
A1 It “hangs” for the larger values of “n” like 50.

Q2 How about using an iterative approach as shown below?

…

Read more ›



08: Q19 – Q26 Scala Data Structures basics interview questions & answers

Q19. What is the use of Tuples in Scala? A19. A Tuple is an immutable collection that can hold objects of different types. In other words, it groups together logical collections of items without using a class. There are 22 Tuple class in Scala from Tuple1, … Read more ›...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


08: Q49 – Q58 Scala Implicits Interview Q&As

Q49A. What are implicits in Scals? A49A. Implicits in Scala has two related features. 1) Implicit Parameters 2) Implicit Conversions. In both cases the Scala compiler implicitly provides extra information to prevent compile errors. 1. Implicit Parameters The code without implicits:

The code with implicit parameters: Implicit parameters are...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


09: Coding Scala Way – Fibonacci Series

Example #22: Fibonacci series in Scala This extends determine the nth fibonacci number using Scala. In this let’s print the Fibonacci series of length n.

Output:

Q1 Is the above approach to “print the Fibonacci series of length n” … Read more ›...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


09: Q59 – Q65 Higher Order Functions in Scala Interview Q&As

Q59. What is a higher order function, and what is the purpose of higher order functions? A59. Higher-order functions are functions that take functions as parameters. This gives you opportunities to condense and simplify code. The most used methods in the entire Collection API like map, … Read more ›...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


10: Coding Scala Way – groupBy, mapValues & identity

Java developers need to learn Coding Scala Way. Scala way of coding is quite different & you need to unlearn Java way of coding

Question: Given a list of numbers, how will you group the numbers by how many times they occur? for example output for “List(3,

…

Read more ›



10: Q66 – Q70 Pattern matching in Scala Interview Q&As

Q66. What is the purpose of pattern matching in Scala? A66. It is for the “flow control“. Most imperative languages support “if-then-else”, case statements, and loops like while, for, foreach, etc. Scala does support some of these, but the most often used “ … Read more ›...

This content is for 30-Day-Full-Access, 100-Day-Full-Access, 200-Day-Full-Access, and 365-Day-Full-Access members only. Register 80+ Free Java FAQs 80+ Free Big Data FAQs
Already a member? Log in here


1 2 3 4 5

300+ Java Interview Questions - FAQs

Tutorials on Java & Big Data