A replicated database is implemented using totally ordered reliable…

Question Answered step-by-step A replicated database is implemented using totally ordered reliable…  A replicated database is implemented using totally ordered reliable multicast. Clients may submit transactions to any process in the group. When process Px receives a new transaction xi from a client, it will multicast the transaction to all processes, including itself. As xi is delivered by multicast, each process submits the transaction to a local ACID database. Px returns the result (abort or commit) to the client; other processes discard the transaction result. (i) This model works well if queries do not contain the SQL time keyword, which is substituted with the current time when a transaction is evaluated. Explain why using time might be a problem and describe a solution. [4 marks] (ii) In the first release of the database, processes submit received multicast transactions synchronously, one at a time, to the local database. In a later version, to improve performance, processes are allowed to submit multiple transactions at a time asynchronously to the local database. Why does this fail to provide strong consistency for distributed transactions? Describe a solution that might allow limited (but useful) local concurrency to be supported. [3 marks] (iii) Describe changes to the design to support weak consistency, and describe two reasons why this might improve performance. answer allSome banks issue their Automatic Teller Machine (ATM) card customers witha randomly selected personal indentification number (PIN). Others issue theircustomers with an initial PIN only, and let the customers choose their own PIN thefirst time they use the card in an ATM. Describe the advantages and disadvantagesof these approaches. [5 marks]Again, some banks compute the customer PIN by encrypting the account numberusing DES and a key known only to their central systems and ATMs, taking the firstfour hex digits of the result, replacing the digits A, . . . , F with 0, . . . , 5 respectively,and finally, if the first digit of the result is 0, replacing it with a 1. What is theprobability that a criminal can get the PIN right given three guesses? [5 marks]Yet other banks have used DES, and a key known only to their central systems andATMs, to encrypt the PIN (whether randomly generated or customer selected); theythen write the result on the magnetic strip on the customer’s card, so that the ATMcan verify it without reference to the central system. Describe the disadvantagesof this arrangement. [5 marks]In order to prevent attacks based on manipulating magnetic strips, banks in somecountries have moved to using smart cards. What effect would you expect such amove to have on the incidence of card-based fraud? [5 marks]5 [TURN OVERCST.98.12.67 Compiler ConstructionExplain how a parse-tree representation of a program may be converted into astack-based intermediate language giving sketches of code to translate expressions,assignments and the if-then-else command; you should also explain howoccurrences of a variable in an expression or assignment are translated.The program may be assumed to conform to the following syntax:E -> n | x | E + E | f(E,E)D -> let f(x,x) = {Dseq; Cseq; E} | let x = EC -> x := E; | if E then C else CCseq -> C | C CseqDseq -> D | D Dseqwith start symbol Dseq. Here n corresponds to integer constants, x corresponds toidentifiers used as variable names and f corresponds to identifiers used as functionnames (you may assume these are disjoint). The function declaration constructhas the effect of defining a function which, when called, makes declarations,performs commands and then returns the result of its expression; note that thereforefunctions may be defined within functions, but the above restriction on identifiersmeans that they cannot be returned as results. [20 marks]8 Prolog for Artificial IntelligenceWrite Prolog programs that define the following predicates. Your programs shouldensure that backtracking does not produce spurious alternative solutions.(a) The nth element of a list: nth(X,N,L) instantiates X to the Nth element oflist L. Assume that list elements are numbered increasing from 1. [4 marks](b) The last element of a list: last(X,L) instantiates X to the last element of list L.[4 marks](c) Remove an element from a list: remove(X,L,M) instantiates M to a listcontaining all the elements of list L except for every occurrence of term X.[6 marks](d) Substitute one element for another: subst(L,X,Y,M) instantiates M to a listcontaining all the elements of list L except that every occurrence of term X inL is replaced by term Y in M.   Consider a program in a simple language L which manipulates only two forms ofvalues: 64-bit two’s-complement integers and 64-bit IEEE floating-point values.L includes variables, integer and floating-point operators and constants, andconditional expressions, but no functions. It is considered a (hard) error if abit-pattern representing a floating-point value is operated on as if it were aninteger and vice versa. There are no implicit coercions, so 1 + 2.3 would be anerror. The job of both static and dynamic type checkers is to stop such errorsfrom happening.(i) Explain the difference between static type checking and dynamic typechecking, pointing out any compile-time or run-time costs and anydifferences in how variables are declared. [3 marks](ii) We can say that a static type system is sound if whenever we have twoprograms S and D, differing only in whether they use static or dynamictype checking, then S passing type checking implies D executes successfully.In a sound type system, does D executing successfully imply that S passestype checking? Justify your answer for L. [2 marks](b) Give three programs exemplifying failure of type soundness in existing languages.Two should involve distinct past-or-current programming languages and oneshould reflect the absence of checks performed by most linkers. [4 marks](c) To what extent does Java use static and/or dynamic typing? [2 marks](d) (i) A monad M can be seen as a type constructor for an abstract data type.Give the two operations which every monad must possess, along with theirtypes. [3 marks](ii) Now consider the monad E and the functions f and safediv, given in SMLsyntax by:datatype a E = return a | failfun (fail >>= f) = fail| ((return v) >> f) = f vfun f(w,x,y,z) = (w div x) div (y div z)fun safediv(x,y) = if y<>0 then return(x div y) else failRe-code f as a function g which uses operations from monad E along withfunction safediv so that the only non-zero tests around division are withinsafediv. Remark on any difference between the types of f and g.[6 marks]2CST1+CST2.2020.7.32 Economics, Law and EthicsYou have an idea for an innovative new type of application for self-directed teachingand learning. The eTeacher uses state-of-the-art natural language processingapproaches to allow for text and speech interaction. Over time, it builds a profile ofthe user’s most effective means of learning, and tailors the teaching style accordingly.The intended users are secondary school students and adults who wish to refreshtheir understanding of Mathematics, English, Geography, or History. You plan tomonetise the application by way of advertisements and in-app purchases.(a) You are seeking investors. Discuss the economic and legal considerations thatmight inform your business plan and persuade investors to fund your startup.For a convincing pitch, you should define the necessary terms and explain yourreasoning. [7 marks](b) Explain how things might change if the economy goes into recession. [3 marks](c) Outline the principles of the General Data Protection Regulation (GDPR). Howmight you comply with the GDPR and allow individuals to exercise their rights?[10 marks]3 Economics, Law and Ethics(a) Define the following terms, providing examples to illustrate their meaning.(i) Pareto improvement [2 marks](ii) Pareto efficient allocation [2 marks](iii) Utility [2 marks](b) Explain the theorems of welfare economics, comparing and contrasting classicalutilitarian welfare and Rawlsian welfare.[8 marks](c) Do you expect the free market will solve the privacy problem?[6 marks]3 (TURN OVER)CST1+CST2.2020.7.44 Formal Models of LanguageThe string ‘a b c d e’ has the following dependency parse:a b c d erootThe table shows the first two actions when deriving this parse using a modifiedshift-reduce parser which uses the actions: shift, right-arc and left-arc.stack buffer actionabcde shifta bcde shiftab cde(a) Describe the actions shift, right-arc and left-arc in terms of their effecton the stack and buffer. Also describe any arcs that are recorded when theactions are used. [5 marks](b) The parser also uses the action terminate which links a lone item on the stackto root. Complete the parse action table such that the actions derive the parseshown at the top of the page. [6 marks](c) In Part (b) you have selected the parse actions by hand; explain how the sequenceof parse actions is obtained from data in an automatic parser. [4 marks](d) The dependency parse for the string ‘a b c d e’ is homomorphic with the Englishlanguage string ‘Alice shook up the potion’. An alternative word order for thisstring is ‘Alice shook the potion up’.(i) Draw the dependency parse for the alternative string. [1 mark](ii) Compare capturing natural language alternations using a context-freegrammar as opposed to a dependency grammar.c, d, e are melodic elements. A birdsong is composed of a sequence of these elementsas follows:c c d c c e c c d c c d c c e(a) (i) Using byte pair encoding induce a context-free grammar for this sequenceof birdsong. Show your workings and state what you have decided to do inthe case of a tie. [6 marks](ii) Draw the derivation tree that parses the birdsong using your inducedgrammar. [1 mark](iii) What are the shortcomings of this method of grammar induction for naturallanguages? [3 marks](b) Assuming that c, d and e are the only melodic elements available in the birdsong,and that the excerpt we are given is probabilistically representative of thebirdsong in the wild, what is the average information produced per element?Provide relevant equations. [3 marks](c) In Part (b) we assumed a 1st-order model of the birdsong. What assumptiondoes this make about the sequence of elements? [1 mark](d) Consider a 2nd-order model of the birdsong and calculate the conditionalentropy. Provide relevant equations. [4 marks](e) How can we calculate the entropy rate of birdsong? Provide relevant equations.[2 marks]5 (TURN OVER)CST1+CST2.2020.7.66 Further Graphics(a) Consider the b-spline curve P(t) with knot vector [ 0, 1, 2, 3, 3, 3 ] and k = 3.(i) In a single sentence, explain the effect on P(t) of repeating a knot value ktimes. [1 mark](ii) State the equations that define P(t). [3 marks](iii) State the equation and sketch the graph for each of the three quadraticbasis functions Ni,3(t) of P(t). [8 marks](iv) Plot the path of P(t) for control points P0 = (0, 0), P1 = (4, 0), P2 = (4, 4).The relational model of data was introduced in the early 1970s in a sequence ofpapers by E.F. Codd. This model proposes a tabular view of data, with a simpleData Manipulation Language (DML) based on relational algebra or relationalcalculus. Briefly explain the essential features of the model and its DML. [6 marks]Later work by Codd and others addressed weaknesses in the expressive power ofthe relational model. For each of the following give an example to show how theweakness arises, and explain an approach proposed to resolve the difficulty:(a) computing the transitive closure [4 marks](b) manipulating collections of records [4 marks](c) handling entity specialisation [6 marks]In case (c) you should outline the proposals of either the Object-Oriented DatabaseSystem Manifesto or the Third Generation Database System Manifesto.10 Introduction to Functional ProgrammingWrite an ML function upto of type int -> int list such that upto ngenerates the list [1,2,3,…,n]. [7 marks]What is wrong with the following function to take the head of a list?fun wrong_headed [h,t] = h;What is the type of wrong_headed? [5 marks]Why is the following function to evaluate Fibonacci numbers inefficient?fun fib 0 = 1| fib 1 = 1| fib n = fib(n-1) + fib(n-2);Write a similar but more efficient version. [8 marks]7 [TURN OVERCST.98.12.811 Computer VisionGive three examples of problems in computer vision which are formally ill-posed.In each case explain how one or more of Hadamard’s criteria for well-posed problemshas failed to be satisfied. Illustrate how the addition of ancillary constraints orassumptions, even metaphysical assumptions about how the world behaves, enablesone to convert the ill-posed problem into a well-posed problem. Finally, discuss howthe use of Bayesian priors can perform this function. [20 marks]12 Complexity Theory(a) Describe the problem 3-SAT. [2 marks](b) Show how any instance of the seemingly more general problem n-SAT can bereduced to an equivalent one where each term has exactly three literals in it.Estimate how much larger the reduced problem would be than the originalone. [4 marks](c) A certain computation using a non-deterministic Turing machine completesin T time-steps. The Turing machine has k states and uses an alphabet ofN symbols. A major theorem underpinning the concept of NP-completenessis based on a conversion of a description of such computations to booleanformulae which characterise them.Explain how, in such a reduction, boolean variables may be used to describestates that the Turing machine might be in. Show how to derive thosecomponents of the boolean formula that relate just to the way in whichthe Turing machine moves its read-write head. Your explanation shouldbe sufficiently complete and carefully explained that it could be used as aspecification of a program that would perform that part of the translation fromTuring machine descriptions to boolean formulae. You should not attempt toexplain the rest of the boolean formula or how it fits into a complete proof orprogram. [11 marks](d) In terms of T, k and N, about how many symbols does it take to write theboolean expression you generate?    Understanding, classifying, and identifying human faces has been a longstanding goal in computer vision. Yet because the face is an expressive social organ, as well as an object whose image depends on identity, age, pose and viewing angle, and illumination geometry, many forms of variability are all confounded together, and the performance of algorithms on these problems remains very poor. Discuss how the different kinds and states of variability (e.g. same face, different expressions; or same identity and expression but different lighting geometry) might best be handled in a statistical framework for generating categories, making classification decisions, and recognising identity. In such a framework, what are some of the advantages and disadvantages of wavelet codes for facial structure and its variability? [20 marks] 14 Computer Systems Modelling Two servers operate with different performance characteristics at mean rates µ1 and µ2. You wish to combine them into a single system by associating each server with a separate FIFO queue and dispatching incoming work items to the first queue with probability p1 and to the other queue with probability p2. Incoming items arrive at a rate ? and none are discarded from the system. You may assume that the inter-arrival-time distribution and both service-time distributions are exponential, that there is no limit on the queue lengths and that the population size is infinite. (a) Using Kendall notation, describe the first server and its queue. Construct a Markov-chain model for this part of the system. [2 marks] (b) Let qk,i denote the probability that there are exactly i items of work in server k and its queue. By using detailed flow balance equations or otherwise express qk,i in terms of ?, pk and µk. [6 marks] (c) Hence derive Tk, the mean response time of work items served at k. [6 marks] (d) Suppose that the system administrator wishes to ensure that work items receive the same mean response time irrespective of which server they visit. Express p1 in terms of ?, µ1 and µ2. Qualitatively, when is it reasonable to consider dispatching work to both servers to maintain an equal mean response time? How will the system behave at other times? [6 marks] 10 CST.2001.8.11 15 Topics in Concurrency (a) Describe an algorithm for deciding whether or not a finite-state CCS process satisfies an assertion in the modal µ-calculus. [6 marks] (b) Draw the reachable transition system of the CCS process P, where P def = a.P + b.(b.nil + a.nil) Computer Science Engineering & Technology Java Programming COMPUTER S TO3 Share QuestionEmailCopy link Comments (0)