Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

12/4/23, 4:40 PM Lesson 1: Kotlin basics | Android Developers

Lesson 1: Kotlin basics


Let's do a quick test! You must answer at least 5 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. Which file extension is used to save Kotlin files?

radio_button_unchecked .java
radio_button_unchecked .kot
radio_button_unchecked .kt or .kts
radio_button_unchecked .android

2. Which keyword is used to define an immutable variable?

radio_button_unchecked var
radio_button_unchecked val
radio_button_unchecked immulvar
radio_button_unchecked immutableVar

3. Is Kotlin interoperable with Java programming language?

radio_button_unchecked Yes, it is interoperable


radio_button_unchecked No, it is not interoperable

https://developer.android.com/courses/quizzes/android-development-with-kotlin-1/android-development-with-kotlin-1?continue=https%3A%2F%2Fdev… 1/3
12/4/23, 4:40 PM Lesson 1: Kotlin basics | Android Developers

4. Which command will return the length of a String in Kotlin?

radio_button_unchecked str.length
radio_button_unchecked length(str)
radio_button_unchecked str.lengthOf
radio_button_unchecked str.getLength()

5. Which of the following options is used to write null-safe code in Kotlin?

radio_button_unchecked Range
radio_button_unchecked Sealed Class
radio_button_unchecked Elvis Operator
radio_button_unchecked Lambda Function

6. What is the correct way to create an Arraylist in Kotlin?

radio_button_unchecked val map = hashMapOf(1 to "one", 2 to "two", 3 to "three")

radio_button_unchecked enum class Color {RED, GREEN, BLUE}

radio_button_unchecked val set = hashSetOf(1, 2, 3)

radio_button_unchecked val list = arrayListOf(1, 2, 3)

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-1/android-development-with-kotlin-1?continue=https%3A%2F%2Fdev… 2/3
12/4/23, 4:41 PM Lesson 2: Functions | Android Developers

Lesson 2: Functions
Let's do a quick test! You must answer at least 4 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. Functions in Kotlin are created with the following keyword?

radio_button_unchecked void
radio_button_unchecked fun
radio_button_unchecked function
radio_button_unchecked def

2. What is the default return type of any functions defined in Kotlin?

radio_button_unchecked Int
radio_button_unchecked Double
radio_button_unchecked void
radio_button_unchecked Unit

3. The function to print a line in Kotlin is ?

radio_button_unchecked println()
radio_button_unchecked printLine()

https://developer.android.com/courses/quizzes/android-development-with-kotlin-2/android-development-with-kotlin-2?continue=https%3A%2F%2Fdev… 1/3
12/4/23, 4:41 PM Lesson 2: Functions | Android Developers

radio_button_unchecked linePrint()
radio_button_unchecked line()

4. The 'when' statement in Kotlin is similar to which statement in other


programming languages?

radio_button_unchecked if
radio_button_unchecked break
radio_button_unchecked switch
radio_button_unchecked continue

5. What are lambdas in Kotlin?

radio_button_unchecked A lambda is a Data Type in Kotlin


radio_button_unchecked A lambda is a Class type in Kotlin
radio_button_unchecked A lambda is an Interface in Kotlin
radio_button_unchecked A lambda is an expression that describes a function. But instead of declaring a named
function, you declare a function that has no name

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-2/android-development-with-kotlin-2?continue=https%3A%2F%2Fdev… 2/3
12/4/23, 4:41 PM Lesson 3: Classes and Objects | Android Developers

Lesson 3: Classes and Objects


Let's do a quick test! You must answer at least 4 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. What is the default behavior of classes in Kotlin?

radio_button_unchecked All classes are private


radio_button_unchecked All classes are sealed
radio_button_unchecked All classes are final
radio_button_unchecked All classes are protected

2. Which of the following is the correct way of declaring objects for class
Book in Kotlin?

radio_button_unchecked Book b1 = new Book()

radio_button_unchecked val b1 = Book()

radio_button_unchecked var b1 = (Book) new()

radio_button_unchecked val b1 = (new) Book()

3. What is true about extension functions in Kotlin?


Choose as many answers as you see fit.

check_box_outline_blank Allows you to write new functions for a class that you cannot modify

https://developer.android.com/courses/quizzes/android-development-with-kotlin-3/android-development-with-kotlin-3?continue=https%3A%2F%2Fdev… 1/3
12/4/23, 4:41 PM Lesson 3: Classes and Objects | Android Developers

check_box_outline_blank Use dot notation to call them on variables of the type you are extending
check_box_outline_blank It must be declared in the same file as the original class you are extending
check_box_outline_blank Use the extend keyword to declare these functions

4. Which of the following is true about data classes?


Choose as many answers as you see fit.

check_box_outline_blank It is required for you to implement the toString() method


check_box_outline_blank No parameters are needed for the primary constructor
check_box_outline_blank Use it for classes that store data
check_box_outline_blank Getter methods are automatically generated for you (and setter methods for mutable
variables)

5. Which keyword is used to indicate that a class can be subclassed?

radio_button_unchecked public
radio_button_unchecked protected
radio_button_unchecked internal
radio_button_unchecked open

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-3/android-development-with-kotlin-3?continue=https%3A%2F%2Fdev… 2/3
12/4/23, 4:50 PM Lesson 4: Build your first Android app | Android Developers

Lesson 4: Build your first Android ap


Let's do a quick test! You must answer at least 5 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. Which method on an Activity inflates the app's layout and makes its
views available as objects?

radio_button_unchecked onCreate()
radio_button_unchecked setClickListener()
radio_button_unchecked setContentView()
radio_button_unchecked show()

2. Which view attribute do you use to set the width of a View so that it
adjusts to fit the content?

radio_button_unchecked android:view_width="wrap"
radio_button_unchecked android:layout_width="wrap_content"
radio_button_unchecked android:layout_height="wrap_content"
radio_button_unchecked android:layout_width="match_parent"

3. Which method changes the image resource for an ImageView in Kotlin


code?

https://developer.android.com/courses/quizzes/android-development-with-kotlin-4/android-development-with-kotlin-4?continue=https%3A%2F%2Fdev… 1/3
12/4/23, 4:50 PM Lesson 4: Build your first Android app | Android Developers

radio_button_unchecked setImageResource()
radio_button_unchecked setImageURI()
radio_button_unchecked setImage()
radio_button_unchecked setImageRes()

4. What does the lateinit keyword in a variable declaration indicate in


Kotlin code?

radio_button_unchecked The variable is never initialized.


radio_button_unchecked The variable is only initialized at app runtime.
radio_button_unchecked The variable is automatically initialized to null .
radio_button_unchecked The variable will be initialized later. I promise!

5. Which Gradle configuration indicates the most recent API level your app
has been tested with?

radio_button_unchecked minSdkVersion
radio_button_unchecked compileSdkVersion
radio_button_unchecked targetSdkVersion
radio_button_unchecked testSdkVersion

6. Which of the following accessibility tools comes built in with most


Android devices?

radio_button_unchecked In Android Studio, Refactor > Add RTL support where possible

https://developer.android.com/courses/quizzes/android-development-with-kotlin-4/android-development-with-kotlin-4?continue=https%3A%2F%2Fdev… 2/3
12/4/23, 4:50 PM Lesson 4: Build your first Android app | Android Developers

radio_button_unchecked Accessibility Scanner


radio_button_unchecked TalkBack
radio_button_unchecked Lint

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-4/android-development-with-kotlin-4?continue=https%3A%2F%2Fdev… 3/3
12/4/23, 4:51 PM Lesson 5: Layouts | Android Developers

Lesson 5: Layouts
Let's do a quick test! You must answer at least 9 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. Which of the following is a ViewGroup ?

radio_button_unchecked EditText
radio_button_unchecked LinearLayout
radio_button_unchecked TextView
radio_button_unchecked Button

2. Which of the following listed view hierarchies is not valid?

radio_button_unchecked LinearLayout > TextView , TextView , ImageView


radio_button_unchecked ScrollView > LinearLayout > TextView , Button , ScrollView > TextView
radio_button_unchecked TextView > TextView , ImageView , ScrollView
radio_button_unchecked ConstraintLayout > TextView , EditText , Button

3. Styles are resources defined in styles.xml . Using styles, you can define
colors, fonts, text size, and many other characteristics of a view. True or
false?

https://developer.android.com/courses/quizzes/android-development-with-kotlin-5/android-development-with-kotlin-5?continue=https%3A%2F%2Fdev… 1/4
12/4/23, 4:51 PM Lesson 5: Layouts | Android Developers

radio_button_unchecked True, you can define these.


radio_button_unchecked False, you cannot define these.

4. A View can contain any number of View or ViewGroup as its children. True
or false?

radio_button_unchecked True, View can contain any number of View or ViewGroup .


radio_button_unchecked False, View can have exactly 1 child.

5. What is EditText a subclass of?

radio_button_unchecked TextField
radio_button_unchecked LinearLayout
radio_button_unchecked TextView
radio_button_unchecked Button

6. Which of the following visibility attribute values, if set on a view, makes it


so the view is hidden and does not take up any space in the layout?

radio_button_unchecked visible
radio_button_unchecked invisible
radio_button_unchecked gone
radio_button_unchecked hide

7. Which one of the following statements is true about Button views?

https://developer.android.com/courses/quizzes/android-development-with-kotlin-5/android-development-with-kotlin-5?continue=https%3A%2F%2Fdev… 2/4
12/4/23, 4:51 PM Lesson 5: Layouts | Android Developers

radio_button_unchecked A Button view is a ViewGroup .


radio_button_unchecked You can only have three Button views per screen.
radio_button_unchecked Button views are clickable, and on click, the attached click listener performs an action.
radio_button_unchecked Button is an extension of ImageView .

8. In a ConstraintLayout , which of the following choices describes the


constraints needed to keep a view in place during runtime?

radio_button_unchecked Two horizontal constraints.


radio_button_unchecked One vertical constraint.
radio_button_unchecked At least one horizontal and one vertical constraint.
radio_button_unchecked There is no need to constrain the view.

9. Which of the following constraint types expands a view only as much as


needed to fit its contents?

radio_button_unchecked Wrap content


radio_button_unchecked Match constraint
radio_button_unchecked Fixed constraint
radio_button_unchecked Baseline constraint

10. What are some benefits of using the Layout Editor in Android Studio?
Choose as many answers as you see fit.

check_box_outline_blank Drag and drop UI elements onto the screen with the visual design editor
check_box_outline_blank Edit view attributes

https://developer.android.com/courses/quizzes/android-development-with-kotlin-5/android-development-with-kotlin-5?continue=https%3A%2F%2Fdev… 3/4
12/4/23, 4:51 PM Lesson 5: Layouts | Android Developers

check_box_outline_blank Test button click behavior and see how the app will respond
check_box_outline_blank Select device type and size for the preview of your layout

11. Which of the following is not a reason for minimizing calls to


findViewById() ?

radio_button_unchecked Every time findViewById() is called, it traverses the view hierarchy.


radio_button_unchecked findViewById() runs on the main or UI thread.
radio_button_unchecked These calls can slow down the user interface.
radio_button_unchecked Your app is less likely to crash.

12. Which is the correct way to reference bound data in the XML layout?

radio_button_unchecked android:text="@={myDataClass.property}"
radio_button_unchecked android:text="@={myDataClass}"
radio_button_unchecked android:text="@={myDataClass.property.string}"
radio_button_unchecked android:text="@={myDataClass.bound_data.property}"

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-5/android-development-with-kotlin-5?continue=https%3A%2F%2Fdev… 4/4
12/4/23, 4:54 PM Lesson 6: App navigation | Android Developers

Lesson 6: App navigation


Let's do a quick test! You must answer at least 6 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. Which of the following statements about fragments are true? Select all
that apply.
Choose as many answers as you see fit.

check_box_outline_blank You can use a Fragment in more than one Activity .


check_box_outline_blank One Activity can have multiple fragments.
check_box_outline_blank After you define a Fragment in a Kotlin class, the fragment is automatically added to the
activity_main.xml layout file.

check_box_outline_blank Use the <fragment> tag to define the place in a layout file where a Fragment is to be inserted.

2. How do you enable your project to use navigation components?

radio_button_unchecked Make sure every Activity class extends the class NavigationActivity .
radio_button_unchecked Use the NavigationController class as the launch activity.
radio_button_unchecked Add uses-navigation to the AndroidManifest.xml file.
radio_button_unchecked Add dependencies for navigation-fragment-ktx and navigation-ui-ktx in the
build.gradle (module) file.

3. Where are the possible navigation routes through your app defined?

https://developer.android.com/courses/quizzes/android-development-with-kotlin-6/android-development-with-kotlin-6?continue=https%3A%2F%2Fdev… 1/4
12/4/23, 4:54 PM Lesson 6: App navigation | Android Developers

radio_button_unchecked In a file (often called navigation.xml ) in the res > layout folder.
radio_button_unchecked In a file (often called navigation.xml ) in the app > navigation folder.
radio_button_unchecked In a file (often called navigation.xml ) in the res > navigation folder.
radio_button_unchecked In the AndroidManifest.xml file, under the element.

4. Which of the following statements about the NavHostFragment are true?


Choose as many answers as you see fit.

check_box_outline_blank As the user moves between destinations defined in the navigation graph, the
NavHostFragment swaps the fragments in and out as necessary.

check_box_outline_blank You can click the NavHostFragment in the project view to open the navigation graph.
check_box_outline_blank You add the NavHostFragment to the main layout by adding a fragment whose name is
androidx.navigation.fragment.NavHostFragment .

check_box_outline_blank You must create a single NavHostFragment subclass and implement the onNavigate()
method to handle different kinds of navigation (such as button clicks)

5. Where do you set the ID of a fragment to be used in navigation?

radio_button_unchecked In the fragment layout file, either by setting the ID attribute in the design editor or in the layout
XML file in the res > layout folder.

radio_button_unchecked In the project navigation file, either by setting the ID attribute in the navigation graph or in the
navigation.xml file in the res > navigation folder.

radio_button_unchecked You need to set the ID in both the navigation file for the app and the layout file for the
fragment.

radio_button_unchecked Set the ID variable in the relevant Fragment class.

6. Where do you define the items for a menu?

https://developer.android.com/courses/quizzes/android-development-with-kotlin-6/android-development-with-kotlin-6?continue=https%3A%2F%2Fdev… 2/4
12/4/23, 4:54 PM Lesson 6: App navigation | Android Developers

radio_button_unchecked It depends on where the menu will be shown. For a navigation drawer menu, add an <item>
tag for each menu item in the menu.xml file in the res > drawer folder. For the options menu,
add an <item> tag for each menu item in the menu.xml file in the res > options folder.

radio_button_unchecked In the layout file for the fragment or activity that displays the menu, add a <menu> tag that
contains <item> tags for each item.

radio_button_unchecked In a menu_name.xml file in the res > menu folder, add an <item> tag for each menu item.
Create separate XML files for each separate menu.

radio_button_unchecked In the AndroidManifest.xml file, add a <menus> tag that contains a <menu> tag for each
menu, that in turn contains an <item> tag for each menu item.

7. What do you need to do to enable the overflow menu (also known as the
options menu)? You can assume you have already defined the menu items.
Choose as many answers as you see fit.

check_box_outline_blank Call setHasOptionsMenu(true) in onCreate() for an Activity or onCreateView() for a


Fragment .

check_box_outline_blank Implement onCreateOptionsMenu() in the Activity or Fragment to create the menu.


check_box_outline_blank Set the onClick attribute in the menu.xml file to onShowOptionsMenu , unless you are
implementing a custom onClick listener for the options menu, in which case specify the name
of that custom listener instead.

check_box_outline_blank Implement onOptionsItemSelected() in the Activity or Fragment to determine what


happens when a user selects a menu item in the options menu.

8. What does the Safe Args Gradle plugin do? Select all that apply.
Choose as many answers as you see fit.

check_box_outline_blank Generates simple object and builder classes for type-safe access to arguments specified for
destinations and actions.

check_box_outline_blank Creates Navigation classes that you can edit to simplify the passing of parameters between
fragments.

https://developer.android.com/courses/quizzes/android-development-with-kotlin-6/android-development-with-kotlin-6?continue=https%3A%2F%2Fdev… 3/4
12/4/23, 4:54 PM Lesson 6: App navigation | Android Developers

check_box_outline_blank Generates a method for each action that you have defined in the navigation graph.
check_box_outline_blank Prevents your code from using the wrong key when extracting data from a bundle.

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-6/android-development-with-kotlin-6?continue=https%3A%2F%2Fdev… 4/4
12/4/23, 4:54 PM Lesson 7: Activity and fragment lifecycles | Android Developers

Lesson 7: Activity and fragment lifec


Let's do a quick test! You must answer at least 5 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. Your app contains a physics simulation that requires heavy computation


to display. Then the user gets a phone call. Which of the following is true?

radio_button_unchecked During the phone call, you should continue computing the positions of objects in the physics
simulation.

radio_button_unchecked During the phone call, you should stop computing the positions of objects in the physics
simulation.

2. Which lifecycle method should you override to pause the simulation when
the app is not on the screen?

radio_button_unchecked onDestroy()
radio_button_unchecked onStop()
radio_button_unchecked onPause()
radio_button_unchecked onSaveInstanceState()

3. To make a class lifecycle-aware through the Android lifecycle library,


which interface should the class implement?

radio_button_unchecked Lifecycle

https://developer.android.com/courses/quizzes/android-development-with-kotlin-7/android-development-with-kotlin-7?continue=https%3A%2F%2Fdev… 1/3
12/4/23, 4:54 PM Lesson 7: Activity and fragment lifecycles | Android Developers

radio_button_unchecked LifecycleOwner
radio_button_unchecked Lifecycle.Event
radio_button_unchecked LifecycleObserver

4. Under which circumstances does the onCreate() method in your activity


receive a Bundle with data in it (that is, the Bundle is not null )?

radio_button_unchecked The activity is restarted after the device is rotated.


radio_button_unchecked The activity is started from scratch.
radio_button_unchecked The activity is resumed after returning from the background.
radio_button_unchecked The device is rebooted.

5. Which lifecycle method is called to make an activity visible?

radio_button_unchecked onPause()
radio_button_unchecked onVisible()
radio_button_unchecked onStart()
radio_button_unchecked onDestroy()

6. Which lifecycle method is called to give an activity focus?

radio_button_unchecked onResume()
radio_button_unchecked onVisible()
radio_button_unchecked onStart()
radio_button_unchecked onFocus()

https://developer.android.com/courses/quizzes/android-development-with-kotlin-7/android-development-with-kotlin-7?continue=https%3A%2F%2Fdev… 2/3
12/4/23, 4:55 PM Lesson 8: App architecture (UI layer) | Android Developers

Lesson 8: App architecture (UI layer)

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. To avoid losing data during a device-configuration change, you should


save app data in which class?

radio_button_unchecked ViewModel
radio_button_unchecked LiveData
radio_button_unchecked Fragment
radio_button_unchecked Activity

2. A ViewModel should never contain any references to fragments, activities,


or views. True or false?

radio_button_unchecked True, it should never contain any references.


radio_button_unchecked False, it should contain at least a reference to one of the above.

3. When is a ViewModel destroyed?

radio_button_unchecked When the associated UI controller is destroyed and recreated during a device-orientation
change.

https://developer.android.com/courses/quizzes/android-development-with-kotlin-8/android-development-with-kotlin-8?continue=https%3A%2F%2Fdev… 1/5
12/4/23, 4:55 PM Lesson 8: App architecture (UI layer) | Android Developers

radio_button_unchecked In an orientation change.


radio_button_unchecked When the associated UI controller is finished (if it is an activity) or detached (if it is a
fragment).

radio_button_unchecked When the user presses the Back button.

4. What is the ViewModelFactory interface for?

radio_button_unchecked Instantiating a ViewModel object.


radio_button_unchecked Retaining data during orientation changes.
radio_button_unchecked Refreshing the data being displayed on the screen.
radio_button_unchecked Receiving notifications when the app data is changed.

5. How do you encapsulate the LiveData stored in a ViewModel so that


external objects can read data without being able to update it?

radio_button_unchecked Inside the ViewModel object, change the data type of the data to private LiveData . Use a
backing property to expose read-only data of the type MutableLiveData .

radio_button_unchecked Inside the ViewModel object, change the data type of the data to private MutableLiveData .
Use a backing property to expose read-only data of the type LiveData .

radio_button_unchecked Inside the UI controller, change the data type of the data to private MutableLiveData . Use a
backing property to expose read-only data of the type LiveData .

radio_button_unchecked Inside the ViewModel object, change the data type of the data to LiveData . Use a backing
property to expose read-only data of the type LiveData .

6. LiveData updates a UI controller (such as a fragment) if the UI controller


is in which of the following states?

https://developer.android.com/courses/quizzes/android-development-with-kotlin-8/android-development-with-kotlin-8?continue=https%3A%2F%2Fdev… 2/5
12/4/23, 4:55 PM Lesson 8: App architecture (UI layer) | Android Developers

radio_button_unchecked Resumed
radio_button_unchecked In the background
radio_button_unchecked Paused
radio_button_unchecked Stopped

7. In the LiveData observer pattern, what is the observable item (what is


observed)?

radio_button_unchecked The observer method


radio_button_unchecked The data in a LiveData object
radio_button_unchecked The UI controller
radio_button_unchecked The ViewModel object

8. In which class should you add the data-formatting logic that uses the
Transformations.map() method to convert LiveData to a different value or
format?

radio_button_unchecked ViewModel
radio_button_unchecked Fragment
radio_button_unchecked Activity
radio_button_unchecked MainActivity

9. The Transformations.map() method provides an easy way to perform


data manipulations on the LiveData and returns ___.

radio_button_unchecked A ViewModel object

https://developer.android.com/courses/quizzes/android-development-with-kotlin-8/android-development-with-kotlin-8?continue=https%3A%2F%2Fdev… 3/5
12/4/23, 4:55 PM Lesson 8: App architecture (UI layer) | Android Developers

radio_button_unchecked A LiveData object


radio_button_unchecked A formatted String
radio_button_unchecked A RoomDatabase object

10. What are the parameters for the Transformations.map() method?

radio_button_unchecked A source LiveData and a function to be applied to the LiveData


radio_button_unchecked Only a source LiveData
radio_button_unchecked No parameters
radio_button_unchecked ViewModel and a function to be applied

11. The lambda function passed into the Transformations.map() method is


executed in which thread?

radio_button_unchecked Main thread


radio_button_unchecked Background thread
radio_button_unchecked UI thread
radio_button_unchecked In a coroutine

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-8/android-development-with-kotlin-8?continue=https%3A%2F%2Fdev… 4/5
12/4/23, 4:55 PM Lesson 9: App architecture (persistence) | Android Developers

Lesson 9: App architecture (persiste


Let's do a quick test! You must answer at least 5 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. How do you indicate that a class represents an entity to store in a Room


database?

radio_button_unchecked Make the class extend DatabaseEntity .


radio_button_unchecked Annotate the class with @Entity .
radio_button_unchecked Annotate the class with @Database .
radio_button_unchecked Make the class extend RoomEntity and also annotate the class with @Room .

2. The DAO (data access object) is an interface that Room uses to map
Kotlin functions to database queries. How do you indicate that an interface
represents a DAO for a Room database?

radio_button_unchecked Make the interface extend RoomDAO .


radio_button_unchecked Make the interface extend EntityDao , then implement the DaoConnection() method.
radio_button_unchecked Annotate the interface with @Dao .
radio_button_unchecked Annotate the interface with @RoomConnection .

https://developer.android.com/courses/quizzes/android-development-with-kotlin-9/android-development-with-kotlin-9?continue=https%3A%2F%2Fdev… 1/3
12/4/23, 4:55 PM Lesson 9: App architecture (persistence) | Android Developers

3. Which of the following annotations can you use in your @Dao interface?
Choose all that apply.
Choose as many answers as you see fit.

check_box_outline_blank @Get
check_box_outline_blank @Update
check_box_outline_blank @Insert
check_box_outline_blank @Query

4. Which of the following is not a benefit of using coroutines?

radio_button_unchecked They run asynchronously.


radio_button_unchecked They can be run on a thread other than the main thread.
radio_button_unchecked They always make the app run faster.
radio_button_unchecked They can use exceptions.

5. Which of the following is not true for Suspend functions?

radio_button_unchecked An function annotated with the Suspend keyword.


radio_button_unchecked A function that can be called inside coroutines.
radio_button_unchecked While a Suspend function is running, the calling thread is suspended.
radio_button_unchecked Suspend functions must always run in the background.

6. Which of the following statements is NOT true?

radio_button_unchecked When execution is blocked, no other work can be executed on the blocked thread.

https://developer.android.com/courses/quizzes/android-development-with-kotlin-9/android-development-with-kotlin-9?continue=https%3A%2F%2Fdev… 2/3
12/4/23, 4:55 PM Lesson 9: App architecture (persistence) | Android Developers

radio_button_unchecked When execution is suspended, the thread can do other work while waiting for the offloaded
work to complete.

radio_button_unchecked Suspending is more efficient, because threads may not be waiting, doing nothing.
radio_button_unchecked Whether blocked or suspended, execution is still waiting for the result of the coroutine before
continuing.

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-9/android-development-with-kotlin-9?continue=https%3A%2F%2Fdev… 3/3
12/4/23, 4:55 PM Lesson 10: Advanced RecyclerView use cases | Android Developers

Lesson 10: Advanced RecyclerView


Let's do a quick test! You must answer at least 7 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. How does RecyclerView display items? Select all that apply.


Choose as many answers as you see fit.

check_box_outline_blank Displays items in a list or a grid.


check_box_outline_blank Scrolls vertically or horizontally.
check_box_outline_blank Scrolls diagonally on larger devices such as tablets.
check_box_outline_blank Allows custom layouts when a list or a grid is not enough for the use case.

2. What are the benefits of using RecyclerView ? Select all that apply.
Choose as many answers as you see fit.

check_box_outline_blank Efficiently displays large lists.


check_box_outline_blank Automatically updates the data.
check_box_outline_blank Minimizes the need for refreshes when an item is updated, deleted, or added to the list.
check_box_outline_blank Reuses the view when scrolling to automatically display the next item on screen.

3. What are some of the reasons for using adapters? Select all that apply.
Choose as many answers as you see fit.

check_box_outline_blank Separation of concerns makes it easier to change and test code.

https://developer.android.com/courses/quizzes/android-development-with-kotlin-10/android-development-with-kotlin-10?continue=https%3A%2F%2Fd… 1/4
12/4/23, 4:55 PM Lesson 10: Advanced RecyclerView use cases | Android Developers

check_box_outline_blank RecyclerView is agnostic to the data that is being displayed.


check_box_outline_blank Data processing layers do not have to concern themselves with how data will be displayed.
check_box_outline_blank The app will run faster.

4. Which of the following are true of ViewHolder ? Select all that apply.
Choose as many answers as you see fit.

check_box_outline_blank The ViewHolder layout is defined in XML layout files.


check_box_outline_blank There is one ViewHolder for each unit of data in the dataset.
check_box_outline_blank You can have more than one ViewHolder in a RecyclerView .
check_box_outline_blank The Adapter binds data to the ViewHolder .

5. Which of the following are necessary to use DiffUtil ? Select all that
apply.
Choose as many answers as you see fit.

check_box_outline_blank Extend the ItemCallBack class.


check_box_outline_blank Override areItemsTheSame() .
check_box_outline_blank Override areContentsTheSame() .
check_box_outline_blank Use data binding to track the differences between items.

6. Which of the following are true about binding adapters?


Choose as many answers as you see fit.

check_box_outline_blank A binding Adapter is a function annotated with @BindingAdapter .


check_box_outline_blank Using a binding Adapter allows you to separate data formatting from the view holder.
check_box_outline_blank You must use a RecyclerViewAdapter if you want to use binding adapters.

https://developer.android.com/courses/quizzes/android-development-with-kotlin-10/android-development-with-kotlin-10?continue=https%3A%2F%2Fd… 2/4
12/4/23, 4:55 PM Lesson 10: Advanced RecyclerView use cases | Android Developers

check_box_outline_blank Binding adapters are a good solution when you need to transform complex data.

7. Which of the following are layout managers provided by Android? Select


all that apply.
Choose as many answers as you see fit.

check_box_outline_blank LinearLayoutManager
check_box_outline_blank GridLayoutManager
check_box_outline_blank CircularLayoutManager
check_box_outline_blank StaggeredGridLayoutManager

8. What is a span in GridLayoutManager ?

radio_button_unchecked The size of a grid created by GridLayoutManager .


radio_button_unchecked The width of a column in the grid.
radio_button_unchecked The dimensions of an item in a grid.
radio_button_unchecked The number of columns in a grid that has a vertical orientation.

9. Where do you add the android:onClick attribute to make items in a


RecyclerView respond to clicks? Select all that apply.
Choose as many answers as you see fit.

check_box_outline_blank In the layout file that displays the RecyclerView , add it to


<androidx.recyclerview.widget.RecyclerView>

check_box_outline_blank Add it to the layout file for an item in the row. If you want the entire item to be clickable, add it
to the parent view that contains the items in the row.

check_box_outline_blank Add it to the layout file for an item in the row. If you want a single TextView in the item to be
clickable, add it to the <TextView> .

https://developer.android.com/courses/quizzes/android-development-with-kotlin-10/android-development-with-kotlin-10?continue=https%3A%2F%2Fd… 3/4
12/4/23, 4:55 PM Lesson 10: Advanced RecyclerView use cases | Android Developers

check_box_outline_blank Always add it to the layout file for the MainActivity .

10. Which of the following statements is true about ViewHolder ?

radio_button_unchecked An Adapter can use multiple ViewHolder classes to hold headers and various types of data.
radio_button_unchecked You can have exactly one view holder for data, and one view holder for a header.
radio_button_unchecked A RecyclerView supports multiple types of headers, but the data has to be uniform.
radio_button_unchecked When adding a header, you subclass RecyclerView to insert the header at the correct
position.

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-10/android-development-with-kotlin-10?continue=https%3A%2F%2Fd… 4/4
12/4/23, 4:55 PM Lesson 11: Connect to the internet | Android Developers

Lesson 11: Connect to the internet


Let's do a quick test! You must answer at least 4 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. What are the two key things Retrofit needs to build a web services API?

radio_button_unchecked The base URI for the web service, and a GET query.
radio_button_unchecked The base URI for the web service, and a converter factory.
radio_button_unchecked A network connection to the web service, and an authorization token.
radio_button_unchecked A converter factory, and a parser for the response.

2. What is the purpose of the Moshi library?

radio_button_unchecked To get data back from a web service.


radio_button_unchecked To interact with Retrofit to make a web service request.
radio_button_unchecked To parse a JSON response from a web service into Kotlin data objects.
radio_button_unchecked To rename Kotlin objects to match the keys in the JSON response.

3. Which Glide method do you use to indicate the ImageView that will
contain the loaded image?

radio_button_unchecked into()

https://developer.android.com/courses/quizzes/android-development-with-kotlin-11/android-development-with-kotlin-11?continue=https%3A%2F%2Fd… 1/3
12/4/23, 4:55 PM Lesson 11: Connect to the internet | Android Developers

radio_button_unchecked with()
radio_button_unchecked imageview()
radio_button_unchecked apply()

4. How do you specify a placeholder image to show when Glide is loading?

radio_button_unchecked Use the into() method with a drawable.


radio_button_unchecked Use RequestOptions() and call the placeholder() method with a drawable.
radio_button_unchecked Assign the Glide.placeholder property to a drawable.
radio_button_unchecked Use RequestOptions() and call the loadingImage() method with a drawable.

5. How do you add a query option to a REST web service call in Retrofit?

radio_button_unchecked Append the query to the end of the request URL.


radio_button_unchecked Add a parameter for the query to the function that makes the request, and annotate that
parameter with @Query .

radio_button_unchecked Use the Query class to build a request.


radio_button_unchecked Use the addQuery() method in the Retrofit builder.

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-11/android-development-with-kotlin-11?continue=https%3A%2F%2Fd… 2/3
12/4/23, 4:56 PM Lesson 12: Repository pattern and WorkManager | Android Developers

Lesson 12: Repository pattern and W


Let's do a quick test! You must answer at least 5 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. Which component in the Android Architecture Components is responsible


for keeping the offline cache up-to-date and getting data from the network?

radio_button_unchecked ViewModel
radio_button_unchecked LiveData
radio_button_unchecked Repository
radio_button_unchecked Activities

2. What is the best way to save structured data on the device file system for
offline caching?

radio_button_unchecked Room
radio_button_unchecked Files
radio_button_unchecked Shared preferences
radio_button_unchecked Retrofit caching

3. The Transformations.map converts one LiveData into another ___.

https://developer.android.com/courses/quizzes/android-development-with-kotlin-12/android-development-with-kotlin-12?continue=https%3A%2F%2Fd… 1/3
12/4/23, 4:56 PM Lesson 12: Repository pattern and WorkManager | Android Developers

radio_button_unchecked ViewModel
radio_button_unchecked LiveData
radio_button_unchecked Repository
radio_button_unchecked DAO object

4. When implementing offline caching, which one of the following strategies


is a good example of the concept of separation of concerns?

radio_button_unchecked Create separate classes to represent the network, domain, and database objects.
radio_button_unchecked Create a single class to represent the network, domain, and database objects.
radio_button_unchecked Create a single class to represent the network and domain objects, and another class to
represent the database object.

radio_button_unchecked Create a single class to represent the network object and another class to represent the
database and domain objects.

5. What are the concrete implementations of the WorkRequest class?

radio_button_unchecked OneTimeWorkPeriodicRequest
radio_button_unchecked OneTimeWorkRequest and PeriodicWorkRequest
radio_button_unchecked OneTimeWorkRequest and RecurringWorkRequest
radio_button_unchecked OneTimeOffWorkRequest and RecurringWorkRequest

6. Which API do you use to add constraints to a WorkRequest ?

radio_button_unchecked setConstraints()
radio_button_unchecked addConstraints()

https://developer.android.com/courses/quizzes/android-development-with-kotlin-12/android-development-with-kotlin-12?continue=https%3A%2F%2Fd… 2/3
12/4/23, 4:56 PM Lesson 12: Repository pattern and WorkManager | Android Developers

radio_button_unchecked setConstraint()
radio_button_unchecked addConstraintsToWorkRequest()

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-12/android-development-with-kotlin-12?continue=https%3A%2F%2Fd… 3/3
12/4/23, 4:56 PM Lesson 13: App UI design | Android Developers

Lesson 13: App UI design


Let's do a quick test! You must answer at least 7 questions correctly to pass this quiz.

Return to pathway (https://developer.android.com/courses/pathways/android-development-w

1. Which tag is used to define themes?

radio_button_unchecked <style>
radio_button_unchecked <theme>
radio_button_unchecked <meta-tag>
radio_button_unchecked <styling>

2. Which of the following is NOT a good use of styles?

radio_button_unchecked Unify the font size across views.


radio_button_unchecked Specify the background color of headings.
radio_button_unchecked Specify the text color for a group of views.
radio_button_unchecked Specify the constraints of a view.

3. What is the difference between themes and styles?

radio_button_unchecked Themes cannot inherit from other themes, but styles can inherit from other styles.
radio_button_unchecked Themes apply to the entire app, while you can apply styles to specific views.

https://developer.android.com/courses/quizzes/android-development-with-kotlin-13/android-development-with-kotlin-13?continue=https%3A%2F%2Fd… 1/4
12/4/23, 4:56 PM Lesson 13: App UI design | Android Developers

radio_button_unchecked Styles cannot inherit from other styles, but themes can inherit from other themes.
radio_button_unchecked Themes are provided by the Android system, while styles are defined by the developer.

4. Which of the following is true about the floating action button (FAB)?

radio_button_unchecked The FAB is usually associated with a primary action the user can take on the screen.
radio_button_unchecked The FAB must be positioned in the bottom-right corner, 16 dp from the edge of the screen.
radio_button_unchecked The FAB uses a special click handler so that you do not have to write your own ViewModel
code.

radio_button_unchecked The FAB is a mandatory element for apps that implement Material Design principles.

5. Which ViewGroup allows you to stack views on top of each other?

radio_button_unchecked StackedViewsLayout
radio_button_unchecked ConstraintLayout
radio_button_unchecked CoordinatorLayout
radio_button_unchecked You cannot stack views

6. Which of the following is NOT a good use of styles?


Choose as many answers as you see fit.

check_box_outline_blank They are designed to be beautiful, functional, and work together.


check_box_outline_blank They help you make your app accessible for vision impaired users.
check_box_outline_blank They help you create an app that uses consistent styling.
check_box_outline_blank Android Studio will give you a warning if you are using a poor color scheme.

https://developer.android.com/courses/quizzes/android-development-with-kotlin-13/android-development-with-kotlin-13?continue=https%3A%2F%2Fd… 2/4
12/4/23, 4:56 PM Lesson 13: App UI design | Android Developers

7. What is a theme overlay for? Select all that are true.


Choose as many answers as you see fit.

check_box_outline_blank Allows you to apply attributes from a different theme to a view and all its children.
check_box_outline_blank With a theme overlay, all the styles of that theme are applied automatically.
check_box_outline_blank You create a theme overlay by defining styles in XML.
check_box_outline_blank When you apply a theme to a view, you can use that theme attribute for the view and all its
children.

8. Which of the following are reasons for defining and using dimensions?
Select all that apply.
Choose as many answers as you see fit.

check_box_outline_blank Makes it easier to apply the same measurements across the app.
check_box_outline_blank Allows you to give meaningful semantic names to measurements.
check_box_outline_blank Makes it easier to change measurements across your app.
check_box_outline_blank Dimensions are required for using Material Design.

9. Which of the following is mandatory for supporting RTL languages?

radio_button_unchecked Replace Left and Right in properties with Start and End
radio_button_unchecked Switch to an RTL language
radio_button_unchecked Make sure all icons use android:autoMirrored="true"
radio_button_unchecked Provide content descriptions

Submit answers

https://developer.android.com/courses/quizzes/android-development-with-kotlin-13/android-development-with-kotlin-13?continue=https%3A%2F%2Fd… 3/4

You might also like