wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Extracted Questions (translated to English)

Total questions: 37

Worksheet time: 19mins

Name
Class
Date
1.

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, [____])

a)

SecondActivity::class.java

b)

SecondActivity::class

c)

MainActivity::class.java

d)

SecondActivity.class

2.

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.

a)

ACTION_DIAL

b)

ACTION_CALL

c)

ACTION_VIEW

d)

ACTION_SEND

3.

Choose the statement that is NOT accurate about the ViewHolder technique used for list‑type objects in Android.

a)

It helps reduce the number of times findViewById() is called.

b)

It requires each item view to be inflated again during scrolling.

c)

It improves scrolling performance by reusing item views.

d)

It stores references to child views to avoid repeated lookups.

4.

Which component is automatically generated by Android Data Binding?

a)

ViewModel

b)

LiveData

c)

Binding Class

d)

LayoutInflater

5.

Which method is used to finish a currently running activity?

a)

dispose()

b)

finish()

c)

finishActivity()

d)

destroy()

6.

Which type of menu opens when a user presses and holds an object for a short time?

a)

Context Menu

b)

Option Menu

c)

Drawer Menu

d)

Popup Menu

7.

What is LiveData used for in Android?

a)

To store data permanently

b)

To observe and react to data changes automatically

c)

To replace the entire ViewModel

d)

To display error messages

8.

To show a temporary image while Glide loads an image from the Internet, which approach should be used?

a)

Use RequestOptions() and call placeholder() with an image from the drawable resources folder

b)

Set the Glide.placeholder attribute to the id of an image in the drawable resources folder

c)

Use RequestOptions() and call loadingImage() with an image from the drawable resources folder

d)

Use the into() method with an image from the drawable resources folder

9.

Which method is NOT required to be overridden when declaring an adapter class that extends RecyclerView.Adapter?

a)

onBindViewHolder

b)

getItemCount

c)

onCreateViewHolder

d)

getItemViewType

10.

Which object is used to create a user interface that can be reused in different parts of an activity?

a)

Intent

b)

Service

c)

BroadcastReceiver

d)

Fragment

11.

To run a block of code on a background thread inside an activity, which command should be used?

a)

lifecycleScope.launch(Dispatchers.Main) { /* code to run */ }

b)

lifecycleScope.launch(Dispatchers.IO) { /* code to run */ }

c)

viewModelScope.launch(Dispatchers.IO) { /* code to run */ }

d)

viewModelScope.launch(Dispatchers.Main) { /* code to run */ }

12.

Which method is used to open a new activity from the current activity?

a)

beginActivity

b)

startActivity

c)

newActivity

d)

openActivity

13.

What is an implicit intent used for?

a)

To open a service of the current app

b)

To open an activity of another app

c)

To close an activity of another app

d)

To open an activity of the current app

14.

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?

a)

databases

b)

cache

c)

shared_prefs

d)

files

e)

No files are created

15.

List the callback methods in an activity’s lifecycle.

a)

onCreate(), onStart(), onActivityStarted(), onResume(), onPause(), onStop(), onActivityDestroy(), onDestroy()

b)

onCreate(), onStart(), onResume(), onPause(), onStop(), onRestart(), onDestroy()

c)

onCreate(), onInit(), onStart(), onPause(), onStop(), onDestroy(), onResume()

d)

onCreate(), onStart(), onPause(), onResume(), onFinish(), onStop(), onDestroy()

16.

Which is used to observe lifecycle changes in an activity?

a)

LiveData

b)

LifecycleObserver

c)

ViewModel

d)

DataBinding

17.

Which of the following statements about intents is not correct?

a)

Explicit intents require specifying the activity class to open.

b)

Implicit and explicit intents allow an app to open an activity from another app.

c)

Intents are carried out using the startActivity() method.

d)

When performing an implicit intent, the system always opens a chooser dialog for the user to select an activity.

18.

What happens if withTimeout() exceeds its time limit?

a)

A warning is sent but the coroutine does not stop

b)

The coroutine keeps running

c)

A TimeoutCancellationException is thrown

d)

The entire app stops

19.

In Kotlin coroutines, what type does the launch() function return?

a)

Thread

b)

CoroutineScope

c)

Job

d)

Deferred

20.

LiveData is part of which library in Android?

a)

AndroidX ViewBinding

b)

Android Room

c)

Android Jetpack

d)

Android Core Library

21.

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?

a)

@{checkBox.checked ? View.VISIBLE : View.GONE}

b)

@{checkBox.isChecked ? View.VISIBLE : View.GONE}

c)

@{checkBox.checked ? View.GONE : View.VISIBLE}

d)

@{checkBox.visibility}

22.

Which list type cannot be used with the ArrayAdapter class?

a)

GridView

b)

ListView

c)

Spinner

d)

RecyclerView

23.

Which statement is NOT correct about implicit intents?

a)

Android receives the request and finds an app that matches it.

b)

Android uses a list of registered apps to launch an implicit intent.

c)

To open something with an implicit intent, you must know the class name of the target activity.

d)

If more than one app can handle it, Android shows a dialog for the user to choose an app.

24.

Which dispatcher is used to run a coroutine on the UI thread?

a)

Dispatchers.IO

b)

Dispatchers.Default

c)

newSingleThreadContext()

d)

Dispatchers.Main

25.

If the onCreateOptionsMenu method is overridden in an activity, which type of menu is created?

a)

Context Menu

b)

Popup Menu

c)

Navigation Drawer Menu

d)

ActionBar Menu

26.

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?

a)

@Delete("DELETE FROM students WHERE mssv = :mssv")

b)

@Delete

c)

@Query("DELETE FROM students WHERE mssv = :mssv")

27.

When using the Room library, which annotation marks a class as a table in the database?

a)

@Entity

b)

@Dao

c)

@PrimaryKey

d)

@Database

28.

What is the Room library used for?

a)

Authenticating users

b)

Performing database operations

c)

Making network connections

d)

Encrypting data

29.

To enable Data Binding in a project, what should be added to the build.gradle file?

a)

enableDataBinding()

b)

buildFeatures { dataBinding = true }

c)

No changes are required

d)

dataBinding.enabled = true

30.

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?

a)

SampleActivityBinding

b)

ActivitySampleBinding

c)

sample_activity_binding

d)

activity_sample_binding

31.

When using Data Binding, which XML syntax is used to bind a value from a ViewModel to a View?

a)

#{}

b)

@{}

c)

%{}

d)

${}

32.

To display a list with a complex, multi-component item layout, which widget is set up differently from the others?

a)

AutoCompleteTextView

b)

Spinner

c)

RecyclerView

d)

GridView

e)

ListView

33.

Which statement about ViewModel is not correct?

a)

A ViewModel can be used to share data between fragments.

b)

A ViewModel can be used to share data between activities.

c)

Each fragment can create its own ViewModel.

d)

A fragment can access the hosting activity’s ViewModel.

34.

Which statement is not an advantage of using fragments (compared to activities)?

a)

Navigating between fragments allows using complex design patterns such as TabBar or NavigationDrawer.

b)

Fragments are lighter than activities, so fragments should always be preferred over activities.

c)

Using multiple fragments in one activity enables adaptive UIs for different screen sizes.

d)

The same fragment class can be reused in different activities.

35.

Which class is not used for performing network operations in Android?

a)

Retrofit

b)

Volley

c)

HttpURLConnection

d)

JSONObject

36.

What is the purpose of the RecyclerView class?

a)

Accessing a database

b)

A layout type for arranging the interface

c)

A memory management tool

d)

Displaying a list

37.

The onCreateView() method is called only once during a fragment’s lifecycle. Is this statement true or false?

a)

True

b)

False