Labour Day Sale - Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 575363r9

Welcome To DumpsPedia

Associate-Android-Developer Sample Questions Answers

Questions 4

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?

Options:

A.

onCreateLayoutManager

B.

onCreatePreferences

C.

onCreateRecyclerView

D.

onPreferenceTreeClick

Buy Now
Questions 5

SharedPreferences.Editor is an interface used for modifying values in a SharedPreferences object. To mark in the editor that a preference value should be removed, which will be done in the actual preferences once commit() or apply() is called, what method in SharedPreferences.Editor should we use?

Options:

A.

delete(String key)

B.

clear()

C.

remove(String key)

D.

removeAll()

Buy Now
Questions 6

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:

Options:

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

Buy Now
Questions 7

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

Buy Now
Questions 8

What is demonstrated by the code below?

// RawDao.java

@Dao

interface RawDao {

@RawQuery

User getUserViaQuery(SupportSQLiteQuery query);

}

// Usage of RawDao

...

SimpleSQLiteQuery query =

new SimpleSQLiteQuery("SELECT * FROM UserWHERE id = ? LIMIT 1",

new Object[]{userId});

User user = rawDao.getUserViaQuery(query);

...

Options:

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.

Buy Now
Questions 9

For example, suppose that in a XML file (res/menu/menu_main.xml as an example), where menu items are described, we have such item:

...

android:id="@+id/action_settings"

android:orderInCategory="100"

android:title="@string/menu_action_settings"

app:showAsAction="never" />

...

Attribute “app:showAsAction” shows when and how this item should appear as an action item in the app bar. What value “never” in this attribute means?

Options:

A.

Only place this item in the app bar if there is room for it. If there is not room for all the items marked by this value, the items with the lowest orderInCategory values are displayed as actions, and the remaining items are displayed in the overflow menu.

B.

Also include the title text (defined by android:title) with the action item. You can include this value along with one of the others as a flag set, by separating them with a pipe.

C.

Never place this item in the app bar. Instead, list the item in the app bar's overflow menu.

D.

Always place this item in the app bar. Avoid using this unless it's critical that the item always appear in the action bar. Setting multiple items to always appear as action items can result in them overlapping with other UI in the app bar.

E.

The action view associated with this action item (as declared by android:actionLayout or android:actionViewClass) is collapsible.

Buy Now
Questions 10

If you want get a debuggable APK that people can install without adb, in Android Studio you can:

Options:

A.

Select your debug variant and click Build Bundle(s) / APK(s) > Build APK(s).

B.

Click the Run button from toolbar

C.

Select your debug variant and click Analyze APK.

Buy Now
Questions 11

To build a debug APK, you can open a command line and navigate to the root of your project directory. To initiate a debug build, invoke the assembleDebug task:

gradlew assembleDebug

This creates an APK named [module_name]-debug.apk in [project_name]/[module_name]/build/outputs/apk/

Select correct statements about generated file. (Choose all that apply.)

Options:

A.

The file is already signed with the debug key

B.

The file is already aligned with zipalign

C.

You can immediately install this file on a device.

Buy Now
Questions 12

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.

Buy Now
Questions 13

For example, our preferences.xml file was added by addPreferencesFromResource (R.xml.preferences). Our preferences.xml file contains such item:

android:title="@string/pref_sort_title" android:summary="@string/pref_sort_summary" android:dialogTitle="@string/pref_sort_dialog_title" android:entries="@array/sort_oder" android:entryValues="@array/sort_oder_value" android:defaultValue="@string/pref_default_sort_value" app:iconSpaceReserved="false" />

In our Fragment, we can dynamically get current notification preference value in this way:

Options:

A.

String sortBy = PreferenceManager.getDefaultSharedPreferences(getContext ()).getString(

getContext().getString(R.string.pref_sort_key), getContext().getResources().getBoolean(R.bool.pref_default_sort_value)

);

B.

String sortBy = PreferenceManager.getSharedPreferences(getContext()).getString( getContext().getString(R.string.pref_default_sort_value), getContext().getString(R.string.pref_sort_key)

);

C.

boolean sortBy = PreferenceManager.getSharedPreferences(getContext()).getBoolean (

getContext().getResources().getBoolean(R.bool.pref_default_sort_value), getContext().getString(R.string.pref_sort_key)

);

D.

String sortBy = PreferenceManager.getDefaultSharedPreferences(getContext ()).getString(

getContext().getString(R.string.pref_sort_key), getContext().getString(R.string.pref_default_sort_value)

)

Buy Now
Questions 14

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

Options:

A.

android:contentDescription

B.

android:hint

C.

android:labelFor

Buy Now
Questions 15

What statements about InputStreamReader (java.io.InputStreamReader) are correct? (Choose two.)

Options:

A.

An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.

B.

An InputStreamReader is a bridge from character streams to byte streams: It reads characters using a specified charset and encodes them into bytes. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.

C.

Each invocation of one of an InputStreamReader's read() methods may cause one or more bytes to be read from the underlying byte-input stream. To enable the efficient conversion of bytes to characters, more bytes may be read ahead from the underlying stream than are necessary to satisfy the current read operation.

D.

No any invocation of one of an InputStreamReader's read() methods can cause some bytes to be read from the underlying byte-input stream.

Buy Now
Questions 16

With a room database. When performing queries, you'll often want your app's UI to update automatically when the data changes. Can you use a return value of type LiveData in your query method description to achieve this?

Options:

A.

Yes

B.

No

Buy Now
Questions 17

An example. In our ViewModelFactory (that implements ViewModelProvider.Factory) we have an instance of our Repository, named mRepository. Our ViewModel has such constructor:

class MyViewModel(private val mRepository: MyRepository) : ViewModel() ...

Next, in our ViewModelFactory create ViewModel method (overriden) looks like this:

override fun create(modelClass: Class): T {

return try {

//MISSED RETURN VALUE HERE”

} catch (e: InstantiationException) {

throw RuntimeException("Cannot create an instance of $modelClass", e)

} catch (e: IllegalAccessException) {

throw RuntimeException("Cannot create an instance of $modelClass", e)

} catch (e: NoSuchMethodException) {

throw RuntimeException("Cannot create an instance of $modelClass", e)

} catch (e: InvocationTargetException) {

throw RuntimeException("Cannot create an instance of $modelClass", e)

}

}

What should we write instead of “//MISSED RETURN VALUE HERE”?

Options:

A.

modelClass.getConstructor()

.newInstance(mRepository)

B.

modelClass.getConstructor(MyRepository::class.java)

.newInstance()

C.

modelClass.getConstructor(MyRepository::class.java)

.newInstance(mRepository)

Buy Now
Questions 18

What is the incorrect statement about Data Access Object (androidx.room.Dao)?

Options:

A.

Data Access Objects are the main classes where you define your database interactions. They can include a variety of query methods.

B.

The class marked with @Dao should either be an interface or an abstract class. At compile time, Room will

generate an implementation of this class when it is referenced by a Database.

C.

An abstract @Dao class can optionally have a constructor that takes a Database as its only parameter.

D.

It is recommended to have only one Dao class in your codebase for all tables.

Buy Now
Exam Code: Associate-Android-Developer
Exam Name: Google Developers Certification - Associate Android Developer (Kotlin and Java Exam)
Last Update: Apr 26, 2024
Questions: 128
$64  $159.99
$48  $119.99
$40  $99.99
buy now Associate-Android-Developer