Scheduling with @Scheduled — Concept Check
Questions on Scheduling with @Scheduled. @Scheduled triggers a method on a fixed rate, fixed delay, or cron expression; @EnableScheduling must be present and methods must return void.
Questions in this quiz
8 questions on Scheduling with @Scheduled — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer notices that their scheduled task is overlapping with itself, causing data inconsistencies. Which scheduling mode is likely being used?
- Acron
- BfixedDelay
- CinitialDelay
- DfixedRate
2.A task needs to run every 10 minutes, but only after the previous execution completes. Which scheduling mode should be used?
- AfixedDelay
- Bcron
- CfixedRate
- DinitialDelay
3.A scheduled task should run every day at 3 AM. Which cron expression should be used?
- A0 3 0 * * *
- B0 0 3 * * *
- C0 0 0 3 * *
- D0 3 * * * *
4.A developer wants to prevent a scheduled task from running on multiple pods simultaneously in a Kubernetes cluster. What should they use?
- AShedLock
- B@Async
- CfixedRate
- DinitialDelay
5.After deploying a new version of an application, a scheduled task is executing twice on different pods. What is likely missing?
- AfixedDelay setting
- BShedLock configuration
- C@EnableScheduling
- DinitialDelay setting
6.A task scheduled with fixedRate is causing a backlog of tasks. What could be a solution?
- AIncrease TaskScheduler pool size
- BUse initialDelay
- CSwitch to cron
- DRemove @Scheduled
7.What is the default behavior of scheduled tasks in Spring if not configured otherwise?
- ASingle-threaded execution
- BImmediate execution
- CConcurrent execution
- DDistributed locking
8.A task should run every 15 seconds, but only after the application has fully started. What should be configured?
- AfixedRate
- Bcron
- CinitialDelay
- DfixedDelay