Multiple choice technology databases

The callback function of a timer with an interval of 5 seconds, sleeps for a period of 20 seconds. The timer events are dispatched in a single thread .A statement at the start of the callback function prints out a message to the screen. What is the time difference between two consecutive messages output to the screen ?

  1. 5s

  2. 25s

  3. 10s

  4. 20s

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In a single-threaded dispatcher, a timer callback that takes 20 seconds to execute blocks the thread. The next timer event, already due, is dispatched immediately upon completion, so the start of the next callback runs 20 seconds after the first.