Loading

Quipoin Menu

Learn • Practice • Grow

spring / Scheduling in Spring
mcq
Direction: Choose the correct option

Q1.

What is scheduling in Spring?
A. A way to execute tasks periodically at fixed times
B. A way to run tasks asynchronously
C. Both A and B
D. None
Direction: Choose the correct option

Q2.

Which annotation enables scheduling in Spring?
A. @EnableScheduling
B. @Scheduled
C. @EnableAsync
D. @Schedule
Direction: Choose the correct option

Q3.

Which annotation marks a method to be scheduled?
A. @Scheduled
B. @Async
C. @Schedule
D. @Cron
Direction: Choose the correct option

Q4.

What does fixedDelay in @Scheduled do?
A. Executes with a fixed period between the end of last invocation and start of next
B. Executes at a fixed rate
C. Executes at a specific time
D. None
Direction: Choose the correct option

Q5.

What does fixedRate do?
A. Executes at a fixed interval regardless of previous execution duration
B. Executes at fixed delay
C. Executes at cron time
D. None
Direction: Choose the correct option

Q6.

What is a cron expression in @Scheduled?
A. A string representing schedule like '0 * * * * MON-FRI'
B. A fixed rate
C. A fixed delay
D. None
Direction: Choose the correct option

Q7.

What does initialDelay do?
A. Delays the first execution by the specified milliseconds
B. Sets initial delay for fixedRate
C. Sets initial delay for fixedDelay
D. All of the above
Direction: Choose the correct option

Q8.

How do you configure a thread pool for scheduled tasks?
A. Implement SchedulingConfigurer to customize TaskScheduler
B. Use @Async with pool
C. Use @EnableScheduling with pool
D. None
Direction: Choose the correct option

Q9.

What is the zone attribute in @Scheduled for?
A. To specify time zone for cron expression
B. To set timezone for fixedRate
C. To set timezone for fixedDelay
D. None
Direction: Choose the correct option

Q10.

What is the difference between @Scheduled and @Async?
A. @Scheduled is for periodic tasks; @Async for asynchronous execution
B. They are same
C. @Async is for scheduling
D. None