NEW
Font size
WorksheetsExtracted Questions (translated to English)
Total questions: 37
Worksheet time: 19mins
Suppose a project already has two activities named MainActivity and SecondActivity. Fill in the missing part of the Kotlin Intent declaration to open SecondActivity from MainActivity. Use exact capitalization. Code: val intent = Intent(this, [____])
SecondActivity::class.java
SecondActivity::class
MainActivity::class.java
SecondActivity.class
Which constant is used to open the phone dialer screen without immediately placing a call? Fill in the position X after the class name in Intent.X.
ACTION_DIAL
ACTION_CALL
ACTION_VIEW
ACTION_SEND
Choose the statement that is NOT accurate about the ViewHolder technique used for list‑type objects in Android.
It helps reduce the number of times findViewById() is called.
It requires each item view to be inflated again during scrolling.
It improves scrolling performance by reusing item views.
It stores references to child views to avoid repeated lookups.
Which component is automatically generated by Android Data Binding?
ViewModel
LiveData
Binding Class
LayoutInflater
Which method is used to finish a currently running activity?
dispose()
finish()
finishActivity()
destroy()
Which type of menu opens when a user presses and holds an object for a short time?
Context Menu
Option Menu
Drawer Menu
Popup Menu
What is LiveData used for in Android?
To store data permanently
To observe and react to data changes automatically
To replace the entire ViewModel
To display error messages
To show a temporary image while Glide loads an image from the Internet, which approach should be used?
Use RequestOptions() and call placeholder() with an image from the drawable resources folder
Set the Glide.placeholder attribute to the id of an image in the drawable resources folder
Use RequestOptions() and call loadingImage() with an image from the drawable resources folder
Use the into() method with an image from the drawable resources folder
Which method is NOT required to be overridden when declaring an adapter class that extends RecyclerView.Adapter?
onBindViewHolder
getItemCount
onCreateViewHolder
getItemViewType
Which object is used to create a user interface that can be reused in different parts of an activity?
Intent
Service
BroadcastReceiver
Fragment
To run a block of code on a background thread inside an activity, which command should be used?
lifecycleScope.launch(Dispatchers.Main) { /* code to run */ }
lifecycleScope.launch(Dispatchers.IO) { /* code to run */ }
viewModelScope.launch(Dispatchers.IO) { /* code to run */ }
viewModelScope.launch(Dispatchers.Main) { /* code to run */ }
Which method is used to open a new activity from the current activity?
beginActivity
startActivity
newActivity
openActivity
What is an implicit intent used for?
To open a service of the current app
To open an activity of another app
To close an activity of another app
To open an activity of the current app
Assume a Room database object is created as follows: Room.databaseBuilder(context.applicationContext, StudentDatabase::class.java, "student_db") .fallbackToDestructiveMigration() .build() When the app runs on a device, where are the student_db files stored inside the app’s private directory?
databases
cache
shared_prefs
files
No files are created
List the callback methods in an activity’s lifecycle.
onCreate(), onStart(), onActivityStarted(), onResume(), onPause(), onStop(), onActivityDestroy(), onDestroy()
onCreate(), onStart(), onResume(), onPause(), onStop(), onRestart(), onDestroy()
onCreate(), onInit(), onStart(), onPause(), onStop(), onDestroy(), onResume()
onCreate(), onStart(), onPause(), onResume(), onFinish(), onStop(), onDestroy()
Which is used to observe lifecycle changes in an activity?
LiveData
LifecycleObserver
ViewModel
DataBinding
Which of the following statements about intents is not correct?
Explicit intents require specifying the activity class to open.
Implicit and explicit intents allow an app to open an activity from another app.
Intents are carried out using the startActivity() method.
When performing an implicit intent, the system always opens a chooser dialog for the user to select an activity.
What happens if withTimeout() exceeds its time limit?
A warning is sent but the coroutine does not stop
The coroutine keeps running
A TimeoutCancellationException is thrown
The entire app stops
In Kotlin coroutines, what type does the launch() function return?
Thread
CoroutineScope
Job
Deferred
LiveData is part of which library in Android?
AndroidX ViewBinding
Android Room
Android Jetpack
Android Core Library
Given a layout file where a TextView has android:visibility set to [ ] and a CheckBox with id checkBox is present, use a Data Binding expression to fill the missing code so that when the user selects the CheckBox the TextView is shown, and when the user clears it the TextView is hidden (no extra spaces). Which expression should go inside the brackets?
@{checkBox.checked ? View.VISIBLE : View.GONE}
@{checkBox.isChecked ? View.VISIBLE : View.GONE}
@{checkBox.checked ? View.GONE : View.VISIBLE}
@{checkBox.visibility}
Which list type cannot be used with the ArrayAdapter class?
GridView
ListView
Spinner
RecyclerView
Which statement is NOT correct about implicit intents?
Android receives the request and finds an app that matches it.
Android uses a list of registered apps to launch an implicit intent.
To open something with an implicit intent, you must know the class name of the target activity.
If more than one app can handle it, Android shows a dialog for the user to choose an app.
Which dispatcher is used to run a coroutine on the UI thread?
Dispatchers.IO
Dispatchers.Default
newSingleThreadContext()
Dispatchers.Main
If the onCreateOptionsMenu method is overridden in an activity, which type of menu is created?
Context Menu
Popup Menu
Navigation Drawer Menu
ActionBar Menu
Fill the missing code to delete a student by student ID in the following Room DAO method: fun deleteStudentByMssv(mssv: Int). Which annotation and query should be used?
@Delete("DELETE FROM students WHERE mssv = :mssv")
@Delete
@Query("DELETE FROM students WHERE mssv = :mssv")
When using the Room library, which annotation marks a class as a table in the database?
@Entity
@Dao
@PrimaryKey
@Database
What is the Room library used for?
Authenticating users
Performing database operations
Making network connections
Encrypting data
To enable Data Binding in a project, what should be added to the build.gradle file?
enableDataBinding()
buildFeatures { dataBinding = true }
No changes are required
dataBinding.enabled = true
If an activity is named SampleActivity.kt and uses the layout file activity_sample.xml, which answer is the name of the binding class automatically generated when using data binding?
SampleActivityBinding
ActivitySampleBinding
sample_activity_binding
activity_sample_binding
When using Data Binding, which XML syntax is used to bind a value from a ViewModel to a View?
#{}
@{}
%{}
${}
To display a list with a complex, multi-component item layout, which widget is set up differently from the others?
AutoCompleteTextView
Spinner
RecyclerView
GridView
ListView
Which statement about ViewModel is not correct?
A ViewModel can be used to share data between fragments.
A ViewModel can be used to share data between activities.
Each fragment can create its own ViewModel.
A fragment can access the hosting activity’s ViewModel.
Which statement is not an advantage of using fragments (compared to activities)?
Navigating between fragments allows using complex design patterns such as TabBar or NavigationDrawer.
Fragments are lighter than activities, so fragments should always be preferred over activities.
Using multiple fragments in one activity enables adaptive UIs for different screen sizes.
The same fragment class can be reused in different activities.
Which class is not used for performing network operations in Android?
Retrofit
Volley
HttpURLConnection
JSONObject
What is the purpose of the RecyclerView class?
Accessing a database
A layout type for arranging the interface
A memory management tool
Displaying a list
The onCreateView() method is called only once during a fragment’s lifecycle. Is this statement true or false?
True
False
