Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
is is used for type checking, while "as" is used for casting between types.
is is used for casting between types, while "as" is used for type checking.
is and "as" are interchangeable and can be used interchangeably.
is and "as" are not supported in Kotlin.
Extension functions are a way to add new functionality to existing classes without having to modify their source code.
Extension functions can only be defined for classes that are part of the Kotlin standard library.
Extension functions are not supported in Kotlin.
Extension functions can only be defined for classes that are marked as "open".
{x, y -> x + y}
(x, y) => x + y
[x, y] -> x + y
(x, y) -> {x + y}
Mobile app development
Web development
Database management
Machine learning
A primary constructor is called before any secondary constructors, while a secondary constructor is called before the primary constructor.
A primary constructor is defined inside the class definition, while a secondary constructor is defined outside the class definition.
A primary constructor takes parameters that are used to initialize properties, while a secondary constructor can have additional logic or functionality.
There is no difference between a primary and a secondary constructor in Kotlin.
What is the output of the following code?
fun main() { val list = listOf(1, 2, 3) val doubledList = list.map { it * 2 } println(doubledList)}
[1, 2, 3]
[2, 4, 6]
[1, 2, 3, 2, 4, 6]
This code will not compile.
What is Kotlin?
A programming language
A database management system
A web framework
A markup language
fun main() { val x: Int? = null val y = 5 println(x ?: y)}
0
5
null
A class is a blueprint for creating objects, while an object is a singleton instance of a class.
A class is a singleton instance of an object, while an object is a blueprint for creating classes.
There is no difference between a class and an object in Kotlin.
A class and an object are both used to create instances of a class.
val is immutable while var is mutable.
var is immutable while val is mutable.
Both val and var are immutable.
Both val and var are mutable.