Choose a topic to test your knowledge and improve your Scala framework skills
The output of the following block of code is - class Student{ var roll = 43; def printTotal(){ var totalMarks = 500 println(roll) } } object MyClass{ def main(args:Array[String]) { var s1 = new Student println(s1.totalMarks) } }
Which is valid to method to increase value of variable by one?
The output of the following code is - object MyClass{ def main(args:Array[String]) { var a = 43 a += 4 a -= 3 println(a) } }
Ignored variables are used to -
Wildcard patterns (_) is used to -
The following code statement will - import java.util._
What are expressions in Scala?
Conditional statement in Scala executes a block of code based on some conditional value?
Which of these is not a conditional statement in Scala?
The output of the code block of code is - var myNumber = 5 ; if(myNumber > 20) print("A"); else if(myNumber > 15) print("B"); else print("C");
The do-while loop in Scala is -
The for loop in Scala is -
The output of the following block of code is - var myVar = 12; print(myVar); while(myVar <= 10){ print("*"); myVar += 2; }
2-D structures in Scala can be looped using -
Output of the following block of code - for(i <- 1 to 2){ for(j <- 1 to 2) print("(" + i + "," + j + ") ") }
The break statement in Scala is imported using -
Yield in Scala is used to -
Can there be multiple counters in a for loop in Scala?
To create a loop breakable in Scala, do we need to enclose it?
The default parameters are used when -
The output of the following block of code is - object Demo { def welcome( a: Int = 54, b: Int = 21 ){ println(a + b); } def main(args: Array[String]) { welcome(5); } }
Recursion function is -
Which of these can be solved using recursion?
Method overloading in Scala is?
def datatype(x:Float){ println("The parameter is of Float data type") } def datatype(x:Char){ println("The parameter is of Character data type") } def datatype(x: Boolean){ println("The parameter is of Boolean data type") } def main(args: Array[String]) { datatype(4.0f) } }
Which statement in Scala is used to create a tail-recursive function -
Tail recursion in Scala is -
What is the maximum number of parameters a method can accept?
Which syntax to pass the variable argument to function in Scala?
Can you alter the sequence of parameter passing?
The output of the following block of code is - object Demo { def sub( a:Int, b:Int ) = { println( (a-b) ); } def main(args: Array[String]) { sub(b = 5, a = 7); } }
Closures in Scala are -
The output of the following block of code will be - object myObject { var multiplier = 5; def main(args: Array[String]) { println(calculator(45)); } val calculator = (i:Int) => i * multiplier; }
Which of these parts of the declaration are not required in the case of parameter less methods?
Which of these ways of invoking a method are valid in Scala?
Lambda expression stores the value of -
Can Lambda expressions be used on collections in Scala?
Ways to define a composite function in Scala are -
What is the output of the following block of code - object myObject { def main(args: Array[String]) { println(( div(mul(452)) )) } val mul = (a: Int)=> { a * 100 } val div = (a: Int) =>{ a / 500 } }
What is the chopping of string -
Unit value in Scala is -
Array in Scala is -
Which Scala keyword is used to create an array?
Correct syntax for creating an array in Scala -
Is array mutable in Scala?
How to create a mutable array in Scala?
Methods which can be used to remove/ delete users from arrayBuffer in Scala?
Method used to get the length of array in Scala -
List in Scala is -
Method used to check if a list is empty in Scala -