Multiple Choice
Examine the SharedData class shown below. Suppose two threads are created so that each has access to the same SharedData object. Thread one calls setSharedData eight times with values 1...8 respectively, sleeping for 30 milliseconds between calls. Thread two calls getSharedData eight times, also sleeping for 30 milliseconds between calls. Which of the following orders of values is not possible for thread two to receive? public class SharedData
{
Private int value;
Public void setSharedData(int n)
{
Value = n;
}
Public int getSharedData()
{
Return value;
}
}
A) 1,2,3,4,5,6,7,8
B) 1,2,2,4,5,6,7,8
C) 1,2,3,4,5,6,8,8
D) 1,2,3,4,5,6,8,7
Correct Answer:

Verified
Correct Answer:
Verified
Q3: The _ method is useful only if
Q23: a(n. _ uses a small number of
Q41: Consider the addFirst method of the LinkedList
Q42: When a sleeping thread is interrupted, an
Q43: The Runnable interface includes which method(s)?<br>I public
Q44: When a thread is interrupted, the most
Q45: Stale data occurs in multi-CPU machines when
Q47: For threads of equal priority, which is
Q48: Suppose that the class XYZ implements the
Q51: In which method are the tasks that