This question considers a language L which has integer variables V…

Question Answered step-by-step This question considers a language L which has integer variables V… This question considers a language L which has integer variables V , arithmetic expressions E and boolean expressions B, along with commands C of the forms V :=E (assignment), C; C 0 (sequencing), IF B THEN C ELSE C 0 (conditional) and WHILE B DO C (iteration). (a) Explain the syntax of the Hoare-logic partial-correctness formula {P} C {Q} and give a careful definition in English of when it is valid, that is, when |= {P} C {Q}. [2 marks] (b) How does the definition of validity for the total-correctness formula [P] C [Q] differ? [1 mark] (c) Preconditions and postconditions in {P} C {Q} often make use of logical or auxiliary variables v in addition to program variables V . Explain why this is useful illustrating your answer with a command C which satisfies {T} C {R = X + Y} but not {X = x ? Y = y} C {R = x + y}. [3 marks] (d) Give the axioms and rules of an inference system ` {P} C {Q} for Hoare logic. [4 marks] (e) Are your rules sound? To what extent are they complete? [2 marks] (f ) Give a formal proof, using your inference system, of {X = x ? Y = 3} X:=X+1 {X ? 1 = x ? Y < 10}. [2 marks] (g) Consider the command C given by WH (X:=X-1; Y:=Y+3), and let P be the precondition X = x ? Y = y ? x ? 0. Give the strongest postcondition Q that you can establish. Give any invariant necessary to prove {P} C {Q} for your Q. Explain briefly how the structure of the proof relates to the structure of C. [6 marks]It is required to write a program to gather information about the lexical structure of a source file. The file contains words composed of letters and digits starting with a letter, decimal integers composed of digits, and various other single- and multi-character symbols such as :=, +, -, [, ], and ->. About 50 of the words are reserved, the others being identifiers. It is required to count how often each symbol and reserved word occurs, the number of distinct identifiers used, and the mean value of all the integers that occur in the source file. Suggest how you would design such a program with the aid of Lex, paying particular attention to the overall structure of the program, and giving a detailed account of how you would deal with the identifiers. [20 mark r Modula-3 The thread system in Modula-3 uses mutexes and condition variables to control concurrency. An alternative scheme would be to provide eventcounts and sequencers. An eventcount is an integer, initially zero, equipped with the three atomic operations: advance increments the count and returns its new value, read returns the current value of the count, and await (value) suspends the calling thread until the count is at least as large as the value given as an argument. A sequencer is an integer, initially zero, equipped with a single atomic operation: ticket increments the count and returns its previous value. Given an eventcount, guard, and a sequencer, turn, a critical region can then be coded as follows: myturn := turn.ticket (); guard.await (myturn); . . protected code . EVAL guard.advance (); Write an interface, ECS, defining opaque object types EventCount and Sequencer. EventCount should have methods advance, read and await, with appropriate signatures, and Sequencer should have a ticket method. [8 marks] Sketch an implementation of the ECS module giving concrete revelations of the types and providing appropriate default methods. [12 marks] 2 CST.94.3.3 3 Formal Languages and Automata What is meant by the language accepted by a finite deterministic automaton M = (Q, ?, ?, i, F)? [2 marks] Show that it is possible to associate with M a regular expression r over ? denoting the same language as that accepted by M. [12 marks] Illustrate your answer by constructing such a regular expression r when M is the finite deterministic automaton with Q = {q1, q2, q3} ? = {0, 1} i = q1 F = {q3} and with transition function ? defined by the table q1 q2 q3 0 q2 q3 q3 1 q3 q2 q2 [6 marks] 4 Operating System Functions Describe the use of an inverted page table for the implementation of virtual addressing and a paging virtual memory system. Give details of the operation of the page table and its associated data structures. [15 marks] What can be done to overcome the thrashing problem encountered with a direct mapped inverted page table? [5 marks] 5 Operating System Functions What is the Access Control matrix? Describe the capability and access control list views of this matrix. [10 marks] In a capability-based system, describe the techniques which can be used to protect the capabilities from unauthorised modification. [10 marks] 3 [TURN OVER CST.94.3.4 6 Data Structures and Algorithms For the following, n is a positive integer and G is a graph of N nodes (vertices) and E arcs (edges) each with a given weight (or cost). For seven of the following indicate, with a short justification, whether the statement is true or false. (a) All functions f of the form f(n) = Ank (with A and k being constants) are in the class O(2n). (b) All sorting methods for an array of n elements take time O(n 5 ). (c) It is possible to sort an array of n elements using binary comparisons in ?(n log n) time. (d) It is possible to sort an array of n elements using binary comparisons using O(1) (i.e. constant independent of n) additional space. (e) Radix sorting can sort any set of integers in linear time. (f ) All straight lines from the inside of a polygon to the outside intersect the points on the edges forming its boundary an odd number of times. (g) It is always cheaper to find the shortest distance between two given nodes u, v of G than to find all N shortest distances from u to every other node. (h) It is possible to find the shortest paths between all N2 pairs of nodes of G in O(N3 ) time. (i) If G is connected then the minimal spanning subtree of G contains the N ? 1 edges whose weights are smallest. (j) It is possible to compute the convex hull of n points in a plane in time g(n) where g is a function such that g(n)/n2 tends to zero as n becomes large. Marks will be awarded for overall succinctness, attention to detail and absence of random guesses lacking justification. [20 marks] 4 CST.94.3.5 7 Data Structures and Algorithms For four of the following ideas, give examples of problems and algorithms to solve them. (a) divide and conquer (b) breadth-first search (c) balanced data structures (d) use of randomness in algorithms (e) “greedy” algorithms (f ) dynamic programming [5 marks each] 8 Graphics Explain with a diagram how a shadow mask cathode ray tube works. [12 marks] What might be the point of extending the scheme to accommodate five electron guns? [8 marks] 5 [TURN OVER CST.94.3.6 9 Numerical Analysis I The mid-point rule can be expressed in the form In = Z n+ 1 2 n? 1 2 f(x) dx = f(n) + en where en = f 00(?n)/24 for some ?n in the interval (n ? 1 2 , n + 1 2 ). Assuming that a formula for R f(x) dx is known, and using the notation Sp,q = X q n=p f(n), describe a method for estimating the sum of a slowly convergent series S1,?, by summing only the first N terms and estimating the remainder by integration. [7 marks] Assuming that f 00(x) is a positive decreasing function, derive an estimate of the error |EN | in the method. [5 marks] Given Z dx 1 + x 2 = tan?1 x, apply the method to X? n=1 1 1 + n2 . What is the integral remainder to be added to S1,N ? [4 marks] To the nearest power of 10, how large should N be to achieve an absolute error of approximately 10?16? [4 marks] 6 CST.94.3.7 10 Structured Hardware Design A subsystem consists of a microprocessor core, RAM, ROM and a sophisticated DMA engine (which effectively consists of counters and random logic), and is to be built into a wide variety of modules with various peripherals. Describe the following implementations of the subsystem, considering the merit of each approach, in terms of design effort and cost effectiveness. (a) a single chip using full custom design [6 marks] (b) using semi-custom technologies [6 marks] (c) using field programmable logic and standard parts [6 marks] (d) using only standard parts [2 marks]) A one megabyte memory bank with 64-bit data bus is to be constructed from SRAM chips of individual capacity 32K×8. Sketch out a design for the bank showing clearly how the SRAM chips are arranged. [4 marks] (b) Describe, in, three ways in which an underlying theory can help to improve the quality of software systems. [4 marks] (c) Acoustic couplers used to connect modems to telephone handsets present an audio interface from the telephone network to computer equipment. Name one advantage and one disadvantage of using such an interface. [4 marks] (d) Show that for any two regular expressions r and s, the regular expressions r(sr) ? and (rs) ? r determine the same regular language. [4 marks] (e) Describe a significant invention in software engineering, including the problem it addresses and the manner in which it is supported by modern development tools. [4 marks]An undirected network is an undirected graph in which each edge u ? v has an associated capacity c(u ? v) > 0. Let there be a source vertex s and a sink vertex t. We wish to find the maximum flow from s to t such that on every edge u ? v either there is flow u ? v, or v ? u, or there is no flow at all. It is not allowed to have flow in both directions simultaneously. The flow on an edge, whichever direction it is in, must not exceed capacity. We can write the flow constraints in mathematical notation as min ? v) where f(u ? v) is the flow from u to v on edge u ? v. Note that this differs from the conventional Ford-Fulkerson setup, in which each directed edge has a capacity constraint. (a) Define the value of a flow. State the flow conservation equation. [2 marks] (b) Give an algorithm for finding a maximum flow. [6 marks] (c) Prove that your algorithm returns a valid flow. [4 marks] (d) Prove that your algorithm returns a maximum flow. [4 marks] (e) Define the capacity of a cut in an undirected network. Show that the maximum flow value is equal to the minimum cut capacity. [4 marks] [Hint: You may refer to code from lecture notes without repeating it in your answer. You may quote without proof any theorems from lecture notes.] Describe the syntax of the synchronized keyword in Java and explain the effect on the runtime behaviour of a program. [5 marks] (b) Compare and contrast the approaches of using a single mutex to guard access to an entire data structure and using individual mutexes on each unit of storage within the data structure. [5 marks] (c) Consider a queue data structure, based on a linked list. The operations pushTail and popHead are to be provided and it should be possible to execute both concurrently whenever doing so would be safe (but not when it would be unsafe). Provide a Java implementation of the data structure and concurrency control mechanism, including the methods to push new items on the tail of the queue and to pop items from the head.Distributed link-state routing algorithms can be enhanced by a central controller, such as the fibbing scheme, to modify the results of the computation. Explain by an example, starting from the topology below, how a specific path can be added from routerl nodes in the topology, and their advertisement via the routing protocol. requirement (b) Dynamic Alternative Routing (DAR), also known as Sticky Random Tandem, is a way to shed load from the most direct path in a circuit switched network to other, slightly longer paths. It depends on properties of the backbone topology of the telephone network, and, to some extent, on the properties of telephone call statistics. Describe the basic algorithm and give an overview of why it works well. [10 marksWhat are the key differences between the data centre network environment and the broader, general Internet eco-system? How do these lead to simpler choices for offering performance guarantees for traffic? [10 marks] (b) Network coding can be used to combine packets redundantly to provide error protection, but also to reduce the number of transmissions and retransmissions necessary. It is used in the transport layer, from each source, and in the network layer, combining data from multiple sources. How might a combination of these techniques simplify buffering in simple wireless devices that you might find in an Internet of Things (IoT) environment?Designing Interactive ApplicationsDistinguish the phrases wishes evaluation and requirements analysis. Provide an exampleto illustrate the distinction. What is a robust requirement? Provide counter-examples and provide an explanation for why everyinstance isn’t a robust requirement. What role does a purposeThe receptionist at a small sers via telephone, courier, e-mail or FAX. Thereare about 100 recipients, maximum of whom are researchers. They spend a massivepercentage in their time in meetings of 1 type or any other, a number of which might beheld in places of work, the remainder in convention rooms. okay please The receptionist endeavors toavoid interrupting crucial meetings unnecessarily.It is proposed to construct a system based upon Active Badge technology to enhancemessage dealing with sports in the laboratory. Each member of group of workers wears an activebadge. An present Location Server presents patron applications with up to daterecords about the region and movements of every lively badge.Sketch out the methods you’ll appoint to set up the users’ wishes for theproposed system. Describe the kinds of records you would skip on to thedesigner and illustrate each with one or  examples.  Consider the variations used within the production and rendering of a threedimensional model on a display screen.(a) List the three fundamental alterations inside the processing pipeline and provide an explanation fortheir rˆoles. [6 marks](b) Why is it convenient to represent the adjustments as matrices? [2 marks](c) What are homogeneous coordinates? Explain how they may be used in modellingthese variations as matrices.(d) Derive the matrix to represent a attitude transformation for a viewer at thefoundation of a point in 3 dimensions to some extent on a display within the aircraft z = d.(e) Perspective in classical artwork has vanishing points in the direction of which parallel tracesconverge. Explain mathematically why that is the case and show the way to calculatethe vicinity on the display of the vanishing point for strains in a selected route.[5 marks][Hint: It may be helpful to represent lines parametrically in vector form asP(s) = A + sV where V is a direction and A is any point on the line.]four Computer Graphics and Image ProcessingConsider a curve described through polynomial parametric segments Pi(s) for i = 1, 2, . . . Mthat interpolates a fixed of factors Ai0?i?m in 3 dimensions.(a) What is supposed by way of Ck continuity at the junction of two segments? [3 marks](b) What is the least order of the polynomials that must be used to obtain Ckcontinuity on the junctions? [2 marks](c) Derive the Overhauser formulation for a set of weighting features w?2(s),w?1(s), w0(s) and w1(s) in order that the cubic curve section joining Ai?1 and Aimay be expressed as Pi(s) = w?2(s)Ai?2 + w?1(s)Ai?1 + w0(s)Ai + w1(s)Ai+1for 1 < i < m. [10 marks](d) Extend this formulation to present a fixed of parametric patches Pi,j (s, t) for 1