Online Exam Quiz

questionQuestion  1 to 30

How do you define a Fragment in Kotlin?

  • class MyFragment : Fragment()
  • class MyFragment extends Fragment()
  • class MyFragment inherits Fragment()
  • class MyFragment implements Fragment()
Mark for review

How do you define a primary constructor in a Kotlin class?

  • constructor(name: String)
  • primary constructor(name: String)
  • init(name: String)
  • class ClassName(name: String)
Mark for review

How do you create a read-only variable in Kotlin?

  • val name: String
  • var name: String
  • const name: String
  • let name: String
Mark for review

Which keyword is used to define an interface in Kotlin?

  • interface
  • protocol
  • delegate
  • struct
Mark for review

How do you create a sealed class in Kotlin?

  • sealed class MyClass
  • sealed abstract class MyClass
  • sealed MyClass
  • abstract sealed class MyClass
Mark for review

Which library is commonly used for dependency injection in Kotlin for Android development?

  • Dagger
  • Hilt
  • Koin
  • Dagger-Hilt
Mark for review

Mark for review

What is the correct way to get a reference to a TextView in Kotlin?

  • findViewById<TextView>(R.id.textView)
  • findViewById(R.id.textView)
  • findTextView(R.id.textView)
  • getView<TextView>(R.id.textView)
Mark for review

How do you start a new activity in Android using Kotlin?

  • startActivity(Intent(this, NewActivity::class.java))
  • startActivity(NewActivity::class.java)
  • startNewActivity(Intent(this, NewActivity::class.java))
  • startNewActivity(NewActivity::class.java)
Mark for review

How do you define a Kotlin class that extends an Android Activity?

  • class MainActivity : Activity()
  • class MainActivity extends Activity()
  • class MainActivity inherits Activity()
  • class MainActivity implements Activity()
Mark for review

Which keyword is used to define a function in Kotlin?

  • def
  • fun
  • function
  • func
Mark for review

What is the correct way to handle null safety in Kotlin?

  • if (variable != null)
  • variable?.let { }
  • variable != null ? ...
  • try { variable } catch {}
Mark for review

Which keyword is used to indicate that a Kotlin class can be inherited from?

  • open
  • public
  • extendable
  • inheritable
Mark for review

What is the correct way to declare a nullable variable in Kotlin?

  • var name: String?
  • var name = null
  • var name: String = null
  • var name = ""
Mark for review

What is the correct way to declare a nullable variable in Kotlin?

  • var name: String?
  • var name = null
  • var name: String = null
  • var name = ""
Mark for review

Which type in Kotlin represents a collection of key-value pairs?

  • List
  • Set
  • Map
  • Pair
Mark for review

How do you create a singleton in Kotlin?

  • class Singleton { }
  • object Singleton { }
  • static class Singleton { }
  • object Singleton: Singleton { }
Mark for review

Which annotation is used to bind a view in a Kotlin Android activity?

  • @BindView
  • @ViewBind
  • @Bind
  • @FindView
Mark for review

Which function is used to start a new activity in Android using Kotlin?

  • startActivity(Intent(this, NewActivity::class.java))
  • startActivity(NewActivity::class.java)
  • startNewActivity(Intent(this, NewActivity::class.java))
  • startNewActivity(NewActivity::class.java)
Mark for review

How do you declare an enum class in Kotlin?

  • enum class MyEnum
  • enum MyEnum
  • enum MyEnum()
  • class enum MyEnum
Mark for review

Which of the following is the correct way to define a companion object in Kotlin?

  • companion object
  • companion class
  • companion val
  • companion const
Mark for review

How do you create a coroutine in Kotlin?

  • coroutine { }
  • launch { }
  • async { }
  • runBlocking { }
Mark for review

How do you create an instance of a class in Kotlin?

  • ClassName()
  • new ClassName()
  • ClassName
  • ClassName.new()
Mark for review

What is the correct way to get a reference to a TextView in Kotlin?

  • findViewById<TextView>(R.id.textView)
  • findViewById(R.id.textView)
  • findTextView(R.id.textView)
  • getView<TextView>(R.id.textView)
Mark for review

How do you declare a constant in Kotlin?

  • const val CONSTANT_NAME
  • val CONSTANT_NAME
  • const CONSTANT_NAME
  • let CONSTANT_NAME
Mark for review

How do you handle an HTTP response in Kotlin using the Retrofit library?

  • response.body()
  • response.data()
  • response.get()
  • response.json()
Mark for review

What is the correct way to create a sealed class in Kotlin?

  • sealed class MyClass
  • sealed abstract class MyClass
  • sealed MyClass
  • abstract sealed class MyClass
Mark for review

Mark for review

Which of the following is the correct way to declare a variable in Kotlin?

  • var name: String
  • var name = String
  • var name: String = ""
  • var name = ""
Mark for review

How do you initialize a lateinit variable in Kotlin?

  • lateinit var name: String
  • lateinit val name: String
  • var name: String = null
  • val name: String = null
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review