Coroutines started in viewModelScope are cancelled when:

  1. The user scrolls
  2. The screen rotates
  3. The phone sleeps
  4. The ViewModel is cleared
Answer

D) The ViewModel is cleared

viewModelScope survives rotation and is cancelled in onCleared.

Computer Science MCQ · More Threading and Publishing Android Applications MCQs · Practise