ExamGecko
Home Home / Google / Associate Android Developer

Google Associate Android Developer Practice Test - Questions Answers, Page 9

Question list
Search
Search

List of questions

Search

Related questions











What do you want from Room when you create a DAO method and annotate it with @Update?

Example:

@Dao

public interface MyDao { @Update

public void updateUsers(User... users); }

A.
Room generates an implementation that inserts all parameters into the database in a single transaction.
A.
Room generates an implementation that inserts all parameters into the database in a single transaction.
Answers
B.
Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.
B.
Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.
Answers
C.
Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.
C.
Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.
Answers
Suggested answer: B

What do you want from Room when you create a DAO method and annotate it with @Delete?

Example:

@Dao

public interface MyDao { @Delete

public void deleteUsers(User... users); }

A.
Room generates an implementation that inserts all parameters into the database in a single transaction.
A.
Room generates an implementation that inserts all parameters into the database in a single transaction.
Answers
B.
Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.
B.
Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.
Answers
C.
Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.
C.
Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.
Answers
Suggested answer: C

In Android 8.0, API level 26, some APIs regarding notification behaviors were moved from Notification to NotificationChannel. For example, what should we use instead of NotificationCompat.Builder.setPriority() for Android 8.0 and higher?

A.
NotificationChannel.setPriority()
A.
NotificationChannel.setPriority()
Answers
B.
NotificationChannel.setImportance()
B.
NotificationChannel.setImportance()
Answers
C.
NotificationCompat.Builder.setImportance()
C.
NotificationCompat.Builder.setImportance()
Answers
Suggested answer: B

Explanation:

Reference:

https://developer.android.com/training/notify-user/build-notification

What method should we use with Notification.Builder to supply a PendingIntent to be sent when the notification is clicked?

A.
setContentInfo
A.
setContentInfo
Answers
B.
setContentIntent
B.
setContentIntent
Answers
C.
setDeleteIntent
C.
setDeleteIntent
Answers
Suggested answer: B

Explanation:

Reference:

https://developer.android.com/training/notify-user/build-notification

When scheduling unique work, you must tell WorkManager what action to take when there is a conflict. You do this by passing an enum when enquing the work.

For one-time work, you provide an ExistingWorkPolicy, which supports some options for handling the conflict. (Choose four.)

A.
REPLACE (existing work with the new work. This option cancels the existing work)
A.
REPLACE (existing work with the new work. This option cancels the existing work)
Answers
B.
KEEP (existing work and ignore the new work)
B.
KEEP (existing work and ignore the new work)
Answers
C.
APPEND (the new work to the end of the existing work. This policy will cause your new work to be chained to the existing work, running after the existing work finishes)
C.
APPEND (the new work to the end of the existing work. This policy will cause your new work to be chained to the existing work, running after the existing work finishes)
Answers
D.
APPEND_OR_REPLACE (functions similarly to APPEND, except that it is not dependent on prerequisite work status. If the existing work is CANCELLED or FAILED, the new work still runs)
D.
APPEND_OR_REPLACE (functions similarly to APPEND, except that it is not dependent on prerequisite work status. If the existing work is CANCELLED or FAILED, the new work still runs)
Answers
E.
APPEND_OR_KEEP (functions similarly to APPEND, except that it is not dependent on prerequisite work status. If the existing work is CANCELLED or FAILED, the new work still not runs)
E.
APPEND_OR_KEEP (functions similarly to APPEND, except that it is not dependent on prerequisite work status. If the existing work is CANCELLED or FAILED, the new work still not runs)
Answers
F.
APPEND_AND_RUN (functions similarly to APPEND, except that it is not dependent on prerequisite work status. If the existing work is PAUSED, the new work still runs)
F.
APPEND_AND_RUN (functions similarly to APPEND, except that it is not dependent on prerequisite work status. If the existing work is PAUSED, the new work still runs)
Answers
G.
DESTROY (if any work exists, the new work will be ignored)
G.
DESTROY (if any work exists, the new work will be ignored)
Answers
H.
APPEND_OR_DESTROY (if no any work exists, the new work will be ignored)
H.
APPEND_OR_DESTROY (if no any work exists, the new work will be ignored)
Answers
Suggested answer: A, B, C, D

Explanation:

Videos:

Working with WorkManager, from the 2018 Android Dev Summit

WorkManager: Beyond the basics, from the 2019 Android Dev Summit

Reference: https://developer.android.com/reference/androidx/work/WorkManager?hl=en

If you are working with a Builder that creates a PeriodicWorkRequest to run periodically once within the flex period of every interval period. What statement is correct?

A.
The repeat interval must be greater than PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval must be greater than PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.
A.
The repeat interval must be greater than PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval must be greater than PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.
Answers
B.
The repeat interval must be lower than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval must be lower than or equal to PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.
B.
The repeat interval must be lower than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval must be lower than or equal to PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.
Answers
C.
The repeat interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval can be anything in relation to PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.
C.
The repeat interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval can be anything in relation to PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.
Answers
D.
The repeat interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.
D.
The repeat interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.
Answers
Suggested answer: D

Explanation:

Videos:

Working with WorkManager, from the 2018 Android Dev Summit

WorkManager: Beyond the basics, from the 2019 Android Dev Summit

Reference: https://developer.android.com/reference/androidx/work/WorkManager?hl=en

Custom duration in milliseconds as a parameter for the setDuration method is available when you are working with:

A.
Toast
A.
Toast
Answers
B.
Snackbar
B.
Snackbar
Answers
C.
for none of them
C.
for none of them
Answers
D.
for both of them
D.
for both of them
Answers
Suggested answer: B

Explanation:

Reference:

https://developer.android.com/guide/topics/ui/notifiers/toasts https://developer.android.com/training/snackbar/action

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.
A.
The Snackbar will be displayed for a short period of time.
Answers
B.
The Snackbar will be displayed for a long period of time.
B.
The Snackbar will be displayed for a long period of time.
Answers
C.
The Snackbar will be displayed for a very long period of time.
C.
The Snackbar will be displayed for a very long period of time.
Answers
D.
The Snackbar will be displayed from the time that is shown until either it is dismissed, or another Snackbar is shown.
D.
The Snackbar will be displayed from the time that is shown until either it is dismissed, or another Snackbar is shown.
Answers
E.
The constant LENGTH_INDEFINITE is impossible parameter for the setDuration method in Snackbar
E.
The constant LENGTH_INDEFINITE is impossible parameter for the setDuration method in Snackbar
Answers
Suggested answer: D

Explanation:

Reference: https://developer.android.com/reference/com/google/android/material/snackbar/BaseTransientBottomBar#LENGTH_INDEFINITE https://developer.android.com/guide/topics/ui/notifiers/toasts https://developer.android.com/training/snackbar/action

What public methods are there in android.widget.Toast.Callback? (Choose two.)

A.
onDismissed()
A.
onDismissed()
Answers
B.
onToastHidden()
B.
onToastHidden()
Answers
C.
onShown()
C.
onShown()
Answers
D.
onToastShown()
D.
onToastShown()
Answers
E.
onToastCancelled()
E.
onToastCancelled()
Answers
Suggested answer: B, D

Explanation:

Reference:

https://developer.android.com/guide/topics/ui/notifiers/toasts https://developer.android.com/training/snackbar/action

Which build options in the Build menu to choose to delete all intermediate/cached build files.

A.
Make Module
A.
Make Module
Answers
B.
Generate Signed Bundle / APK
B.
Generate Signed Bundle / APK
Answers
C.
Rebuild Project
C.
Rebuild Project
Answers
D.
Clean Project
D.
Clean Project
Answers
E.
Make Project
E.
Make Project
Answers
Suggested answer: D

Explanation:

Reference: https://developer.android.com/studio/run

Total 128 questions
Go to page: of 13