Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Answers

Question 1: Collection Filtering

Correct Answer: B) List(2, 4, 5)

Question 2: Tuples and Destructuring

Correct Answer: B) person._2

Question 3: Defining Classes

Correct Answer: A) class MyClass(param: Type)

Question 4: Scala Collections

Correct Answer: B) List

Question 5: Object-Oriented Programming

Correct Answer: C) Scala allows defining singleton objects using the object keyword.

Question 68: Defining and Instantiating a Simple Class

Correct Answer: A) Hello, my name is Alice and I am 30 years old.
Hello, my name is Bob and I am 25 years old.

Question 6: Class with Private Members

Correct Answer: A) 10

Question 8: Overriding Methods in Subclasses

Correct Answer: A) Some sound
Woof

Question 9: Abstract Classes and Traits

Correct Answer: A) Circle area: 78.54

Question 10: Defining and Implementing Traits

Correct Answer: A) Good day, Alice.

Question 11: Mixing in Multiple Traits

Correct Answer: A) Walking...
Running...

Question 12: Overriding Trait Methods in Classes

Correct Answer: A) Woof

Question 13: Abstract and Concrete Methods in Traits

Correct Answer: A) 8
2

Question 14: Combining map and filter

Correct Answer: D) List("CHARLIE", "DAVID")

Question 15: Matching Tuples

Correct Answer: A) One apple

Question 16: Matching with Lists

Correct Answer: A) A list with three elements.

Question 17: Matching with Guards

Correct Answer: B) Full access

Question 18: For-Comprehension with Multiple Generators

Correct Answer: A) List((1,4), (1,5), (2,4), (2,5), (3,4), (3,5))