Q1. Scala bytecode can run on top of Java VM. What is the fundamental difference between Java object.clone() and Scala object.copy()?

Q2. What value does this code return?

val m1 = Map("a"->1,"b"->2,"c"->3)

Q3. What is one way to avoid low-level parallelization details?

Q4. What do you use in ScalaTest to see a detailed diagram of error messages when a test fails?

Q5. What data type would you use to store an immutable collection of objects that contain a fixed number of varying types?

Q6. After defining a function in the interpreter, Scala returns the following. What does the

myfnc: ()Unit

Q7. What type of number is 1234.e5?

Q8. When you convert a map to a list using the toList method of the map, the result will be of which type?

Q9. What type of object does this code create?

val x = (1234, "Active")

Q10. Which is a subclass of all classes?

Q11. For the for-yield construct, is the scope separate between for-body and yield-body?

Q12. What is one way to implement pattern matching on methods?

Q13. What is the value of z after executing this code?

val y = List('a','b')
val z = y::List('c')

Q14. What term is used to specify a precondition?

Q15. Which Scala type may throw an exception or a successfully computed value, and is commonly used to trap and propagate errors?

Q16. What is the data type of y after this code is executed?

val y = (math floor 3.1415 * 2)

Q17. When using pattern matching, which character matches on any object?

Q18. You have created an array using val. Can you change the value of any element of the array—and why or why not?

Q19. What is the output of this function?

def main () {
     var a = 0
     for (a<-1 until 5){println(a)}

Q20. What do you call objects with immutable state?

Q21. You have written a Scala script. How would you access command-line arguments in the script?

Q22. What does this code return? val x = 3; if (x >2) x = 4 else x = x*2

Q23. Which statement returns a success or a failure indicator when you execute this code?

val MyFuture = Future {runBackgroundFunction() }

Q24. To denote a parameter that may be repeated, what should you place after type?

Q25. What is called when a superclass has more than one subclass in Scala?

Q26. One way to improve code reliability is to use _, which will evaluate a condition and return an error if the conditions is violated.

Q27. Which statement about if-else-if-else statements is true?

Q28. What do you call the process of changing the definition of an inherited method?

Q29. What is an advantage of an immutable object?

Q30. What is the code below equivalent to?

myClass.foreach(println _)

Q31. What is an advantage of an immutable object?

Q32. You want to create an iteration loop that tests the condition at the end of the loop body. Which iteration would you use?

Q33. What can you use to make querying a database more efficient, by avoiding the need to parse the SQL string every time a query is executed from Scala?

Q34. Which is not a member of the collections hierarchy?

Q35. Which term makes the contents of packages available without prefixing?

Q36. If you wanted to find the remainder after division, what operator would you use?

Q37. What are defined inside a class definition?

Q38. What defines methods and fields that can then be reused by mixing into classes?