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

Viewing page 1 out of 4 pages
Viewing questions 1-10 out of questions
Questions # 1:

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


Questions # 2:

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)


Questions # 3:

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)

}


Questions # 4:

With recommended app architecture. Fill the following diagram, which shows how all the modules usually should interact with one another after designing the app (drag modules to correct places).

Question # 4


Questions # 5:

To run a debuggable build variant you must use a build variant that includes

Options:

A.

minifyEnabled false in the build configuration


B.

debuggable true or debuggable false in the build configuration


C.

debuggable true in the build configuration


Questions # 6:

About queries in DAO classes. Room verifies the return value of the query such that if the name of the field in the returned object doesn't match the corresponding column names in the query response, Room alerts you in one of the following two ways: (Choose two.)

Options:

A.

It gives a warning if no field names match.


B.

It gives a warning if only some field names match.


C.

It gives an error if no field names match.


D.

It gives an error if only some field names match.


Questions # 7:

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)


Questions # 8:

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.


Questions # 9:

To run your local unit tests, follow these steps:

1.Be sure your project is synchronized with Gradle by clicking Sync Project in the toolbar.

2.Run your test in one of the following ways (select possible): (Choose three.)

Options:

A.

To run a single test, open the Project window, and then right-click a test and click Run.


B.

To test all methods in a class, right-click a class or method in the test file and click Run.


C.

To run all tests in a directory, right-click on the directory and select Run tests.


D.

To run all tests in Project, open the Project window, and then right-click a test and click Run.


Questions # 10:

Enable debugging on your device: If you are using the emulator, this is enabled by default. But for a connected device, you need to

Options:

A.

enable transfer data from the device in usb connection options.


B.

enable debugging in the device developer options.


C.

enable connection in bluetooth options.


Viewing page 1 out of 4 pages
Viewing questions 1-10 out of questions