Labour Day Special Limited Time Flat 70% Discount offer - Ends in 0d 00h 00m 00s - Coupon code: 70spcl

Google Associate-Android-Developer Google Developers Certification - Associate Android Developer (Kotlin and Java Exam) Exam Practice Test

Page: 1 / 13
Total 128 questions

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

Question 1

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

Options:

A.

Toast

B.

Snackbar

C.

for none of them

D.

for both of them

Question 2

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);

}

Options:

A.

Room generates an implementation that inserts all parameters into the database in a single transaction.

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.

C.

Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.

Question 3

If no any folder like res/anim-, res/drawable-, res/layout-, res/raw-

, res/xml- exist in the project. Which folders are required in the project anyway? (Choose two.)

Options:

A.

res/anim/

B.

res/drawable/

C.

res/layout/

D.

res/raw/

E.

res/xml/

Question 4

In a common Paging Library architecture scheme, move instances to the correct positions.

Question # 4

Options:

Question 5

What is the placeholder tag used for?

Options:

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

Question 6

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:

Options:

A.

KEYCODE_DPAD_CENTER

B.

KEYCODE_BUTTON_START

C.

KEYCODE_CALL

D.

KEYCODE_BUTTON_SELECT

Question 7

In application theme style, flag windowNoTitle () indicates:

Options:

A.

whether this window should have an Action Bar in place of the usual title bar.

B.

whether there should be no title on this window.

C.

that this window should not be displayed at all.

D.

whether this is a floating window.

E.

whether this Window is responsible for drawing the background for the system bars.

Question 8

An overridden method onCreateOptionsMenu in an Activity returns boolean value. What does this value mean?

Options:

A.

You must return true for the menu to be displayed; if you return false it will not be shown.

B.

You must return false for the menu to be displayed; if you return true it will not be shown.

C.

You can return any value: the menu will be displayed anyway.

Question 9

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

Options:

A.

setContentInfo

B.

setContentIntent

C.

setDeleteIntent

Question 10

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?

Options:

A.

NotificationChannel.setPriority()

B.

NotificationChannel.setImportance()

C.

NotificationCompat.Builder.setImportance()

Question 11

In general, you should send an AccessibilityEvent whenever the content of your custom view changes. For example, if you are implementing a custom slider bar that allows a user to select a numeric value by pressing the left or right arrows, your custom view should emit an event of type TYPE_VIEW_TEXT_CHANGED whenever the slider value changes. Which one of the following sample codes demonstrates the use of the sendAccessibilityEvent() method to report this event.

Options:

A.

override fun dispatchPopulateAccessibilityEvent(event: AccessibilityEvent): Boolean {

return super.dispatchPopulateAccessibilityEvent(event).let { completed -> if (text?.isNotEmpty() == true) {

event.text.add(text) true

} else {

completed

}

}

}

B.

override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { return when(keyCode) {

KeyEvent.KEYCODE_DPAD_LEFT -> {

currentValue--

sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED)

true

}

...

}

}

C.

override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean { return when(keyCode) {

KeyEvent.KEYCODE_ENTER -> {

currentValue--

sendAccessibilityEvent

(AccessibilityEvent.TYPE_VIEW_CONTEXT_CLICKED)

true

}

...

}

}

Question 12

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?

Options:

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.

Question 13

In a class PreferenceFragmentCompat. What method is called during onCreate(Bundle) to supply the preferences for this fragment. And where subclasses are expected to call setPreferenceScreen (PreferenceScreen) either directly or via helper methods such as addPreferencesFromResource (int)?

Options:

A.

onCreateLayoutManager

B.

onCreatePreferences

C.

onCreateRecyclerView

D.

onCreateView

Question 14

The easiest way of adding menu items (to specify the options menu for an activity) is inflating an XML file into the Menu via MenuInflater. With menu_main.xml we can do it in this way:

Options:

A.

override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu)

return true

}

B.

override fun onOptionsItemSelected(item: MenuItem): Boolean {

menuInflater.inflate(R.menu.menu_main, menu) return super.onOptionsItemSelected(item)

}

C.

override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.menu.menu_main)

}

Question 15

As an example. Our MutableLiveData object, named mLapseTime, is not connected to a Room database, etc. How can we change the value in mLapseTime?

Options:

A.

mLapseTime.postValue(“new String”)

B.

mLapseTime.setValue(1000l)

C.

mLapseTime.changeValue(1000l)

Question 16

In a class extended PreferenceFragmentCompat. What method is used to inflate the given XML resource and add the preference hierarchy to the current preference hierarchy?

Options:

A.

findPreference

B.

getPreferenceManager

C.

addPreferencesFromResource

D.

setPreferenceScreen

Question 17

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 do this:

Options:

A.

val input = context!!.resources.openRawResource(R.raw.sample_teas)

B.

val input = context!!.assets.open("sample_teas.json")

C.

val input = context!!.resources.assets.open("sample_teas.json")

Question 18

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 Into Question # 18 you can

Options:

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

Question 19

What happens when you create a DAO method and annotate it with @Insert?

Example:

@Dao

interface MyDao {

@Insert(onConflict = OnConflictStrategy.REPLACE)

fun insertUsers(vararg users: User)

}

Options:

A.

Room generates an implementation that inserts all parameters into the database in a single transaction.

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.

C.

Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.

Page: 1 / 13
Total 128 questions