Multiple Choice
Consider the following change to the deposit method in Section 20.4:
Public void deposit(double amount)
{
BalanceChangeLock.lock() ;
Try
{
Double newBalance = balance + amount;
Balance = newBalance;
}
Finally
{
BalanceChangeLock.unlock() ;
}
System.out.println("Depositing " + amount + ", new balance is " + balance) ;
}
What is the consequence of this change?
A) The bank account balances may no longer be correctly updated.
B) The printouts may become intermingled.
C) The printouts may no longer display the correct balances.
D) All of the above.
Correct Answer:

Verified
Correct Answer:
Verified
Q6: Which exception must be caught or declared
Q6: Which of the following definitely indicates that
Q24: What course of action should be followed
Q31: Given a single CPU and four threads,
Q34: Stale data occurs in multi-CPU machines when
Q35: a(n. _ object is used to control
Q51: In which method are the tasks that
Q54: _ allow a thread to temporarily release
Q67: The Runnable interface has a single method
Q78: Suppose thread one is downloading a 800KB