Pass4itsure > Google > Google Certifications > ASSOCIATE-ANDROID-DEVELOPER > ASSOCIATE-ANDROID-DEVELOPER Online Practice Questions and Answers

ASSOCIATE-ANDROID-DEVELOPER Online Practice Questions and Answers

Questions 4

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

A. val sendIntent = Intent(this, UploadService::class.java).apply { putExtra(Intent.EXTRA_TEXT, textMessage) ...

B. val sendIntent = Intent().apply { type = Intent.ACTION_SEND; ...

C. val sendIntent = Intent(this, UploadService::class.java).apply { data = Uri.parse(fileUrl) ...

D. val sendIntent = Intent().apply { action = Intent.ACTION_SEND ...

Buy Now
Questions 5

The following code snippet shows an example of an Espresso test:

A. @Rule

fun greeterSaysHello() {

onView(withId(R.id.name_field)).do(typeText("Steve"))

onView(withId(R.id.greet_button)).do(click())

onView(withText("Hello Steve!")).check(matches(isDisplayed()))

}

B. @Test

fun greeterSaysHello() {

onView(withId(R.id.name_field)).perform(typeText("Steve"))

onView(withId(R.id.greet_button)).perform(click())

onView(withText("Hello Steve!")).check(matches(isDisplayed()))

}

C. @Test

fun greeterSaysHello() {

onView(withId(R.id.name_field)).do(typeText("Steve"))

onView(withId(R.id.greet_button)).do(click())

onView(withText("Hello Steve!")).compare(matches(isDisplayed()))

}

Buy Now
Questions 6

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”?

A. modelClass.getConstructor().newInstance(mRepository)

B. modelClass.getConstructor(MyRepository::class.java).newInstance()

C. modelClass.getConstructor(MyRepository::class.java).newInstance(mRepository)

Buy Now
Questions 7

What is demonstrated by the code below?

// RawDao.kt@Daointerface RawDao {

@RawQueryfun getUserViaQuery(query: SupportSQLiteQuery?): User?}

// Usage of RawDao

...

val query =

SimpleSQLiteQuery("SELECT * FROM User WHERE id = ? LIMIT 1",

arrayOf(sortBy))val user = rawDao.getUserViaQuery(query) ...

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 8

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)

}

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 9

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

Example:

@Dao

interface MyDao {@Updatefun updateUsers(vararg users: User)

}

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 10

In our TeaViewModelclass, that extends ViewModel, we have such method:

public LiveData getTea() {return mTea;}

An observer in our Activity (type of mViewModelvariable in example is TeaViewModel) is set in this way:

mViewModel.getTea().observe(this, this::displayTea);

What will be a correct displayTea method definition?

A. private void displayTea()

B. private void displayTea(Tea tea)

C. private void displayTea(LiveData)

D. private void displayTea(LiveData)

Buy Now
Questions 11

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

A. Make Module

B. Generate Signed Bundle / APK

C. Rebuild Project

D. Clean Project

E. Make Project

Buy Now
Questions 12

Select correct statements about Hardware Abstraction Layer (HAL). (Choose two.)

A. The HAL provides standard interfaces that expose device hardware capabilities to the higher-level Java API framework.

B. The HAL function both as apps for users and to provide key capabilities that developers can access from their own app. For example, if your app would like to deliver an SMS message, you don't need to build that functionality yourself ? you can instead invoke whichever SMS app is already installed to deliver a message to the recipient you specify

C. The HAL consists of multiple library modules, each of which implements an interface for a specific type of hardware component, such as the camera or bluetooth module. When a framework API makes a call to access device hardware, the Android system loads the library module for that hardware component.

D. Using a HAL, not using a Linux kernel, allows Android to take advantage of key security features and allows device manufacturers to develop hardware drivers for a well-known kernel.

Buy Now
Questions 13

When using an ImageView, ImageButton, CheckBox, or other View that conveys information graphically. What attribute to use to provide a content label for that View?

A. android:contentDescription

B. android:hint

C. android:labelFor

Buy Now
Exam Name: Google Developers Certification - Associate Android Developer (Kotlin and Java Exam)
Last Update: Apr 19, 2024
Questions: 128
10%OFF Coupon Code: SAVE10

PDF (Q&A)

$45.99

VCE

$49.99

PDF + VCE

$59.99