Free Computers and Technology Practice Questions - Improve Your Skills
Consider the following classes of schedules: conflict-serializable(a), recoverable(b), and avoids-cascading-aborts (c). For each of the following schedules, state which of the preceding classes it belongs to. If you cannot decide whether a schedule belongs in a certain class based on the listed actions, explain briefly.The actions are listed in the order they are scheduled and prefixed with the transaction name. If a commit or abort is not shown, the schedule is incomplete; assume that abort or commit must follow all the listed actions.For simplicity, you should answer the questions in the following way. For example, you say a schedule is conflict-serializable(a), but not recoverable(b), and cannot decide avoids-cascading-aborts (c),Your answer is: YNU, where Y is Yes, N is No, U is unknown.T1:R(X), T2:R(X), T1:W(X), T2:W(X)T1:W(X), T2:R(Y), T1:R(Y), T2:R(X)T1:R(X), T2:R(Y), T3:W(X), T2:R(X), T1:R(Y)T1:R(X), T1:R(Y), T1:W(X), T2:R(Y), T3:W(Y), T1:W(X), T2:R(Y)T1:R(X), T2:W(X), T1:W(X), T2:Abort, T1:CommitT1:R(X), T2:W(X), T1:W(X), T2:Commit, T1:CommitT1:W(X), T2:R(X), T1:W(X), T2:Abort, T1:CommitT1:W(X), T2:R(X), T1:W(X), T2:Commit, T1:CommitT1:W(X), T2:R(X), T1:W(X), T2:Commit, T1:AbortT2: R(X), T3:W(X), T3:Commit, T1:W(Y), T1:Commit, T2:R(Y), T2:W(Z), T2:CommitT1:R(X), T2:W(X), T2:Commit, T1:W(X), T1:Commit, T3:R(X), T3:CommitT1:R(X), T2:W(X), T1:W(X), T3:R(X), T1:Commit, T2:Commit, T3:Commit
The goal of this challenge is to design a cash register program. You will be given two decimal numbers. The first is the purchase price (PP) of the item. The second is the cash(CH)given by the customer. Your register currently has the following bills/coins within it: 'PENNY': 01, 'NICKEL': .05, 'DIME': .10, 'QUARTER': .25, 'HALF DOLLAR': .50, 'ONE': 1.00, 'TWO': 2.00, 'FIVE': 5.00, 'TEN': 10.00, 'TWENTY': 20.00, 'FIFTY': 50.00, 'ONE HUNDRED':100.00The aim of the program is to calculate the change that has to be returned to the customer. Each input string contains two numbers which are separated by a semicolon. The first is the Purchase price (PP) and the second is the cash(CH) given by the customer. For each line of input return single line string is the change to be returned to the customer. In case theCH, return "ERROR". IfCH==PP, return "ZERO". For all other cases return a comma separated string with the amount that needs to be returned, in terms of the currency values provided. The output should be alphabetically sorted. # # Complete the 'MakeChange' function below. # # The function is expected to return a STRING. # The function accepts STRING purchaseInfo as parameter. # def MakeChange(purchaseInfo): # Write your code here n if
LAB: Circle with a Promise (please help)The given web page displays a growing orange circle when the Show Circle button is clicked. Your goal is to show a text message inside the circle as show below, by creating callbacks for a Promise object.The circle.js file contains a click event handler showCircleClick() for the Show Circle button that calls showCircle() to display the orange circle.The showCircle() function returns a Promise object that may be fulfilled or rejected.The promise is fulfilled in one second if showCircle() is not called a second time before the second elapses.The promise is rejected if showCircle() is called a second time before the second elapses.Modify the showCircleClick() to call showCircle() and handle the fulfilled or rejected callbacks using the returned Promise's then() method.If the promise is fulfilled, the containing the circle is passed to the callback function. The message "Ta da!" should be added to the 's inner HTML.If the promise is rejected, an error message is passed to the callback function. The error message should be displayed using alert().If your modifications are written correctly, you should see the "Ta da!" message appear one second after the Show Circle button is clicked. If you click Show Circle twice quickly, you should see the error message appear in the alert dialog box, as shown below.---------------------------------------------given code---------------------------------------------------window.addEventListener("DOMContentLoaded", function () {document.querySelector("#showCircleBtn").addEventListener("click", showCircleClick);});function showCircleClick() {// TODO: Add modifications hereshowCircle(160, 180, 120);}// Do not modify the code belowlet timerId = null;function showCircle(cx, cy, radius) {// Only allow one div to exist at a timelet div = document.querySelector("div");if (div !== null) {div.parentNode.removeChild(div);}// Create new div and add to DOMdiv = document.createElement("div");div.style.width = 0;div.style.height = 0;div.style.left = cx + "px";div.style.top = cy + "px";div.className = "circle";document.body.append(div);// Set width and height after showCircle() completes so transition kicks insetTimeout(() => {div.style.width = radius * 2 + 'px';div.style.height = radius * 2 + 'px';}, 10);let promise = new Promise(function(resolve, reject) {// Reject if showCircle() is called before timer finishesif (timerId !== null) {clearTimeout(timerId);timerId = null;div.parentNode.removeChild(div);reject("showCircle called too soon");}else {timerId = setTimeout(() => {resolve(div);timerId = null;}, 1000);}});return promise;}