100% Correct Answers
What would happen if a "release" call is made when the semaphore count is at its max
value? - Answer-An exception will occur.
In a multithreading implementation of the Collatz conjecture, the efficiency exceeds
100%. The reason is the use of - Answer-different array sizes in different
implementations.
When designing a computer system, if you focus on improving one part of the system
without you modifying the other part, the best performance law you can use is: -
Answer-Amdahl's Law
What technique can be used to make sure that parallel withdrawals from ATMs cannot
exceed the given limit of a bank account? - Answer-Implement a lock mechanism to
prevent simultaneous access to the account object.
What is the proper way of creating a thread class if the class has already inherited
members from another class? - Answer-Implement the Runnable Interface
Which method is the starting point in a user-defined Java thread class? - Answer-run
Compare and contrast wait( ) and sleep(t) methods defined in the library class Thread. -
Answer-A thread in the wait state cannot return to the ready state unless another thread
issues a notification.
What is the best definition of the speedup of an N-core processor over a 1-core
processor? - Answer-ExecutionTime of 1-core / ExecutionTime of N-core
In what situations can a deadlock occur? Select all that apply
- There are two shared resources.
- There are more than two shared resources.
- There is no shared resource.
- There is one shared resource. - Answer-- There are two shared resources
Ethernet's binary exponential backoff mechanism is a technique used for avoiding -
Answer-livelock
, A thread - Answer-exists when the corresponding code is running
Compare and contrast livelock and deadlock. What statement is correct? - Answer-In
the case of deadlock, the resources are held. In the case of livelock, the resources are
still free.
How is the synchronization mechanism implemented in a Java environment? - Answer-
A lock-bit in an object is set to "true" when a synchronized method accesses the object.
If a method is prefixed with the keyword "synchronized", then - Answer-all objects
accessed by the method will be locked during the execution of the method.
Can Monitor.Enter(v) lock the variable v if v is of integer type? - Answer-No,
Monitor.Enter(v) cannot directly lock the variables of value-type.
Which method is the starting point in a user-defined C# thread class? - Answer-a user-
named method
The C# monitor class's methods Monitor.Enter and Monitor.Exit can be used for -
Answer-synchronizing a set of statements, similar to the synchronized statements in
Java.
The lock(...) method in C# does not need to use try-finally exception handling, because -
Answer-exception handling is implied
A C# delegate (Select all that apply)
- allows a method name to be passed as a parameter.
- defines a semaphore for multiple threads.
- creates proxy to be associated with a remote service.
- allows the same method call to be associated with different method codes. - Answer--
allows a method name to be passed as a parameter
- allows the same method call to be associated with different method codes.
Coordination events in C# are used for - Answer-defining the order of execution among
the threads.
What would happen if a "WaitOne" request is called when the semaphore value is zero?
- Answer-The calling thread will be blocked
What is the efficiency of a multi-core computer? - Answer-Speedup / NumberOfCores
Which law should you use in evaluating the system performance improvement if you
have doubled the processor speed, and improved the other parts accordingly? -
Answer-Gustafson's Law