B. After the lock on B is released, or after two seconds.
Wrong, but debateable. You can release the lock, and not send the notification, and the thread will not wake up. However, you can argue that two seconds later it will wake up, which technically is still *after* the lock is released.
C. Two seconds after object B is notified.
Clearly wrong. If you sleep for 2 seconds, then send the notification, the thread will wakeup immediately (assuming that it can get the lock).
D. Two seconds after lock B is released.
Clearly wrong. If you sleep for 2 seconds, then release the lock, the thread will wakeup immediately -- and not two seconds after. (assuming that it can get the lock).
A. After object B is notified, or after two seconds.
Mostly right. It will wakeup sometime *after* getting the notification. Or it will wakeup sometime *after* 2 seconds. The time to acquire the lock doesn't change that -- it will still be after. Of course, you can argue that the *after* implies *immediately after*...
Which one is the correct?
Now, you have 2 answers that are clearly wrong. One that is wrong, but you can argue that it is right, because one part covers the other. And one that is right, but you can argue that it is wrong, because you imply that the
word after assumes immediately.
Given this in a
test, which one will you pick?
Henry