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 ten times with values 1...10 respectively, sleeping for a random number of milliseconds between calls. Thread two calls getSharedData eight times, also sleeping for a random number of milliseconds between calls. Which of the following could be the last two values received by thread two? public class SharedData
{
Private int value;
Public void setSharedData(int n)
{
Value = n;
}
Public int getSharedData()
{
Return value;
}
}
A) 8, 10
B) 10, 9
C) 10, 8
D) 8, 7
Correct Answer:

Verified
Correct Answer:
Verified
Q3: The _ method is useful only if
Q32: Examine the SharedData class shown below. Suppose
Q33: Suppose thread one is downloading a 800KB
Q34: Stale data occurs in multi-CPU machines when
Q36: "Livelock" occurs when one thread runs continuously,
Q41: Consider the addFirst method of the LinkedList
Q44: When a thread is interrupted, the most
Q51: In which method are the tasks that
Q70: The _ method does not actually cause
Q79: What is likely to be true when