Services
Discover
Homeschooling
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 Binder Early Objects
Quiz 21: Multithreading
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
Multiple Choice
What is likely to be true when thread one is downloading a 1MB file while thread two is downloading another 1MB file?
Question 22
Multiple Choice
What should be done to get the attention of a thread?
Question 23
Multiple Choice
Which of the following definitely indicates that a thread has terminated? I The run method has completed II The method Thread.interrupted returns true III The run method catches an InterruptedException
Question 24
Multiple Choice
The sleep method is terminated with a(n) __________ whenever a sleeping thread is interrupted.
Question 25
Multiple Choice
Which argument(s) present(s) the best case(s) for extending the Thread class rather than using the Runnable interface in conjunction with a thread pool? I Thread sub-classes will all execute independently II Runnable objects will waste more system resources III Thread sub-classes can execute faster on a single CPU than Runnable objects
Question 26
Multiple Choice
What course of action should be followed when a thread has been interrupted?
Question 27
Multiple Choice
Suppose thread one is downloading a 800KB file while another thread is processing the same file on a multi-CPU machine. Suppose further that one time slice allows the first thread to download about 10KB and that the second thread can process 10KB of the file in one time slice. What is the minimum number of CPUs that will allow the job to be completed in roughly half the time of a single-CPU machine?
Question 28
Multiple Choice
Suppose thread one is downloading a 800KB file while another thread is processing the same file on a single CPU machine. Suppose further that one time slice allows the first thread to download about 10KB and that the second thread can process 10KB of the file in one time slice. How many total time slices will it take to process half the file?
Question 29
Multiple Choice
Suppose thread one is downloading a 800KB file while another thread is processing the same file on a single CPU machine. Suppose further that one time slice allows the first thread to download about 10KB and that the second thread can process 10KB of the file in one time slice. How many total time slices will it take to see the first 10KB of the processed file?
Question 30
Multiple Choice
Which argument(s) present(s) the best case(s) for using the Runnable interface rather than extending the Thread class? I Thread sub-classes are harder to write II Runnable objects can be passed into thread pools III Less time is wasted in creating and destroying thread objects
Question 31
Multiple Choice
____ occur(s) if the effect of multiple threads on shared data depends on the order in which the threads are scheduled.
Question 32
Multiple Choice
Insert the statement that would start the following thread. Thread firstThread = new Thread(myRunnable) ; ____________________
Question 33
Multiple Choice
Each thread runs for a short amount of time, called a ____________________.
Question 34
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 35
Multiple Choice
Suppose thread one is downloading a 800KB file while another thread is processing the same file on a single CPU machine. Suppose further that one time slice allows the first thread to download about 10KB and that the second thread can process 10KB of the file in one time slice. Approximately how does the time to complete the entire job compare to having a single thread do the work?
Question 36
Multiple Choice
Suppose thread one is downloading a large file while another thread is processing the same file on a single CPU machine. Suppose further that one time slice allows the first thread to download about 10KB and that the second thread can process 10KB of the file in one time slice. What is the main benefit of using two threads rather than using a single thread to do both parts of the job?
Question 37
Multiple Choice
Which of the following definitely indicates that a thread has been interrupted by another thread? I The run method has completed II The method Thread.interrupted returns true III The run method catches an InterruptedException