Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
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".
var
my-variable
123foo
MyClass
{x, y -> x + y}
(x, y) => x + y
[x, y] -> x + y
(x, y) -> {x + y}
What is the output of the following code?
fun main() { val nullableString: String? = null val length = nullableString?.length ?: -1 println(length)}
0
-1
null
This
fun main() { val numbers = listOf(1, 2, 3, 4, 5) val filteredNumbers = numbers.filter { it % 2 == 0 } println(filteredNumbers)}
[1, 3, 5]
[2, 4]
[1, 2, 3, 4, 5]
This code will not compile.
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.
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.
A type of operator used for bitwise operations.
A type of operator used for arithmetic operations.
A type of operator used for null safety.
A type of operator used for logical operations.
What is Kotlin?
A programming language
A database management system
A web framework
A markup language
Mobile app development
Web development
Database management
Machine learning