Black Friday Special Sale - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: mxmas70

Home > Google > Google Developers Certification > Associate-Android-Developer

Associate-Android-Developer Google Developers Certification - Associate Android Developer (Kotlin and Java Exam) Question and Answers

Question # 4

As an example. In an Activity we have our TimerViewModel object (extended ViewModel), named mTimerViewModel. mTimerViewModel.getTimer() method returns a LiveData value. What can be a correct way to set an observer to change UI in case if data was changed?

A.

mTimerViewModel.getTimer().getValue().toString().observe(new Observer() {

@Override

public void onChanged(Long aLong) {

callAnyChangeUIMethodHere(aLong)

}

});

B.

mTimerViewModel.getTimer().observe(this, new Observer() {

@Override

public void onChanged(Long aLong) {

callAnyChangeUIMethodHere(aLong)

}

});

C.

mTimerViewModel.observe(new Observer() {

@Override

public void onChanged(Long aLong) {

callAnyChangeUIMethodHere(aLong)

}

});

Full Access
Question # 5

RecyclerView is a subclass of ViewGroup and is a more resource-efficient way to display scrollable lists. Instead of creating a View for each item that may or may not be visible on the screen, RecyclerView:

A.

creates a single list item and reuses it for visible content.

B.

creates an unlimited number of list items and never reuses them

C.

creates a limited number of list items and reuses them for visible content.

D.

creates a single list item and never reuses it

Full Access
Question # 6

Under the hood WorkManager uses an underlying job dispatching service based on the following criteria. You need to move services to the correct places.

Full Access
Question # 7

Custom views and directional controller clicks. On most devices, clicking a view using a directional controller sends (to the view currently in focus) a KeyEvent with:

A.

KEYCODE_DPAD_CENTER

B.

KEYCODE_BUTTON_START

C.

KEYCODE_CALL

D.

KEYCODE_BUTTON_SELECT

Full Access
Question # 8

Working with Custom View. Once you define the custom attributes, you can use them in layout XML files just like built-in attributes. The only difference is that your custom attributes belong to a different namespace. Instead of belonging to the http://schemas.android.com/apk/res/android namespace, they belong to:

Full Access
Question # 9

What is the placeholder tag used for?

A.

To mark text that should not be translated.

B.

To raise a translation priority to a higher level

C.

To raise a quantity of translations for the string

D.

To pick up and move sting translation from a different resource file

Full Access
Question # 10

If constant LENGTH_INDEFINITE is used as a parameter for the setDuration method in Snackbar, what will happen?

A.

The Snackbar will be displayed for a short period of time.

B.

The Snackbar will be displayed for a long period of time.

C.

The Snackbar will be displayed for a very long period of time.

D.

The Snackbar will be displayed from the time that is shown until either it is dismissed, or another Snackbar is shown.

E.

The constant LENGTH_INDEFINITE is impossible parameter for the setDuration method in Snackbar

Full Access
Question # 11

“workManager” is an instance of WorkManager. Select correct demonstration of WorkRequest cancellation:

A.

workManager.enqueue(new OneTimeWorkRequest.Builder(FooWorker.class).build());

B.

WorkRequest request = new OneTimeWorkRequest.Builder(FooWorker.class).build(); workManager.enqueue(request);

LiveData status = workManager.getWorkInfoByIdLiveData(request.getId ());

status.observe(...);

C.

WorkRequest request = new OneTimeWorkRequest.Builder(FooWorker.class).build(); workManager.enqueue(request);

workManager.cancelWorkById(request.getId());

D.

WorkRequest request1 = new OneTimeWorkRequest.Builder(FooWorker.class).build();

WorkRequest request2 = new OneTimeWorkRequest.Builder(BarWorker.class).build

();

WorkRequest request3 = new OneTimeWorkRequest.Builder(BazWorker.class).build

();

workManager.beginWith(request1, request2).then(request3).enqueue();

E.

WorkRequest request = new OneTimeWorkRequest.Builder(FooWorker.class).build(); workManager.enqueue(request);

workManager.cancelWork(request);

Full Access
Question # 12

For example, we have a file in our assets folder app/src/main/assets/sample_teas.json. To get an

InputStream for reading it, from out Context context, we can try doing this:

A.

InputStream input = context.getResources().openRawResource(R.raw.sample_teas);

B.

InputStream input = context.getAssets().open("sample_teas.json");

C.

InputStream input = context.getResources().getAssets().open ("sample_teas.json");

Full Access
Question # 13

Content labels. What attribute to use to indicate that a View should act as a content label for another View?

A.

android:contentDescription

B.

android:hint

C.

android:labelFor

Full Access
Question # 14

If you want the Database Inspector to automatically update the data it presents as you interact with your running app, check the Live updates checkbox at the top of the inspector window. While live updates are enabled, what happens with the table in the inspector window?

A.

It is still editable. You can modify data in a table by double-clicking a cell, typing a new value, and pressing Enter.

B.

It becomes read-only and you cannot modify its values.

C.

It becomes read-only, but you cannot see its updated values before updating the data by clicking the Refresh table button at the top of the inspector window.

Full Access
Question # 15

When your code execution reaches the breakpoint, Android Studio pauses execution of your app. You can

then use the tools in the Debugger tab to identify the state of the app. With Step Out you can

A.

examine the object tree for a variable; expand it in the Variables view. If the Variables view is not visible

B.

evaluate an expression at the current execution point

C.

advance to the next line in the code (without entering a method)

D.

advance to the first line inside a method call

E.

advance to the next line outside the current method

F.

continue running the app normally

Full Access
Question # 16

About running a debuggable build variant. Usually, you can just select the default "debug" variant that's included in every Android Studio project (even though it's not visible in the build.gradle file). But if you define new build types that should be debuggable, you must add ‘debuggable true’ to the build type. Is that mostly true?

A.

Yes.

B.

No, if you define new build types that should be debuggable, you must add ‘debuggable false’

C.

No, the debug variant should be visible in the build.gradle file anyway.

Full Access
Question # 17

What is demonstrated by the code below?

// RawDao.kt

@Dao

interface RawDao {

@RawQuery

fun getUserViaQuery(query: SupportSQLiteQuery?): User?

}

// Usage of RawDao

...

val query =

SimpleSQLiteQuery("SELECT * FROM User WHERE id = ? LIMIT 1",

arrayOf(sortBy))

val user = rawDao.getUserViaQuery(query)

...

A.

A method in a Dao annotated class as a raw query method where you can pass the query as a

SupportSQLiteQuery.

B.

A method in a Dao annotated class as a query method.

C.

A method in a RoomDatabase class as a query method.

Full Access
Question # 18

In a class PreferenceFragmentCompat. As a convenience, this fragment implements a click listener for any preference in the current hierarchy. So, in what overridden method we can handle that a preference in the tree rooted at this PreferenceScreen has been clicked?

A.

onCreateLayoutManager

B.

onCreatePreferences

C.

onCreateRecyclerView

D.

onPreferenceTreeClick

Full Access
Question # 19

When your code execution reaches the breakpoint, Android Studio pauses execution of your app. You can then use the tools in the Debugger tab to identify the state of the app. With Step Over you can

A.

examine the object tree for a variable; expand it in the Variables view.

B.

evaluate an expression at the current execution point

C.

advance to the next line in the code (without entering a method)

D.

advance to the first line inside a method call

E.

advance to the next line outside the current method

F.

continue running the app normally

Full Access