Scala%20framework/Scala%20Multiple-Choice%20Questions%20Set%201 Sample Test,Sample questions

Question:
 Identifiers in Scala are names given to -

1.Classes or objects

2.Methods

3.Objects

4.All of these

Posted Date:-2022-11-27 11:46:46


Question:
 Is 'sealed' a keyword in Scala -

1.Yes

2.No

3.Error

4.None of These

Posted Date:-2022-11-27 11:45:38


Question:
 Is the following identifier valid?

12Scala_3

1.Yes

2.No

3.Error

4.None of these

Posted Date:-2022-11-27 11:56:05


Question:
 Scala programming language was developed by -

1.James Gosling

2.Martin Odersky

3.Dennis MacAlistair Ritchie

4.Guido van Rossum

Posted Date:-2022-11-27 10:26:13


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

1.//

2.<!-- -- >

3./* */

4.%%

Posted Date:-2022-11-27 11:00:49


Question:
 The semicolon (;) in Scala is -

1.Necessary, failing to write will not mark the end of line

2.Not required, it is treated as a character

3.Optional, end of the line does not require ;

4.None of these

Posted Date:-2022-11-27 10:57:46


Question:
 The total number of keywords in Scala are -

1.45

2.34

3.39

4.52

Posted Date:-2022-11-27 11:42:52


Question:
 What is the scope of a local variable in Scala?

1.Whole program

2.A method is it declared in

3.Class/object containing it

4.All of the above

Posted Date:-2022-11-27 12:11:58


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

1.Integer

2.String

3.Array

4.Char

Posted Date:-2022-11-27 11:04:05


Question:
A final method can be applied on?

1.Variables

2.Classes

3.Functions

4.All of the above

Posted Date:-2022-11-27 12:10:57


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

1.Character -> Float

2.Float -> Long

3.Short -> Integer

4.Integer -> Double

Posted Date:-2022-11-27 11:25:48


Question:
Converting Character to Integer will return

1.Error

2.Random integer value

3.ASCII value of the character

4.None of the above

Posted Date:-2022-11-27 11:39:19


Question:
Default values of string type when it is not initialized -

1.0

2.Null

3.None

4." "

Posted Date:-2022-11-27 11:10:17


Question:
Explicit Conversion is -

1.Done by the compiler itself

2.Defined by the user

3.Both A and B

4.None of the above

Posted Date:-2022-11-27 11:28:04


Question:
Find the result of the following code block -

(3 + 4 * 5) >>>  1

1.43

2.11

3.12

4.120

Posted Date:-2022-11-27 12:05:01


Question:
How many types of operators are present in Scala?

1.5

2.2

3.6

4.8

Posted Date:-2022-11-27 12:00:40


Question:
In Scala, can you return two values?


1.Yes

2.No

3.Error

4.None of These

Posted Date:-2022-11-27 11:12:47


Question:
Is Java required before installing Scala on the system?

1.Yes

2.No

3.Error

4.None of these

Posted Date:-2022-11-27 10:56:40


Question:
Lazy initialization is -

1.Creating variables using the lazy keyword

2.Done only on immutable variables

3.Calculated at its first access

4.All of the above

Posted Date:-2022-11-27 11:42:01


Question:
Literal Identifier is -

1.String literal used as an identifier in Scala

2.Value literal used as an identifier in Scala

3.Numeric literal used as an identifier in Scala

4.None of These

Posted Date:-2022-11-27 11:57:43


Question:
Literals in Scala are ___.

1.Name of the variables

2.A literal is a value that can be assigned to a variable

3.The type of the values

4.None of these

Posted Date:-2022-11-27 11:24:34


Question:
Logical operators in Scala are used to -

1.Perform a comparison of values

2.Perform logical operation on the boolean value

3.Return a value

4.None of These

Posted Date:-2022-11-27 12:01:55


Question:
Relation operators are -

1.Return a relative value

2.Used to define the comparison between the two operators

3.Create new values based on the relation

4.None of These

Posted Date:-2022-11-27 12:06:50


Question:
Scala stands for ___.

1.Scalable language

2.Scripted advanced language

3.Sequential language

4.None of These

Posted Date:-2022-11-27 10:54:57


Question:
Statement returned by function when no values are returned in Scala -




None of these

1.No value

2.Unit

3.Int

4.None of These

Posted Date:-2022-11-27 11:12:02


Question:
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)
    }
}

1.a = 454.32138988 b = 454.32138988152344

2.a = 454.32138 b = 454.3213806152344

3.a = 454.32138 b = 454.32138

4.Error

Posted Date:-2022-11-27 11:09:13


Question:
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))
    }
}

1.54

2.Error

3.119

4.65

Posted Date:-2022-11-27 11:58:45


Question:
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)+"	")
                }
            }
        }
    }
}

1.3 3

2.2 0

3.0 2

4. 1 1

Posted Date:-2022-11-27 11:02:28


Question:
The final keyword in Scala is used to -

1.Define a variable whose value cannot be further changed

2.Create a new variable

3.Special inaccessible value in Scala

4.None of these

Posted Date:-2022-11-27 12:10:09


Question:
The getClass() method is used to -

1.Extract the class of the given number

2.Extract the value of the variable

3.Extract the memory location of the variable

4.All of the Above

Posted Date:-2022-11-27 11:29:21


Question:
The Scala compiler starts executing from -

1.The first line of code

2.main() method

3. main class

4.End of code

Posted Date:-2022-11-27 10:58:45


Question:
The size of integer data type in Scala is -

1.256 bits

2.4 bits

3.32 bits

4.64 bits

Posted Date:-2022-11-27 11:05:01


Question:
Using a keyword as a value will lead to -

1.Error

2.Compile with the NULL value

3.Warning

4.None of the above

Posted Date:-2022-11-27 11:44:50


Question:
What is the output of following code?

val i = 43
i = 231
printf(i)

1.231

2.43

3.0

4.Error

Posted Date:-2022-11-27 11:23:24


Question:
What is the paradigm of the Scala programming language?


1.Object-oriented

2.Statically Types

3.Functional

4.All of the above

Posted Date:-2022-11-27 10:53:57


Question:
What is the range defined by the below statement -

range(13, 17, 2)

1.13 14 15 16 17

2.13 14 15 16

3.13 15

4.13 15 17

Posted Date:-2022-11-27 11:14:55


Question:
What is the symbolic operator in Scala?

1.Predefined sets that can handle a specific task

2.Are reserved to a specific use

3.Symbols that have a specific task that they perform when called in a Scala program

4.All of these

Posted Date:-2022-11-27 12:08:48


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

1.Bitwise operator

2.Arithmetic operator

3.Bitwise Assignment operator

4.None of these

Posted Date:-2022-11-27 12:04:14


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

1.Ref

2.AnyRef

3.Any

4.AnyVar

Posted Date:-2022-11-27 11:07:09


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

1.print()

2.printf()

3.printl()

4.println()

Posted Date:-2022-11-27 11:22:07


Question:
Which of the following are not present in Scala?



1.Closures

2.Monads

3.Traits

4.None of these

Posted Date:-2022-11-27 10:59:27


Question:
Which of the following is not a feature of Scala?

1.Type inference

2.Lazy Computation

3.High order function

4.None of the above

Posted Date:-2022-11-27 10:55:47


Question:
Which of these is not a keyword in Scala?

1.int

2.var

3.forsome

4.package

Posted Date:-2022-11-27 11:43:40


Question:
Which of these is not a type of identifier -

1.Alphanumeric identifier

2.Operator identifier

3.Literal identifier

4.Value identifier

Posted Date:-2022-11-27 11:48:03


Question:
Which Scala keyword is used to initialize a variable?




1.int

2.var

3.value

4.None

Posted Date:-2022-11-27 11:40:26


Question:
Which type class does not inherit AnyVar?

1.Char

2.Int

3.Float

4.Pointer

Posted Date:-2022-11-27 11:08:00


Question:
Which type in Scala is a subtype of all types -



1.Int

2.Ref

3.Boolean

4.Nothing

Posted Date:-2022-11-27 11:11:08


Question:
Which type of typecasting is done by the compiler?

1.Implicit Conversion

2.Explicit Conversion

3.Instance conversion

4.None of these

Posted Date:-2022-11-27 11:27:03


Question:
Which variable in Scala can save memory while declaring variables?





1.Mutable variables

2.Lazy Variables

3.Inherited Variables

4.None of these

Posted Date:-2022-11-27 12:00:09


Question:
Why is Double better than Float values?

1.It can store double-precision values providing more accurate data to be stored.

2.It stores 64 bits values instead of 32 bits from a float.

3.Float Values are better

4.Both A and B

Posted Date:-2022-11-27 11:06:04


More MCQS

  1. Scala Multiple Choice Questions
  2. Scala Multiple-Choice Questions Set 1
  3. Scala Multiple-Choice Questions Set 2
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!