Bird
0
0

You want to schedule a Spring Boot task to run every Monday at 8:00 AM and every Friday at 8:00 AM using a single cron expression. Which expression achieves this?

hard📝 Application Q8 of 15
Spring Boot - Async Processing
You want to schedule a Spring Boot task to run every Monday at 8:00 AM and every Friday at 8:00 AM using a single cron expression. Which expression achieves this?
A0 0 8 ? * MON,FRI
B0 0 8 ? * MON,0 0 18 ? * FRI
C0 0 8 ? * MON#1,0 0 18 ? * FRI#1
D0 0 8 ? * MON 0 0 18 ? * FRI
Step-by-Step Solution
Solution:
  1. Step 1: Understand cron for multiple days

    A single cron expression can schedule the same time on multiple days using comma-separated day-of-week values like MON,FRI.
  2. Step 2: Analyze options

    0 0 8 ? * MON,FRI "0 0 8 ? * MON,FRI" correctly runs at 8:00 AM every Monday and Friday. Other options have invalid syntax.
  3. Final Answer:

    0 0 8 ? * MON,FRI -> Option A
  4. Quick Check:

    Multiple days can be comma-separated, but times must be same [OK]
Quick Trick: One cron expression = one time, multiple days allowed [OK]
Common Mistakes:
  • Trying to schedule different times in one expression
  • Using commas incorrectly in time fields
  • Assuming cron supports multiple schedules in one

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes