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

 polyinheritance  multilevel inheritance  multimode inheritance  hierarchical inheritance Subclass: A subclass is a class that inherits from another class (or a derived class, extended class, or child class). In addition to the superclass fields and methods, the subclass may add its own fields and methods.

Continue Reading

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

 %  &  \_  – A parameter (from the Ancient Greek para: “beside”, “subsidiary”; and v, metron: “measure”) is any attribute that can aid in the definition or classification of a device (meaning an event, project, object, situation, etc.). That is, a parameter is a component of a system that is useful or important when defining […]

Continue Reading

Which statement returns a success or a failure indicator when you execute this code? val MyFuture = Future {runBackgroundFunction() }

 myFuture.onComplete  myFuture(status)  myFuture.Finished  complete(myFuture) An indicator is a halochromic chemical compound that is added to a solution in small quantities to enable the pH (acidity or basicity) of the solution to be visually determined. In the Arrhenius model, a pH indicator is a chemical detector for hydronium ions (H3O+) or hydrogen ions (H+). The indicator, […]

Continue Reading

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

 use array named args  use tuple named args  use numbered variables with a _ prefix for example _ 1, _ 2, _ 3  use numbered variables with a $ prefix – for example $1, $2, $3 Scala is a programming language that runs on the Java Virtual Machine (JVM) and can access the entire Java […]

Continue Reading

What do you call objects with immutable state?

 singletons  stationary objects  functional objects  fixed objects The term “immutable state” refers to a state that cannot be modified. When dealing with concurrency, the ability for more than one processor in your machine to run on the same object at the same time, immutable objects (for which none of the state can be changed) become […]

Continue Reading

What is the output of this function? def main () { var a = 0 for (a<-1 until 5){println(a)}

 1,2,3,4,5  0,1,2,3,4  1,2,3,4  2,3,4,5 A function is any expression in mathematics that produces exactly one answer for any given number. The number you enter into the expression is the input, and the result is what you get after the look-up or calculations are completed.

Continue Reading

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

 Yes, the reference to the array is immutable, so the location that the array points to is immutable. The values in the array are mutable.  The 0th element is immutable and cannot be modified. All other elements can be modified.  Yes, val does not make arrays immutable.  No, val makes the array and values of […]

Continue Reading

What is the data type of y after this code is executed? val y = (math floor 3.1415 * 2)

 short  double  int  bigInt The death penalty, also known as capital punishment, is the state-sanctioned execution of an individual as a punishment for a crime. A death sentence is a sentence that requires anyone to be punished with the death penalty, and an execution is the act of carrying out that sentence.  

Continue Reading