1. What is meant by Scala Set?
A: Scala Set is a collection of paired elements of the same type. There are mutable sets and immutable sets and they do not have duplicate elements.
2. What is meant by Scala Map?
A: Scala Maps are collections of Key and Value pairs. Keys are unique, while values are not, and keyes are used to retrieve their corresponding values.
3. How are values and variables different in Scala?
A: Values and Variables both hold values in Scala. However, a Value is immutable and once assigned it cannot be changed, while a Variable is mutable and its value can be changed in the program.
4. What is meant by Recursion Tail in Scala?
A: Recursion refers to a function that calls itself in the program. When the callback to self is the last performed function, then it is referred to as Recursion Tail.
5. What is meant by Scala Trait?
A: Traits in Scala define object types which are specified by the signature of methods that are supported. Traits contain method and field definition and can be reused by mixing these into classes.
6. What are Case Classes in Scala?
A: Case Classes are like regular classes except that they can export their constructor parameters. These parameters can be directly accessed as public values.
7. What is meant by Tupules in Scala?
A: Tupules group a fixed number of items together to be treated as a single entity. Tupules differ from arrays or lists in that they can contain items of different types and are immutable.
8. What is the role of the currying in Scala?
A: Currying is the process of transforming a function taking multiple arguments to a function taking single argument.
9. What is meant by Monad in Scala?
A: Class objects are wrapped with a Monad in Scala, giving them two attributes: Identity by ‘unit’ and Binding by ‘flatMap’.
10. What is meant by Closure in Scala?
A: Closure is a function whose return value depends on variables declared outside that function.
11. What is meant by Scala Future?
A: Scala Future is an object having potential values or future values. It starts a background task and stored values are made available after the task is complete. It also provides different callback functions within itself, making it a complete concurrent class and differing from the Future class of Java which has no inbuilt callback function.
12. What is the role of Option in Scala?
A: Option is used to represent the presence or absence of values and may be used to wrap missing values and as replacements to returning null values.
13. What is meant by Statically Typed Language?
A: Statically Typed Language is where the Type Checking for errors is done during compilation rather that during runtime. This prevents too many bugs from developing at runtime, keeping the development process easy.
14. Which is the superclass for all other classes in Scala?
A: The ‘Any’ class, defined as ‘scala.Any’ is the superclass of all other classes and traits in Scala.
15. Which is the default Access Modifier of Scala?
A: The default Access modifier for Scala is public for all class, method, object and trait.
16. What is meant by Type Inference in Scala?
A: Type Inference refers to the determination of the type of object, expression, or variable by the compiler during compilation of program.
17. What is meant by Unit in Scala?
A: Unit is a final class defined as scala.Unit representing return of No Value or No Useful Value.
18. What is meant by REPL in Scala?
A: REPL, pronounced as ‘ripple’ stands for Read Evaluate Print Loop and is an interpreter that executes Scala code from the command prompt.
19. What is meant by anonymous function in Scala?
A: Anonymous functions, also called function literals are functions that get instantiated into objects during runtime. These objects are called function values.
20. What is meant by higher order function in Scala?
A: Functions with other functions as parameters and whose results are also functions are called higher order functions.
21. What types of identifiers are used in Scala?
A: Four types of Identifiers used in Scala are Alpha-numeric, Operator, Literal, and Mixed Identifiers.
22. What is meant by an Implicit Parameter in Scala?
A: Implicit Parameters defined using the keyword implicit allows functions to run without passing all the parameters.
23. What is the role of yield keyword in Scala?
A: The yield keyword when used with an expression, the value from that expression is returned as collection.
24. What are the roles of the Apply and Unapply methods?
A: The Apply method is used to join separate components to create an object. The Unapply method does the opposite and breaks the object apart into its constituents.
25. How are Array and List different in Scala?
A: Lists have a recursive covariant mutable data structure, and Arrays have a sequential invariant immutable data structure. In simpler terms, List size can change based on the operations performed on it, while Arrays have a fixed size.