Free Associate Android Developer Exam Braindumps (page: 15)

Page 14 of 33

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

  1. Data Access Objects are the main classes where you define your database interactions. They can include a variety of query methods.
  2. 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.
  3. An abstract @Dao class can optionally have a constructor that takes a Database as its only parameter.
  4. It is recommended to have only one Dao class in your codebase for all tables.

Answer(s): D



By adding a RoomDatabase.Callback to the room database builder RoomDatabase.Builder (method
addCallback(RoomDatabase.Callback callback)), we can: (Choose two.)

  1. set the database factory
  2. handle database first time creation
  3. handle database opening
  4. disable the main thread query check for Room

Answer(s): B,C



By executing an allowMainThreadQueries() method to the room database builder
RoomDatabase.Builder, we can:

  1. set the database factory
  2. handle database first time creation
  3. handle database opening
  4. disable the main thread query check for Room

Answer(s): D



Room can export your database's schema information into a JSON file at compile time. What annotation processor property you should set in your app/build.gradle file to export the schema?

  1. room.expandProjection
  2. room.incremental
  3. room.schemaLocation

Answer(s): C

Explanation:

android {
...
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
}
}






Post your Comments and Discuss Google Associate Android Developer exam with other Community members: