Kotlin Fundamentals: Architecture components quiz

  1. To avoid losing data during a device configuration change, store app data in which of these options?
  2. A ViewModel should never contain any references to fragments, activities, or views. True or false?
  3. When is a ViewModel destroyed?
  4. How do you encapsulate the LiveData stored in a ViewModel so that external objects can read data without being able to update it?
  5. LiveData updates a UI controller (such as a fragment) if the UI controller is in which of the following states?
  6. In the LiveData observer pattern, what's the observable item (what is observed)?
  7. Which of the following statements is NOT true about listener bindings?
  8. Assume your app includes this string resource <string name="generic_name">Hello %s</string>. Which of the following is the correct syntax for formatting the string, using the data-binding expression?
    android:text= "@{@string/generic_name(user.name)}"
    android:text= "@{string/generic_name(user.name)}"
    android:text= "@{@generic_name(user.name)}"
    android:text= "@{@string/generic_name,user.name}"
  9. When is a listener-binding expression evaluated and run?
  10. The Transformations.map() method provides an easy way to perform data manipulations on the LiveData and returns ___.
  11. What are the parameters for the Transformations.map() method?
  12. The lambda function passed into the Transformations.map() method is executed in which thread?