Sample questions
Question 1Easy
WorkManager is intended for:
- Drawing composables
- Reliable deferrable work
- Real-time game loops
- Animations on the UI thread
Answer: B. Reliable deferrable work
Explanation
Work persists across app exits and device restarts, e.g. uploading logs or syncing data.
Step-by-step solution
- WorkManager schedules background work that must eventually run.
- It stores the work in its own database, so it survives app exits and reboots.
- So it is meant for reliable, deferrable work like syncs and uploads.
Why the other options are wrong
- A. Drawing composables is UI work done by Compose on the main thread.
- C. Game loops need exact, immediate timing; WorkManager may delay work.
- D. UI animations run on the main thread with animation APIs, not background jobs.
Tip: Must run eventually, even after the app closes = WorkManager.
Question 2Easy
The class you extend to write background work with coroutines in WorkManager is:
- BroadcastReceiver
- AsyncTask
- CoroutineWorker
- IntentService
Answer: C. CoroutineWorker
Explanation
Override suspend fun doWork(): Result.
Step-by-step solution
WorkManager workers extend Worker, CoroutineWorker or RxWorker.CoroutineWorker has a suspend doWork().- It runs on
Dispatchers.Default by default.
Why the other options are wrong
- A. BroadcastReceiver receives system broadcasts.
- B. AsyncTask is deprecated and not part of WorkManager.
- D. IntentService is deprecated and not part of WorkManager.
Tip: Kotlin + WorkManager = CoroutineWorker.
Question 3Easy
Work that should run once is described with a:
- AlarmClock
- OneTimeWorkRequest
- JobIntent
- PeriodicWorkRequest
Answer: B. OneTimeWorkRequest
Explanation
PeriodicWorkRequest is for repeating work.
Step-by-step solution
- WorkManager has two request types.
- OneTimeWorkRequest runs the work once.
- PeriodicWorkRequest repeats it.
Why the other options are wrong
- A. AlarmClock is not a WorkManager request type.
- C. JobIntent belongs to the deprecated JobIntentService.
- D. PeriodicWorkRequest repeats on an interval.
Tip: Once = OneTimeWorkRequest; repeat = PeriodicWorkRequest.
Question 4Medium
Which is a poor fit for WorkManager?
- Daily database clean-up
- Instant on-screen work
- Uploading photos when on Wi-Fi
- Syncing data after reboot
Answer: B. Instant on-screen work
Explanation
Immediate in-app work belongs in coroutines in a ViewModel scope.
Step-by-step solution
- WorkManager is for deferrable, guaranteed work.
- It may delay work until constraints are met.
- Work the user is waiting to see on screen right now needs immediate execution, e.g. a coroutine in viewModelScope.
Why the other options are wrong
- A. Daily clean-up is a classic periodic deferrable task.
- C. Uploads on Wi-Fi use a network constraint, a perfect fit.
- D. WorkManager reschedules work after reboot, so this fits well.
Tip: User is waiting on screen? Not WorkManager.
Question 5Medium
How are two OneTimeWorkRequests run in sequence (compress, then upload)?
enqueue(compress, upload) to run them in parallel- Use two
PeriodicWorkRequests beginWith(compress).then(upload).enqueue()- Put both in one
Thread
Answer: C. beginWith(compress).then(upload).enqueue()
Explanation
WorkManager chains run the next work only if the previous succeeds.
Step-by-step solution
- WorkManager supports chains of work.
- WorkManager.getInstance(ctx).beginWith(compress).then(upload).enqueue().
- upload runs only after compress succeeds, and can receive its output data.
Why the other options are wrong
- A. Enqueuing both separately lets them run in parallel, so order is not guaranteed.
- B. Periodic requests repeat and cannot be chained.
- D. A plain thread loses WorkManager's persistence and constraints.
Tip: Sequence = beginWith().then().enqueue().
Question 6Medium
Which constraint makes a worker run only when the device has network connectivity?
setRequiresStorageNotLow(true)setRequiresDeviceIdle(true)setRequiredNetworkType()setRequiresCharging(true)
Answer: C. setRequiredNetworkType()
Explanation
Constraints are set on a Constraints.Builder attached to the request.
Step-by-step solution
- Constraints are built with Constraints.Builder.
- setRequiredNetworkType(NetworkType.CONNECTED) makes the work wait for a network.
- The other setters are about storage, idle state and charging.
Why the other options are wrong
- A. This waits for enough free storage, not network.
- B. This waits for the device to be idle, not online.
- D. This waits for the device to be charging.
Tip: Network constraint takes a NetworkType: CONNECTED, UNMETERED, NOT_ROAMING and so on.
Question 7Medium
Does WorkManager work scheduled with constraints still run after the device reboots?
- Yes
- No, all work is lost
- Only periodic work
- Only if the app is open
Answer: A. Yes
Explanation
WorkManager stores work in its own database and reschedules after reboot.
Step-by-step solution
- WorkManager stores enqueued work in an internal database.
- After a reboot, it reschedules the stored work.
- So the work still runs once its constraints are met.
Why the other options are wrong
- B. Work is persisted, so it is not lost.
- C. One-time work also survives reboots.
- D. WorkManager does not need the app to be open.
Tip: Survives app kill and reboot: WorkManager.
Question 8Medium
In a CoroutineWorker, returning Result.retry() from doWork() means:
- Retry with backoff
- The work failed permanently
- The work succeeded
- The app crashes
Answer: A. Retry with backoff
Explanation
retry() reschedules according to the backoff criteria.
Step-by-step solution
- doWork() returns one of Result.success(), Result.failure() or Result.retry().
- retry() tells WorkManager the failure is temporary.
- WorkManager reschedules the work using the backoff policy (exponential by default).
Why the other options are wrong
- B. Permanent failure is Result.failure().
- C. Success is Result.success().
- D. Returning a result never crashes the app.
Tip: success = done, failure = give up, retry = try later with backoff.
Question 9Medium
What is the minimum repeat interval for a PeriodicWorkRequest?
- 15 minutes
- 1 hour
- 1 minute
- 1 second
Answer: A. 15 minutes
Explanation
Shorter intervals are not allowed; use other mechanisms for frequent work while the app is open.
Step-by-step solution
- PeriodicWorkRequest has a minimum interval enforced by the system.
- That minimum is 15 minutes (PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS).
- Shorter values are raised to 15 minutes.
Why the other options are wrong
- B. 1 hour is allowed but is not the minimum.
- C. 1 minute is below the minimum and gets clamped up to 15 minutes.
- D. 1 second is far too frequent; it would drain the battery.
Tip: Periodic WorkManager minimum = 15 minutes.
Question 10Hard
You enqueue a sync worker every time the app opens but want only one pending at a time. What should you use?
enqueue() each timerunBlocking in onCreate- A
Thread with sleep() - Unique work with
KEEP
Answer: D. Unique work with KEEP
Explanation
Unique work with KEEP leaves existing pending work in place instead of adding duplicates.
Step-by-step solution
- Plain enqueue() adds a new request every time, creating duplicates.
- enqueueUniqueWork(name, ExistingWorkPolicy.KEEP, request) uses a unique name.
- With KEEP, if work with that name is already pending, the new request is ignored.
Why the other options are wrong
- A. Each enqueue() call adds another copy of the work.
- B. runBlocking on the main thread freezes the UI and is not deferred work.
- C. A raw thread with sleep() is not persisted and dies with the process.
Tip: Avoid duplicate jobs: enqueueUniqueWork + KEEP.
Practise all 10 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →