Vidyalelo
Computer Science · all questions

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

292

Questions

11/15

Page

Pick an option on a question to see the right answer and solution.

Which code snippet correctly shows a for loop using a range to display "1 2 3 4 5 6"?

Select an option to see the answer and solution.

Which snippet correctly shows setting the variable max to whichever variable holds the greatest value, a or b, using idiomatic Kotlin?

Select an option to see the answer and solution.

Which lifecycle method should you override to pause the simulation when the app is not on the screen?

Select an option to see the answer and solution.

Your function is passed by a parameter obj of type Any. Which code snippet shows a way to retrieve the original type of obj, including package information?

Select an option to see the answer and solution.

Which function changes the value of the element at the current iterator location?

Select an option to see the answer and solution.

The Kotlin .. operator can be written as which function?

Select an option to see the answer and solution.

How can you create a variable with the floating number 2.8?

Select an option to see the answer and solution.

How can you create a range of numbers between 5 and 15 in Kotlin?

Select an option to see the answer and solution.

How to access the elements of an array in Kotlin?

Select an option to see the answer and solution.

The actual function for getting the string length in Kotlin language is?

Select an option to see the answer and solution.

How do you declare a String in Kotlin?

Select an option to see the answer and solution.

In Kotlin, how do you compare two Strings for equality?

Select an option to see the answer and solution.

How can you create a variable with the numeric value 5?

Select an option to see the answer and solution.

Which operator is used to add together two values?

Select an option to see the answer and solution.

Which operator can be used to compare two values?

Select an option to see the answer and solution.

Select the method to pass data back from an activity in Android for Kotlin

Select an option to see the answer and solution.

Which symbol is used for string templates/interpolation?

Select an option to see the answer and solution.

What is the correct way to create an object called myObj of MyClass?

Select an option to see the answer and solution.

How do you declare a nullable variable in Kotlin?

Select an option to see the answer and solution.

How do you define a function in Kotlin?

Select an option to see the answer and solution.