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.Suppose thread two receives values 1, 2, 3, 4, 5, 6, 7, 8 respectively on its calls.Should we expect the same values for each program run?
A) Yes, because the sleep times are equal in between calls.
B) Yes, because that's the same order used by thread one to set the values.
C) No, because thread one may not set the data as 1,2,3,4,5,6,7,8 respectively.
D) No, because a race condition may result in a
Correct Answer:

Verified
Correct Answer:
Verified
Q59: Suppose thread one is downloading a 800KB
Q60: What is the condition called where the
Q61: Which method(s) are part of the Thread
Q62: Each thread runs for a short amount
Q63: Under what conditions are locks unnecessary for
Q65: Suppose that the class XYZ implements the
Q66: The _ occurs when a thread that
Q67: What is the relationship between synchronized code
Q68: In the initial release of the Java
Q69: The _ method is called by a