๐Ÿงช Scala framework MCQ Quiz Hub

Scala Multiple-Choice Questions Set 1

Choose a topic to test your knowledge and improve your Scala framework skills

Scala programming language was developed by -





โœ… Correct Answer: 2

What is the paradigm of the Scala programming language?





โœ… Correct Answer: 4

Scala stands for ___.





โœ… Correct Answer: 1

Which of the following is not a feature of Scala?





โœ… Correct Answer: 4

Is Java required before installing Scala on the system?





โœ… Correct Answer: 1

The semicolon (;) in Scala is -





โœ… Correct Answer: 3

The Scala compiler starts executing from -





โœ… Correct Answer: 2

Which of the following are not present in Scala?





โœ… Correct Answer: 4

The correct syntax for creating Single line comments in Scala is,





โœ… Correct Answer: 1

The correct output of the following code is, object MyClass { def main(args: Array[String]) { var i,j=0 for(i <- 0 to 3){ for(j <- 0 until 2){ if(i + j == 3){ print((i*j)+" ") } } } } }





โœ… Correct Answer: 2

Which of these is not a primary data type in Scala -





โœ… Correct Answer: 3

The size of integer data type in Scala is -





โœ… Correct Answer: 3

Why is Double better than Float values?





โœ… Correct Answer: 4

Which class is the super-class of all classes in Scala?





โœ… Correct Answer: 3

Which type class does not inherit AnyVar?





โœ… Correct Answer: 4

The correct output of the below code block is - object MyClass { def main(args: Array[String]) { var a : Float = 454.32138988f var b : Double = a; printf("a = " + a + " b = " + b) } }





โœ… Correct Answer: 3

Default values of string type when it is not initialized -





โœ… Correct Answer: 2

Which type in Scala is a subtype of all types -





โœ… Correct Answer: 4

Statement returned by function when no values are returned in Scala - None of these





โœ… Correct Answer: 2

In Scala, can you return two values?





โœ… Correct Answer: 1

What is the range defined by the below statement - range(13, 17, 2)





โœ… Correct Answer: 3

Which is not a Scala method for printing text on the screen?





โœ… Correct Answer: 3

What is the output of following code? val i = 43 i = 231 printf(i)





โœ… Correct Answer: 4

Literals in Scala are ___.





โœ… Correct Answer: 2

Based on Type Casting, which of these conversions is lossy or invalid?





โœ… Correct Answer: 2

Which type of typecasting is done by the compiler?





โœ… Correct Answer: 1

Explicit Conversion is -





โœ… Correct Answer: 2

The getClass() method is used to -





โœ… Correct Answer: 1

Converting Character to Integer will return





โœ… Correct Answer: 3

Which Scala keyword is used to initialize a variable?





โœ… Correct Answer: 2

Lazy initialization is -





โœ… Correct Answer: 4

The total number of keywords in Scala are -





โœ… Correct Answer: 3

Which of these is not a keyword in Scala?





โœ… Correct Answer: 1

Using a keyword as a value will lead to -





โœ… Correct Answer: 4

Is 'sealed' a keyword in Scala -





โœ… Correct Answer: 1

Identifiers in Scala are names given to -





โœ… Correct Answer: 4

Which of these is not a type of identifier -





โœ… Correct Answer: 4

Is the following identifier valid? 12Scala_3





โœ… Correct Answer: 2

Literal Identifier is -





โœ… Correct Answer: 1

The correct output of the following code is - object myObject { def main(args: Array[String]) { var _value1 = 54 var 3value_2 = 65 println("The sum of two values is " + (_value1 + value_2)) } }





โœ… Correct Answer: 2

Which variable in Scala can save memory while declaring variables?





โœ… Correct Answer: 2

How many types of operators are present in Scala?





โœ… Correct Answer: 1

Logical operators in Scala are used to -





โœ… Correct Answer: 2

What is the use of the "&=" operator in Scala -





โœ… Correct Answer: 3

Find the result of the following code block - (3 + 4 * 5) >>> 1





โœ… Correct Answer: 2

Relation operators are -





โœ… Correct Answer: 2

What is the symbolic operator in Scala?





โœ… Correct Answer: 4

The final keyword in Scala is used to -





โœ… Correct Answer: 1

A final method can be applied on?





โœ… Correct Answer: 4

What is the scope of a local variable in Scala?





โœ… Correct Answer: 2