Examlex

Solved

Assume Two Threads Share a BankAccount Object with Balance of Zero

question 61

Multiple Choice

Assume two threads share a BankAccount object with balance of zero (0) , and that the BankAccount class provides deposit and withdraw methods and has a ReentrantLock named myLock, as shown below. Note that only the deposit method uses the lock. Thread one deposits $10 ten times and, concurrently, thread two withdraws $10 ten times. Which statement regarding the balance after all thread calls is definitely true? public void deposit(int dollars)
{
MyLock.lock()
Int newBalance = balance + dollars;
System.out.println("depositing") ;
Balance = newBalance;
MyLock.unlock()
}
Public void withdraw(int dollars)
{
Int newBalance = balance - dollars;
System.out.println("withdrawing") ;
Balance = newBalance;
}


Definitions:

Higher-income People

Individuals or households that earn a significantly above-average level of income compared to the general population.

Chapter 7 Bankruptcy

involves the liquidation of a debtor's non-exempt assets by a trustee to pay creditors, part of the U.S. Bankruptcy Code.

Chapter 13

refers to a part of the U.S. Bankruptcy Code that enables individuals with a regular income to develop a plan to repay all or part of their debts.

Chapter 7

A provision of the bankruptcy code that provides for "liquidation," whereby a debtor's assets are distributed to creditors.

Related Questions