Pass the Google Google Developers Certification Associate-Android-Developer Questions and answers with CertsForce

Viewing page 3 out of 4 pages
Viewing questions 21-30 out of questions
Questions # 21:

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/


Questions # 22:

To handle an options menu item click in an activity, we usually should override method named:

Options:

A.

onKey


B.

onClick


C.

onOptionsItemSelected


Questions # 23:

Relative positioning is one of the basic building blocks of creating layouts in ConstraintLayout. Constraints allow you to position a given widget relative to another one. What constraints do not exist?

Options:

A.

layout_constraintBottom_toBottomOf


B.

layout_constraintBaseline_toBaselineOf


C.

layout_constraintBaseline_toStartOf


D.

layout_constraintStart_toEndOf


Questions # 24:

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.


Questions # 25:

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

Question # 25


Questions # 26:

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.


Questions # 27:

What is a correct part of an Implicit Intent for sharing data implementation?

Options:

A.

Intent sendIntent = new Intent(this, UploadService.class) sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage);


B.

Intent sendIntent = new Intent(); sendIntent.setType(Intent.ACTION_SEND);


C.

Intent sendIntent = new Intent(this, UploadService.class) sendIntent.setData(Uri.parse(fileUrl));


D.

Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND);


Questions # 28:

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.


Questions # 29:

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

public MyViewModel(MyRepository myRepository)...

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

@NonNull

@Override

public T create(@NonNull Class modelClass) { try {

//MISSED RETURN VALUE HERE

} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {

throw new RuntimeException("Cannot create an instance of " + modelClass, e);

}

}

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

Options:

A.

return modelClass.getConstructor()

.newInstance(mRepository);


B.

return modelClass.getConstructor(MyRepository.class)

.newInstance();


C.

return modelClass.getConstructor(MyRepository.class)

.newInstance(mRepository);


Questions # 30:

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:

Options:

A.

http://schemas.android.com/apk/res/[your package name]


B.

http://schemas.android.com/apk/[your package name]


C.

http://schemas.android.com/[your package name]


Viewing page 3 out of 4 pages
Viewing questions 21-30 out of questions