Services
Discover
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Early Objects
Exam 22: Multithreading
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 61
Multiple Choice
Which method(s) are part of the Thread class? i.public void run(Runnable runnable) II.public void start(Runnable runnable) III.public void start()
Question 62
Multiple Choice
Each thread runs for a short amount of time, called a ____________________.
Question 63
Multiple Choice
Under what conditions are locks unnecessary for multi-threaded programs?
Question 64
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?
Question 65
Multiple Choice
Suppose that the class XYZ implements the interface Runnable.Which code creates a thread object and makes it available to the scheduler to be executed?
Question 66
Multiple Choice
The ____________ occurs when a thread that is not running is interrupted.
Question 67
Multiple Choice
What is the relationship between synchronized code and code that is locked using a ReentrantLock object?
Question 68
Multiple Choice
In the initial release of the Java library, the Thread class had a stop method to terminate a thread.However, that method is now _______________
Question 69
Multiple Choice
The ________ method is called by a thread that has just changed the state of some shared data in a way that may benefit waiting threads.
Question 70
Multiple Choice
The ___________ method does not actually cause threads to terminate; it merely sets a Boolean field in the thread data structure.
Question 71
Multiple Choice
Consider an old fashioned telephone booth that can be occupied by one person at a time.Suppose one person went in and dialed a part of her number, and had to leave the booth.A second person went in and dialed a part of his number, and before the number was fully dialed, a connection to some other phone was made.What Java threads analogy would prevent this undesirable scenario? i.Acquire the lock prior to entering the booth II.Dial a complete number when inside the booth III.Hang up the phone and release the lock upon exiting the booth
Question 72
Multiple Choice
Which of the following is a characteristic of threads?
Question 73
Multiple Choice
Which of the following statements is correct?
Question 74
Multiple Choice
A GUI should be responsive to the user.If a GUI interaction starts a time-consuming task, the GUI may not be responsive to the user until the task completes.Which approach would make the GUI responsive under these circumstances?
Question 75
Multiple Choice
Assume three threads share a BankAccount object with a balance initially zero (0) , a ReentrantLock named myLock, and a condition object on myLock named insufficientFunds, as shown below.Thread one calls withdraw(30) , then thread two calls withdraw(20) and thread three calls deposit(45) .What is the balance after the three calls?
Question 76
Multiple Choice
Which of the following class declarations could run in a thread? i.public interface MyRunnable extends Runnable { ...} II.public class MyRunnable extends Runnable { ...} III.public class MyRunnable implements Runnable { ...}