- For a programmer, what is the hardest part in dealing with concurrency?
● specifying physical concurrency
● specifying logical concurrency
● synchronization
● specifying tasks - Which of the following is considered a checked exception?
● java.io.FileNotFoundException since it is a RuntimeException
● java.lang.NullPointerException since it is not a RuntimeException
● java.io.FileNotFoundException since it is not a RuntimeException
● java.lang.NullPointerException since it is a RuntimeException - An event is handled very much like an exception, except:
● the event handlers use information from the event to handle the event
● there is no catch-like statement
● the code that handles events uses the event to identify which handler to use
● the handlers to the event are listed near code that will trigger the event - In which state of a task does deadlock occur?
● running
● dead
● blocked
● new - Which of the following is NOT a way a task can communicate with other tasks?
shared nonlocal variables
parameters
shared local variables
message passing - Which of the following is NOT a design consideration for exception handling?
● finalization provided?
● predefined exceptions?
● Encapsulation?
● continuation or resumption? - Which of the following means is NOT one of the ways that C# threads can be synchronized:
● Interlocked class
● lock statement
● System.Threading.Monitor class
● synchronized statement - Which of the following is NOT one of the ways tasks are different than subprograms?
● tasks must share space with each other while subprograms do not
● when a program invokes a task, it does not need to wait for the task to complete before doing other work.
● task may be implicitly started whereas a subprogram must be explicitly called
● when a task is completed, control may or may not return to the unit that started the execution - In Java, if an object has multiple synchronized methods
● in order to execute any method, we must acquire the lock on the class, so no other methods of that class can proceed while the synchronized method is executing.
● in order to execute any synchronized method, we must acquire the lock on the class, so no other synchronized methods of that class can proceed while the synchronized method is executing.
● in order to execute any synchronized method, we must acquire the lock on the object, so no other synchronized methods on the object can proceed while the synchronized method is executing.
● in order to execute any method, we must acquire the lock on the object, so no other methods on the object can proceed while the synchronized method is executing. - A method that calls another method that lists the possibility of throwing a checked exception has three alternatives for dealing with it. Which of the following is NOT one of the three?
● declare the exception in its own throws clause
● ignore the exception
● it can catch and deal with the exception
● it can catch the exception and throw an exception listed in its own throws clause
Short Answer (Be as thorough as possible): - What are the two primary design issues for language support for concurrency? In your answer, make sure to explain why each is important as well as what it is.
Sample Solution