WorkManager Questions with Answers

10 practice questions on WorkManager (Android (Kotlin & Compose)) with answers and step-by-step solutions. Try 10 samples below, then practise all 10 free in the AptiNest app.

Sample questions

Question 1Easy

WorkManager is intended for:

  1. Drawing composables
  2. Reliable deferrable work
  3. Real-time game loops
  4. 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

  1. WorkManager schedules background work that must eventually run.
  2. It stores the work in its own database, so it survives app exits and reboots.
  3. 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:

  1. BroadcastReceiver
  2. AsyncTask
  3. CoroutineWorker
  4. IntentService

Answer: C. CoroutineWorker

Explanation

Override suspend fun doWork(): Result.

Step-by-step solution

  1. WorkManager workers extend Worker, CoroutineWorker or RxWorker.
  2. CoroutineWorker has a suspend doWork().
  3. 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:

  1. AlarmClock
  2. OneTimeWorkRequest
  3. JobIntent
  4. PeriodicWorkRequest

Answer: B. OneTimeWorkRequest

Explanation

PeriodicWorkRequest is for repeating work.

Step-by-step solution

  1. WorkManager has two request types.
  2. OneTimeWorkRequest runs the work once.
  3. 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?

  1. Daily database clean-up
  2. Instant on-screen work
  3. Uploading photos when on Wi-Fi
  4. 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

  1. WorkManager is for deferrable, guaranteed work.
  2. It may delay work until constraints are met.
  3. 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)?

  1. enqueue(compress, upload) to run them in parallel
  2. Use two PeriodicWorkRequests
  3. beginWith(compress).then(upload).enqueue()
  4. 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

  1. WorkManager supports chains of work.
  2. WorkManager.getInstance(ctx).beginWith(compress).then(upload).enqueue().
  3. 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?

  1. setRequiresStorageNotLow(true)
  2. setRequiresDeviceIdle(true)
  3. setRequiredNetworkType()
  4. setRequiresCharging(true)

Answer: C. setRequiredNetworkType()

Explanation

Constraints are set on a Constraints.Builder attached to the request.

Step-by-step solution

  1. Constraints are built with Constraints.Builder.
  2. setRequiredNetworkType(NetworkType.CONNECTED) makes the work wait for a network.
  3. 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?

  1. Yes
  2. No, all work is lost
  3. Only periodic work
  4. 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

  1. WorkManager stores enqueued work in an internal database.
  2. After a reboot, it reschedules the stored work.
  3. 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:

  1. Retry with backoff
  2. The work failed permanently
  3. The work succeeded
  4. The app crashes

Answer: A. Retry with backoff

Explanation

retry() reschedules according to the backoff criteria.

Step-by-step solution

  1. doWork() returns one of Result.success(), Result.failure() or Result.retry().
  2. retry() tells WorkManager the failure is temporary.
  3. 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?

  1. 15 minutes
  2. 1 hour
  3. 1 minute
  4. 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

  1. PeriodicWorkRequest has a minimum interval enforced by the system.
  2. That minimum is 15 minutes (PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS).
  3. 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?

  1. enqueue() each time
  2. runBlocking in onCreate
  3. A Thread with sleep()
  4. 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

  1. Plain enqueue() adds a new request every time, creating duplicates.
  2. enqueueUniqueWork(name, ExistingWorkPolicy.KEEP, request) uses a unique name.
  3. 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 →

Related topics

See all Android (Kotlin & Compose) topics · All topics