Examlex

Solved

Assume Three Threads Share a BankAccount Object with a Balance

question 2

Multiple Choice

Assume three threads share a BankAccount object with a balance initially zero (0) , a ReentrantLock named myLock, and a condition object on myLock named insufficientFunds, as shown below.Thread one calls withdraw(30) , then thread two calls withdraw(20) and thread three calls deposit(45) .What is the balance after the three calls and after the waiting threads have had a chance to run? Assume three threads share a BankAccount object with a balance initially zero (0) , a ReentrantLock named myLock, and a condition object on myLock named insufficientFunds, as shown below.Thread one calls withdraw(30) , then thread two calls withdraw(20)  and thread three calls deposit(45) .What is the balance after the three calls and after the waiting threads have had a chance to run?    A) 0 B) 15 or 25 C) 45 D) -5


Definitions:

Net Losses

The amount by which expenses exceed revenues, indicating that the business spent more than it earned in a specific period.

Partnership

A formally recognized business venture in which a group of individuals share in the leadership and the financial benefits.

Business Organization

A structured entity set up by individuals or shareholders to engage in business activities, usually for profit.

Death Of A Partner

An event in a partnership business that triggers the need to re-evaluate and possibly restructure the business agreement due to the passing away of one of the partners.

Related Questions