Define how conflict may be specified in terms of object operation semantics. Give an example of conflicting operations. Give an example of non-conflicting operations that
Define how conflict may be specified in terms of object operation semantics. Give an example of conflicting operations. Give an example of non-conflicting operations that would conflict with read-write semantics. [3 marks] (b) Define the necessary and sufficient condition for two transactions to be serializable. Give an example of a non-serializable pair of transactions. [2 marks] (c) Define the necessary and sufficient condition for a concurrent execution schedule of a number of transactions to be serializable. Give an example of a serialization graph for four transactions that are non-serializable. [2 marks] (d) Discuss how the three general approaches to providing concurrency control for transaction systems are designed to enforce the property you have defined in (c) above.
that simulates a soft drink machine.? The program should use a structure that stores the following data: Drink Name Drink Cost Number of Drinks in Machine This is a new data type that must be defined at the file level. That is, "outside of main()". The program should create an array of five structures. This record struct should be declared "inside of main()". The elements should be initialized with the following data: Drink Name Cost Number in Machine ---------- ---- ----------------- Cola .75 20 Root Beer .70 15 Lemon-Lime .65 10 Grape Soda .55 3 Cream Soda .50 2 Write a Function, displayMenu(), that displays the following menu on the Console screen. *** Drink Machine Menu *** 1) Cola 0.75 2) Root Beer 0.70 3) Lemon-Lime 0.65 4) Grape Soda 0.55 5) Cream Soda 0.50 Write a Function, getChoice(), that asks the user to select a drink from the menu displayed. Verify that a VALID selection was entered. For the case where an INVALID value is entered, construct a loop? where the user must keep entering a value until a VALID value is entered. The function must only return a VALID value to the calling program. VALID Selections are: ( 1 - 5 ). Write a Function, transaction(), to perform the tasks: 1) Accepts user drink selection(from getChoice()) as the value for an argument to the function. 2) First, check to see if the selected drink is sold out, if it is,
then display a message: "Sorry, that selection is sold out." and exit out of this function. 3) Prompt the customer to enter the amount of money for the drink selected. Make sure the customer entered at least enough for the selected drink, and no more than $1.00. (a) When the user enters an amount of money, do not accept negative or zero values or values greater than $1.00. (b) Do not accept amount less than the price for the drink. "There are no FREE DRINKS here". 4) Dispense the drink. Display a message. 5) Calculate any change that is due. If change is due, give it to the customer. Display a Message. 6) Decrease the number of cans of the selected drink currently in the machine. 7) Display the number of cans of this drink remaining in the machine. /********************************************************************* Program Structure should follow this pattern. *********************************************************************/ Define a struct data type for a Drink before main(). Declare array of structs of type Drink and initialize in main(). Create a flag-controlled loop to simulate the Drink Machine.? while( not done ) { call displayMenu() function call getChoice() function call transaction() function } /*********************************************************************** Example console output for a Lemon-Lime selection? *********************************************************************** *** Drink Machine Menu *** 1) Cola 0.75 2) Root Beer 0.70 3) Lemon-Lime 0.65 4) Grape Soda 0.55 5) Cream Soda 0.50 Enter your Selection (1-5): 3
Enter an amount of money: 1 Thump, thump, thump, splat! Enjoy your Lemon-Lime Change calculated: 0.35 Your change, 0.35 has just dropped into the Change Dispenser. There are 9 drinks of that type left. Are you finished? (y/n) : y ***********************************************************************/ ---------------------------------------------------------- DEMONSTRATE following TEST CASES: SHOW the results of your User Console Dialogs. Be sure to IDENTIFY and delineate your Test Cases. ---------------------------------------------------------- 1) Select one(1) Cola 2) Select one(1) Root-Beer 3) Select one(1) Lemon-Lime 4) Select one(1) Grape-Soda 5) Select two(2) Cream-Soda 6) Select Cream-Soda -- Verify "Sold-Out" Response 7) Enter a Negative amount -- Verify "Invalid-Value" Response 8) Enter a Zero(0) amount -- Verify "Invalid-Value" Response 9) Enter an amount > 1.00 -- Verify "Invalid-Value" Response 10) Make Invalid Drink Selection -- Verify "Invalid-Drink" Response 11) When Valid drink is selected -- Verify drinks left in machine. 12) When Valid amount is entered -- Verify correct change was dispensed. 13) Enter an amount less than the drink price -- Verify Message.
Let N(t) show the amount of events in the time stretch [0, t] for a (homogeneous) Poisson pattern of rate , ( > 0). (a) State the significant properties on N(t) that describe a (homogeneous) Poisson cooperation of rate . [4 marks] (b) By segregating the stretch [0, t] into comparable length sub-ranges show that N(t) is a Poisson sporadic variable with mean t. [4 marks] (c) Let X1 mean the hour of the principle event and for n > 1 let Xn demonstrate the sneaked past time between the (n 1)th and the nth events of the Poisson cycle. Choose the flow of X1 and the joint assignment of X1 and X2. [4 marks] (d) Let Sn = Pn i=1 Xi connote the hour of the nth event. Induce the probability thickness limit of the inconsistent variable Sn(t). [4 marks] (e) Give an estimation to make the foremost T time units of a (homogeneous) Poisson pattern of rate . [4 marks] 6 Specification and Verification I (a) Explain the qualification between a variety and an invariant. Immediately portray what they are used for. [4 marks] (b) State and legitimize the affirmation conditions for the outright rightness of WHILE orders. [6 marks] (c) (I) Devise a precondition P that makes the going with specific legitimate. [P] WHILE IN DO SUM := SUM+(2I); I := I+1 [Complete = N(N+1)] [2 marks] (ii) Devise and legitimize remarks for this detail that yield provable affirmation conditions.
Accepting discrete paired limitations and limited areas, make sense of how breadthfirst-search may be utilized to observe an answer and why this is an unwanted approach (d) Give brief depiction of the fundamental backtracking calculation for seeing as a arrangement.
The language structure of equal orders is given by: c ::= X := a | c0; c1 | c0 || c1 | in the event that b, c | while b do c where X reaches over areas, an over number-crunching articulations, and b over boolean articulations. (a) Give functional semantics to resemble orders, expecting to be a functional semantics for number juggling and boolean articulations. [5 marks] (b) This part is worried about a Petri net semantics for equal orders. There are to be two sorts of conditions: information conditions, sets of areas also, whole numbers, which indicate the items in areas, and control conditions, which determine the neighborhood control focuses in equal parts of orders. An equal order is to be addressed by an essential net (where each condition has limit one) in which a subset of control conditions I is to be recognized as its underlying circumstances and another subset T is to be recognized as its terminal circumstances; the underlying circumstances are unequivocally those control conditions which hold toward the beginning of execution of the order; the terminal circumstances are definitively those control conditions which hold if and when the order ends. A diagrammatic record gets the job done for replies to the inquiries underneath. (I) Describe an (boundless) net for X := X + 1. [2 marks] (ii) Describe a development on nets for c0; c1. [Hint: Replace the terminal conditions T0 of c0 and the underlying circumstances I1 of c1 with their item T0 I1.] [4 marks] (iii) Describe a development on nets for c0 || c1. [2 marks] (iv) Describe a development on nets for on the off chance that X > 0, c. [2 marks] (v) Describe a development on nets for while X > 0 do c.
For what reason does the undesired way of behaving above happen?
a. There are insufficient pieces of information from Asia in 2007 to decide the state of the smoothing bend.
b. There was a grammatical mistake in the code.
c. There are insufficient pieces of information from Oceania in 2007 to decide the state of the smoothing bend.
d. Smoothing bends can't be layered on top of scatterplots with ggformula; we should utilize ggplot2.
### 1e. One potential arrangement is to add a smoothing line, which is more straightforward to register than a loess bend.
Add a smoothing line to the information for every mainland.
### 1f. An elective arrangement is to utilize loess smoothing bends, yet to zero in on the mainlands with additional information in 2007.
Separate the information from the year 2007 and from the four mainlands with the most information.
(The coherent administrators 'and' (and) and '!=' (not equivalent to) might be useful.)
Make a scatterplot of lifeExp versus gdpPercap, with smoothing bends for every mainland.
Add a title to your diagram summing up the vital focus point from the chart. Add an inscription expressing the wellspring of the information.
Question:
Which of the accompanying contentions to channel removes the information from the year 2007 and the four landmasses with the most information?
2/The letter An is identical to the whole number 65 and the letter Z is identical to 90. Compose a program that prompts the client for a beginning number and an end number then shows every one of the letters in the gave range in one line. You should match the configuration precisely.
Sort of circle > for Enter values in the reach 65-90 Project to show a number as a letter
3/program that shows the example show in the example executable.
Sort of circle > your number one (you should utilize a couple of settled circles) Hints: 1) Use factors that additions 2) When running the example, use values among 61 and 76 for the quantity of segments, values among 16 and 21 the quantity of columns
3) Start with an inclining line of "- " then recurrent it as important (utilize the % administrator)
4/program that shows a change table of kg to pounds. The program will provoke the client for the end kg and the beginning kg esteem. The table should be in 2kg decrements. You should match the organization precisely.
Kind of circle > do-while 1 kg = 2.205 pound Use kg values in the reach 50-0. The end worth will be less the beginning worth
The standard direct relapse model purposes a speculation
h(x, w, b) = wT x + b
m
X
i=1
(yi h(xi, w, b))2 .
(a) Derive a slope plunge calculation for preparing the direct relapse model
depicted. [5 marks]
(b) In the utilization of interest, you accept that preparing to such an extent that is attractive
the learned boundaries have ||w|| ' 1. Recommend a modifification to E(w, b) that
works with this, and infer the relating angle plunge preparing calculation.
[5 marks]
(c) Describe the parts of an overall heuristic hunt issue. [4 marks]
(d) You are confronted with a heuristic inquiry issue, yet the heuristics you have up until this point
created are less effffective than wanted. Propose two manners by which directed
AI may be utilized to foster a superior heuristic, referencing if
important any comparing impediments of utilizing the methodology. You may
expect that an assortment of issues to be addressed by the heuristic hunt is
accessible. [6 marks]
2CST1.2021.6.3
2
Artifificial Intelligence
A Boolean satisfifiability issue has four factors, x1, x2, x3 and x4. A strict l
can be a variable or its refutation, indicated l. The equation of interest, in conjunctive
ordinary structure (CNF), is
f = (x2 x3) (x2 x3) (x1 x2 x4).
(1)
The point is to fifind tasks to the factors to such an extent that f is valid under the standard principles
for Boolean tasks. This question tends to the utilization of more broad imperative
fulfillment to tackle this issue.
(a) Give an overall depiction of a limitation fulfillment issue (CSP).
[3 marks]
(b) Explain how a Boolean satisfifiability issue in CNF structure and with n factors
can be changed over to a CSP, likewise having n factors and having an appropriate
requirement for every provision. Outline your response utilizing the 4-variable equation f
in (1). [3 marks]
(c) Explain, again utilizing an imperative comparing to a provision from (1), how general
requirements can be changed over to double limitations. Give a diagram outlining
the issue from (1) after it has been changed over to a CSP with just twofold
limitations. [4 marks]
(d) Explain, how forward actually taking a look at works with regards to an overall CSP. Indeed how does
this benefifit a CSP solver? [3 marks]
(e) Using the CSP identical you created for (1), with just paired imperatives,
show how forward checking functions utilizing the grouping of tasks
x1 = F, x2 = F, x4 = T. [5 marks]
(f ) How might you expect the arrangement got while applying forward checking to
be affffected assuming limitations were permitted to engender all the more generally? [2 marks]
3CST1.2021.6.4
3
Intricacy Theory
(a) Defifine the arrangement of Boolean articulations 2CNF and the language 2SAT over them.
[2 marks]
(b) For a Boolean articulation in 2CNF, let G() be the coordinated diagram with vertices
the factors of and their refutation, and with edges (a, b) if, and provided that, there
is a proviso (a b) or (b a) in . Note that an edge (a, b) is in G() if, and
provided that, so is the edge (b, a).
Demonstrate that a Boolean articulation in 2CNF is unsatisfifiable if, and provided that, there
is a variable x in with the end goal that there are ways from x to x and from x to x in
G(). [Hint: Recall that the recommendation (P Q) is proportionately the ramifications
(P Q).] [12 marks]
(c) Argue concerning if 2SAT is in NL, in P, and in NP. Your response may
utilize the way that NL is shut under complementation. [6 marks]
4CST1.2021.6.5
4
Intricacy Theory
(a) For an intricacy class C, let co-C = { L | L C } and say that C is shut under
complementation at whatever point C = co-C.
Contend with regards to whether the accompanying assertions are valid, bogus, or obscure.
(I) All deterministic time intricacy classes are shut under complementation.
[3 marks]
(ii) All non-deterministic time intricacy classes are shut under
complementation. [3 marks]
(b) For a planning f : on a letter set and a language L , defifine
f[L] = { f\ (w) | w L } where f\ (a1 an) = f(a1) f(an).
Demonstrate that L NP infers f[L] NP. [4 marks]
(c) Consider the accompanying choice issue.
Q: Given regular numbers m and n in N, and pieces a
(k)
i,j
also, bk in
{0, 1} for 1 k m and 1 I, j n, decide if the framework
of conditions P 1i,jn a
(k)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started