Digital Electronics An arbiter is a functional unit that allows requesters to lock resources while they are
Question:
Digital Electronics An arbiter is a functional unit that allows requesters to lock resources while they are in use. (a) Describe the inputs and outputs of an arbiter for a single resource which has two requesters. [5 marks] (b) Describe two policies that the arbiter might implement when both requesters request the resource simultaneously. One of these should require some internal state. [5 marks] (c) Give a state diagram for axpolicy which requires internal state assuming synchronous operation. [5 marks] (d) Choose one of the policies in (b) and derive equations for outputs and next state control using any type of storage element you choose. [5 marks] 3 [TURN OVER CST.99.2.4 3 Digital Electronics In an edge triggered flip flop, explain what is meant by (a) hold time (b) setup time (c) delay from clock edge to output [3 marks] What relation should hold between two of these quantities to provide sensible behaviour and why? [5 marks] Comment on the possibility and desirability of negative hold times. [2 marks] Each of the following boolean functions is a function of the four variables w, x, y, z. The functions are not totally specified and may take on any value for certain inputs. fn indicates where the function must be true, while gn is true where the value of the function is not constrained. Draw maps and provide a minimum sum of products form for each of the functions. (a) f1 = wxyz + wxyz + wxyz + wxyz + wxyz + wxyz g1 = wxy z + wxyz (b) f2 = wxyz + wxyz + wxyz + wxyz + wxyz + wxyz + wxyz + wxyz + wxyz g2 = wxy z + wxyz [5 marks] Let f(x0, x1, . . . , xn1) be equal to 1 if and only if exactly k of the variables have the value 1. How many prime implicants does this function haveity A B Each of the five switches in the above circuit is closed with probability p, independently of all the other switches. What is the probability of there being a connection from A to B? Express the answer as a polynomial in p. [7 marks] The circuit is then modified to the version shown below, the five switches still being independent. What is the probability of there being a connection from A to B now? Again express the answer as a polynomial in p. [13 marks] A B 5 Probability A solitaire game is played with two coins. One coin is fair, so that P(heads) = 1 2 , and the other is biased so that P(heads) = p. At the first turn the player tosses the fair coin. At all subsequent turns the biased coin is used if the toss at the previous turn resulted in heads and the fair coin is used if the toss at the previous turn resulted in tails. Suppose un is the probability of obtaining heads at turn n. Show that, for n > 1: 2un + (1 2p)un1 = 1 [4 marks] Demonstrate that this difference equation also holds for the case n = 1 provided u0 is suitably defined. [2 marks] Solve the difference equation, expressing un in terms of n and p.
Does the usual WHILE-rule for partial correctness work for total correctness? Justify your answer. [4 marks] Explain why it is necessary to assume that expressions are free of side effects for the Assignment Axiom to be sound. [4 marks] Explain how arrays can be reasoned about using Hoare logic and discuss some of the pitfalls of nave approaches
What does it mean to say that two configurations of a labelled transition system are bisimilar? [3 marks] Describe a labelled transition system for a language of communicating processes with input prefixing (c(x). P), output prefixing (chEi. P), an inactive process (0), choice (P + P 0 ), parallel composition (P|P 0 ) and channel restriction ( c . P). You may assume there is a relation E n which defines when an integer expression E evaluates to an integer n. [7 marks] For each of the following pairs of processes, say whether or not they are bisimilar. Justify your answer in each case. (a) ch1i.((ch2i. 0) + (ch3i. 0)) and (ch1i. ch2i. 0) + (ch1i. ch3i. 0) (b) P and c .((c(x). 0)|(ch1i. P)), where c does not occur in P 10 Foundations of Functional Programming Give as simple a set of rules as you can for transforming lambda calculus to a form where there are no bound variables mentioned, but where there are many instances of the three standard combinator constants S, K and I. [6 marks] Describe tree-rewrites suitable for reducing expressions written in terms of combinators. [6 marks] Explain how you might deal with the issue of keeping track of the values of bound variables if you were to interpret lambda calculus directly. [8 marks]
Explain how the word "protected" is used in Java, commenting about when and why a programmer might use it rather than the alternative legal words that can appear in similar places. Why will you hardly ever use "protected" in small programs that you write and run for yourself? [10 marks] 4 Operating Systems For each of the following, indicate whether the statement is true or false, and explain why this is the case (no marks will be awarded for an answer with no explanation). (a) Round-robin scheduling can suffer from the so-called "convoy effect". (b) System calls are an optional extra in modern operating systems like Windows 2000. (c) A paged virtual memory is smaller than a segmented one. (d) In UNIX, hard-links cannot span mount points. (e) Direct memory access (DMA) makes devices go faster. [2 marks each] SECTION B 5 Foundations of Computer Science (a) Write brief notes on the following: (i) Re-coding a function to make it iterative. [4 marks] (ii) The difference between depth-first and breadth-first search. [4 marks] (iii) ML's exception-handling facilities. [4 marks] (b) Code a function whose input is a list of integers and whose output is the list of all the integers that can be expressed as the sum of one or more of the supplied integers. For example, given [1,5,10] a correct output is [1,5,10,6,11,15,16]; the order of the elements in the output does not matter. [5 marks] (c) Modify the function that you coded above so that the elements of its output appear in numerical order and without repetitions.
Outline how you would implement complex numbers in C++. Your implementation should attempt to make complex numbers look as if they were built into the language by allowing new complex numbers to be declared, initialised, assigned and operated on by the normal arithmetic operators. [13 marks] Discuss to what extent a good C++ compiler could implement your version of complex numbers as efficiently as if they had been a primitive type in the language. [7 marks] 7 Compiler Construction Give a brief description of the main features of either Lex and Yacc or the corresponding Java tools JLex and Cup. [5 + 5 marks] Illustrate their use by outlining how you would construct a parser for expressions composed of identifiers, integers, unary minus and binary operators +, , and /. Your parser is expected to create a parse tree in a format of your choice representing the expression that is presented to it. If it helps, you may assume that expressions will be terminated by writing a semicolon after them.
Describe in detail both Prim's and Kruskal's algorithms for finding a minimum cost spanning tree of an undirected graph with edges labelled with positive costs, and explain why they are correct. [7 marks each] Compare the relative merits of the two algorithms. [6 marks] 7 Operating System Functions Why is it important for an operating system to schedule disc requests? [4 marks] Briefly describe each of the SSTF, SCAN and C-SCAN disc scheduling algorithms. Which problem with SSTF does SCAN seek to overcome? Which problem with SCAN does C-SCAN seek to overcome? [5 marks] Consider a Winchester-style hard disc with 100 cylinders, 4 double-sided platters and 25 sectors per track. The following is the (time-ordered) sequence of requests for disc sectors: { 3518, 1846, 8924, 6672, 1590, 4126, 107, 9750, 158, 6621, 446, 11 } The disc arm is currently at cylinder 10, moving towards 100. For each of SSTF, SCAN and C-SCAN, give the order in which the above requests would be serviced. [3 marks] Which factors do the above disc arm scheduling algorithms ignore? How could these be taken into account? [4 marks] Discuss ways in which an operating system can construct logical volumes which are (a) more reliable and (b) higher performance than the underlying hardware. [4 marks] 5 [TURN OVER CST.2000.4.6 8 Computation Theory Let N be the natural numbers {0, 1, 2 . . .}. What is meant by each of the following statements? The subset S N is recursive. The subset S N is recursively enumerable. [5 marks] How would you extend the definition of recursive enumeration to sets of computable functions? [3 marks] A sequence of natural numbers is a total function s : N N. The sequence is recursive if and only if s is computable. A finite sequence of natural numbers is specified by a pair (l, x), where l N is the number of elements, and x : [1, l] N is a function that defines those elements. The case l = 0 defines the null sequence. In each of the following cases, establish whether the set defined is recursively enumerable: (a) the set of all recursive subsets of N [5 marks] (b) the set of all recursive sequences of natural numbers [2 marks] (c) the set of all finite sequences of natural numbers
Write program that reads a sequence of integers into an array and that computes the alternating sum of all elements in the array. a Java program that reads a 1D array of integers from standard input and returns it.
Define the absolute error x and relative error x in representing a number x. How are these errors related? Which type of error is associated with the term loss of significance? Define machine epsilon m.
Consider the following problem to be solved using a Prolog program: Given a closed planar polygon chain represented as a list of n vertices [v(x1,y1), v(x2,y2), . . . , v(xn,yn)] compute the area of the enclosed polygon, and the orientation of the chain. The area is computed by the line integral 1/2 R x dyy dx where the integral is over the polygon chain. A nave solution is given by the following program, which defines the predicate area. The goal area(Chain,Area) succeeds when Chain is the list of vertices, and the magnitude of Area is the area of the polygon bounded by the chain. The sign of Area is positive if the orientation of the polygon is anticlockwise and negative if it is clockwise: area([X],0). area([v(X1,Y1),v(X2,Y2)|VS],Area):- area([v(X2,Y2)|VS],Temp), Area is Temp + (X1 * Y2 - Y1 * X2) / 2. Explain how vertices are processed by this procedure. [4 marks] Why does this program execute inefficiently? [3 marks] Write an alternative definition that is tail-recursive and makes use of accumulator variables. [10 marks] Explain why your alternative definition executes more efficiently. [3 marks] 4 CST.2000.12.5 9 Databases What is meant by a functional dependency between sets of attributes in a relational database schema? What conditions must be satisfied for a relation to be in Boyce- Codd Normal Form (BCNF)? [4 marks] The Department of Transport is implementing plans to tax traffic congestion. From 2002, cars will carry approved radio-control units which at first will be used only to monitor vehicle movement. In controlled areas sensors identify all vehicles, recording their positions periodically. Amber signs flash when overall traffic flow drops below some threshold, and vehicles within the controlled area may be fined for lack of progress. The owner of each vehicle has an account with the Department of Transport; owners can transfer funds to ensure that their account is in credit. Once credit is exhausted the level of fine increases by a factor 3, and a summons is sent by mail to the vehicle owner's registered address. In order to maintain proper accounts it is essential to keep an accurate record of each monitored offence. You are employed to design the relational database that will enforce the scheme, including provision for vehicle and driver registration, monitoring of vehicle offences and management of vehicle accounts. Describe the schema you propose, stating clearly any assumptions that you make. You need not discuss the calculation of the fines due.
To represent the power series P i=0 ai x i in a computer amounts to representing the coefficients a0, a1, a2, . . . One possible representation is by a function of type int->real that returns the coefficient ai given i as an argument. An alternative representation is the following datatype: datatype power = Cons of real * (unit -> power); (a) Demonstrate the two representations by using each of them to implement these two power series: (i) The constant power series c, with a0 = c and ai = 0 for i > 0. [3 marks] (ii) The Taylor series P i=0 x i /i! for the exponential function. [4 marks]
For each of the given pairs of terms, give a most general unifier or indicate why none exists. (Here x, y, z are variables while a, b are constant symbols.) h(x, y, x) and h(y, z, u) h(x, y, z) and h(f(y), z, x) h(x, y, b) and h(a, x, y) h(x, y, z) and h(g(y, y), g(z, z), g(u, u))
Core Concepts Of Accounting Information Systems
ISBN: 9780470507025
11th Edition
Authors: Nancy A. Bagranoff, Mark G. Simkin, Carolyn Strand Norman