0
0
Android Kotlinmobile~5 mins

MVVM pattern in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does MVVM stand for in Android development?
MVVM stands for Model-View-ViewModel. It is a design pattern that helps separate the user interface (View) from the business logic (Model) using a ViewModel as a bridge.
Click to reveal answer
beginner
What is the role of the ViewModel in MVVM?
The ViewModel holds and manages UI-related data. It communicates with the Model to get data and prepares it for the View. It survives configuration changes like screen rotations.
Click to reveal answer
intermediate
How does the View observe data changes in MVVM?
The View observes LiveData or StateFlow objects exposed by the ViewModel. When data changes, the View automatically updates without manual intervention.
Click to reveal answer
intermediate
Why is MVVM better than putting all code in the Activity or Fragment?
MVVM separates concerns, making code easier to read, test, and maintain. It prevents Activities or Fragments from becoming too large and handles lifecycle changes better.
Click to reveal answer
intermediate
In MVVM, where should network or database operations be performed?
Network or database operations should be done in the Model or Repository layer. The ViewModel requests data from the Model and exposes it to the View.
Click to reveal answer
In MVVM, which component directly updates the UI?
AViewModel
BModel
CView
DRepository
Which Android class is commonly used in ViewModel to hold observable data?
AService
BIntent
CBundle
DLiveData
What is a key benefit of using ViewModel in MVVM?
AIt survives configuration changes
BIt handles UI rendering
CIt stores user preferences
DIt manages network connections
Where should business logic be placed in MVVM?
AModel
BViewModel
CActivity
DView
Which of these is NOT a responsibility of the ViewModel?
AFetching data from Model
BHandling user input events directly
CExposing data to View
DSurviving configuration changes
Explain the roles of Model, View, and ViewModel in the MVVM pattern.
Think about who does what in the app: data, UI, and the middleman.
You got /3 concepts.
    Describe how MVVM helps manage screen rotations in Android apps.
    Consider what happens when the screen turns and the Activity restarts.
    You got /3 concepts.