Question
Assume that you have an algorithm that can fill 3D triangles with a constant colour. Explain what additional information and additions to the algorithm are
Assume that you have an algorithm that can fill 3D triangles with a constant colour. Explain what additional information and additions to the algorithm are required to Gouraud shade the triangles. (b) Given the algorithm in (a), explain what additional information and additions to the algorithm are required to texture map the triangles using bilinear interpolation, including an explanation of how the bilinear interpolation is done. (c) Explain the advantages and disadvantages of using nearest-neighbour interpolation compared with bilinear interpolation. [3 marks] (d) Explain why a MIPmap would be useful for texture mapping and how one could be incorporated into the algorithm from (b).
In this question assume that p and q are atomic formulae. (a) Compare and contrast path formulae and state formulae in temporal logic. [4 marks] (b) Describe and contrast the meanings of F(G p) and AF(AG p). [4 marks] (c) Describe and contrast the meanings of G(F p) and AG(AF p). [4 marks] (d) Write down and justify a temporal logic formula that expresses the property that some state satisfying q is reachable from every state satisfying p. (e) Write down and justify a temporal logic formula that expresses the property that no path contains a consecutive sequence of 256 states satisfying p.
(a) Consider a standard bag-of-words model for the document retrieval problem. (i) Give an expression for the tf-idf weighting scheme which assigns a weight to each term in a document. Motivate each part of your expression, using the notion of Zipf's law when appropriate. [3 marks] (ii) How might you modify your tf-idf scheme for each term in a query? Why might you use different schemes for documents and queries? [3 marks] (b) Edit distance can be used for spelling correction in search queries. (i) Define edit distance. [1 mark] (ii) As an example of how to calculate edit distance efficiently, show how dynamic programming can be used to calculate the edit distance between able and belt. [5 marks] (c) The PageRank algorithm uses a model of a "random surfer" to calculate the importance or validity of a page. Describe how the random surfer can be modelled as an ergodic Markov chain, and how this leads to the PageRank values being calculated as a principal left eigenvector of the transition probability matrix. (You are not required to give a formal definition of an ergodic Markov chain; an informal description will suffice.) (i) What are the probabilities of outcomes 0 and 1 if the first qubit of |i is measured? (ii) What are the probabilities of outcomes 0 and 1 if the second qubit of |i is measured? (iii) What is the state of the system after the first qubit of |i is measured to be a 0? (iv) What is the state of the system if the second qubit of |i is measured to be a 1? (v) What are the probabilities of outcomes 0 and 1 if the second qubit of the system is measured, after the first qubit of |i has been measured to be 0? (vi) What are the probabilities of outcomes 0 and 1 if the first qubit of the system is measured, after the second qubit of |i has been measured to be You are working on an encryption device with your new colleague, Mallory Baish, who proposes that you use a pseudo-random generator ri = h1(si), si+1 = h2(si) where s0 G is the random initial state and the other si G are subsequent internal states, all invisible to adversaries. The h1, h2 : G G are two secure one-way functions. Adversaries may see any of the past outputs r0, . . . , rn1. If they can predict from those, with non-negligible probability, the next value rn, then the security of your device will be compromised. (a) Give a rough estimate for the probability that an adversary can predict rn, as a function of n and |G|. Explain your answer. [6 marks] (b) Mallory also suggests a specific implementation: h1(x) = f(u x mod p) p = a 2056-bit prime number h2(x) = f(v x mod p) u, v = two numbers from Z p f(x) = x mod 22048 G = Z2 2048 (i) The constants p, u and v will be known to the adversary. What conditions should they fulfill so that h1 and h2 can reasonably be described as one-way functions, and how would you normally generate suitable numbers u and v? [Hint: quadratic residues] [4 marks] (ii) If f were replaced with the identity function, how could an adversary distinguish the ri emerging from this pseudo-random generator from a sequence of elements of Z p picked uniformly at random? [4 marks] (iii) After you choose a value for p, Mallory urges you to use two particular values for u and v generated in your absence. You briefly see "v = u e mod p" scribbled on a whiteboard. You become suspicious that Mallory is trying to plant a secret backdoor into your pseudo-random generator. Explain how Mallory could exploit such a backdoor. [6 marks] 9 (TURN OVER) CST.2015.8.10 10 System-on-Chip Design (a) Explain what factors limit the complexity and performance of an SoC at the heart of a portable electronic device. [4 marks] (b) Compare and contrast the use of hardware and software to implement a compute-intensive algorithm on an SoC, such as data encryption. Include customised processors and co-processors in your analysis. [5 marks] (c) (i) Define the term fully-pipelined with respect to a hardware component. [2 marks] (ii) Describe and compare three designs for a fixed or floating-point multiplier that vary in performance: one at least should be fully pipelined. [6 marks] (iii) Define the term structural hazard and explain why these can affect system performance. Which of your designs from part(c)(ii) might present such a hazard and why? [3 marks] 11 Topical Issues (a) Compare and contrast the radio channels used by Bluetooth Low Energy (BLE) and WiFi in the 2.4 GHz ISM radio band. Explain why BLE uses only three channels for advertisements and how the three were selected. [6 marks] (b) Consider a wireless mouse computer peripheral. Analyse the use of WiFi, BLE and a proprietary radio system for communication with the computer, giving advantages and disadvantages for each. [10 marks] (c) Bluetooth 4.0 specifies a per-packet Cyclic Redundancy Check (CRC) to protect each 31-octet BLE packet as a whole. In contrast the longer WiFi packets contain a separate CRC for each of the packet header and the packet payload. When Bluetooth 4.1 introduced longer BLE packets, it retained a single CRC for the entire packet. What are the consequences of this decision? [4 marks] 10 CST.2015.8.11 12 Topics in Concurrency This question is on an authentication protocol using a key server and symmetric keys. Key(X, Y ) represents the symmetric key used to encrypt messages sent by X to Y , and symbols K and K0 are used as variables over keys. SPL terms representing a key server S, an initiator A and responder B are: S = !(in {X, Y }Key(X,S) . out {Key(X, Y ), Key(Y, X), Y }Key(S,X)) A = out {A, B}Key(A,S) . in {K, K0 , B}Key(S,A) . out {m}K. in {m, m}K0 B = out {B, A}Key(B,S) . in {K0 , K, A}Key(S,B) . in {}K. out {, }K0 (a) (i) The capabilities assumed of an attacker when public-key cryptography is used for authentication, as when studying the Needham-Schroder-Lowe protocol, are that it can pair messages, split paired messages, encrypt messages under a public key and decrypt messages under a public key if it has access to the private key. Give four SPL processes Spy1 , . . . , Spy4 representing these capabilities. [4 marks] (ii) Give a further two processes Spy5 , Spy6 representing the capability of an attacker to encrypt and decrypt messages when symmetric-key cryptography is used.
What is meant by saying that a model for computation offers unlimited data storage but is restricted to finite logic? [3 marks] How would you record the configuration during computation within such a model? Illustrate your answer by considering both Turing machines and register machines. Suppose you are given a k-symbol Turing machine having searching states. Show how to represent the transition from the configuration at time t to the configuration at time t + 1 by a system of arithmetic equations. Hence show that any Turing machine computation may be simulated by a register machine having a suitable program.
Consider IEEE single-precision arithmetic. How are the 32 bits arranged in terms of sign, exponent and significand? How is the exponent stored? Explain the terms normalized number, denormal number. What is the hidden bit and how is it used? How are negative numbers stored? What does NaN stand for? Give an example of an operation that yields a NaN value.
) Give a program which has a different result when interpreted using dynamic scoping from that using static scoping. (b) Give a program (using let to declare variables) which runs with no run-time type errors under dynamic typing but is invalid in a static typing regime such as that of Java or C. (c) Compared with int v[8], why might the declaration int v[e] cause less efficient code to be compiled if e is not a constant expression, or even if e is a large constant? (d) Give two context-free grammars which accept the same strings with one being ambiguous and one non-ambiguous. (e) Give a data-structure type declaration in a language of your choice which might be useful to represent parse trees for the following grammar: E -> E + T | E - T | T T -> P ^ T | P P -> ( E ) | n Here E is the start symbol and n is a terminal symbol representing the result of lexing an integer constant. [4 marks each] 1 [TURN OVER CST.98.10.2 2 Modula-3 Compare and contrast the Modula-3 procedures VAL and LOOPHOLE. [4 marks] Apart from two incomplete statements, the program below constitutes a solution to the Eight-Queens problem and counts the number of ways in which 8 Queens may be placed on a chess board such that no queen is under attack from any other. Suggest suitable right-hand sides for the incomplete assignments. [8 marks] Explain how the program works giving particular attention to all uses of the LOOPHOLE procedure. [8 marks] UNSAFE MODULE EightQueens EXPORTS Main; IMPORT IO, Fmt; TYPE Row = SET OF [0..7]; VAR count : CARDINAL := 0; PROCEDURE try (left, above, right : Row) = VAR poss, place, l, r : Row; BEGIN IF above = Row{0..7} THEN INC(count) ELSE poss := Row{0..7} - left - above - right; WHILE poss # Row{} DO place := poss * LOOPHOLE(-LOOPHOLE(poss, INTEGER), Row); l := r := try(l, above+place, r); poss := poss - place END END END try; BEGIN try(Row{}, Row{}, Row{}); IO.Put ("There are " & Fmt.Int(count) & " solutions ") END EightQueens. 2 CST.98.10.3 3 Programming in Java Describe briefly the facilities provided in Java for describing classes and inheritance. How is an object instantiated, initialised and finalised? [8 marks] What are abstract classes and interfaces? How and why are they used? [4 marks] Explain how modifiers are used to control the visibility of identifiers. [4 marks] Illustrate your answer with examples drawn from the various schemes for handling graphical input in different versions of the Abstract Windowing Toolkit. [4 marks] 3 [TURN OVER CST.98.10.4 4 Continuous Mathematics Show that for all families of functions which are "self-Fourier" (i.e. equivalent in functional form to their own Fourier transforms), closure of a family under multiplication entails also their closure under convolution, and vice versa. [Hint: closure of a set of functions under an operation means that applying that operation to any member of the set creates a function which is also a member of the set.] [10 marks] A periodic square wave, which alternates between the constants +/4 and /4 with period 2 has the following Fourier series, using all positive odd integers n: f(x) = X odd n=1 1 n sin(nx) Derive from this the Fourier series for a periodic triangular wave, which ramps up and down with slopes +/4 and /4 and with period 2. [3 marks] Any real-valued function f(x) can be represented as the sum of one function fe(x) that has even symmetry (it is unchanged after a right-left flip around x = 0) so that fe(x) = fe(x), plus one function fo(x) that has odd symmetry, so that fo(x) = fo(x). Such a decomposition of any function f(x) into fe(x) + fo(x) is illustrated by fe(x) = 1 2 f(x) + 1 2 f(x) fo(x) = 1 2 f(x) 1 2 f(x) Use this type of decomposition to explain why the Fourier transform of any realvalued function has Hermitian symmetry: its real-part has even symmetry, and its imaginary-part has odd symmetry. Comment on how this redundancy can be exploited to simplify computation of Fourier transforms of real-valued, as opposed to complex-valued, data. [7 marks] 4 CST.98.10.5 5 Data Structures and Algorithms Describe (a) how to determine whether or not a point is inside a simple plane closed polygon, paying proper attention to awkward cases; [6 marks] (b) how, with luck, to exclude large numbers of points from the convex hull of a set of points in the plane, with due consideration of what can go wrong; [7 marks] (c) how to compute economically the convex hull of the points that are left after the measures you have described in (b) above. [7 marks] 6 Data Structures and Algorithms What is a priority queue? Explain the data structure known as a heap and describe how a heap can be implemented using a simple linear block of memory. Assuming that a heap implemented in this way stores N items, describe how it can be viewed as an almost-balanced binary tree. What difference can there be between the greatest and least lengths of paths from the root of the tree to a leaf? [5 marks] Describe, and estimate the costs of, procedures to (a) find the parent and offspring of a given node; [2 marks] (b) insert a new item into an existing heap; [2 marks] (c) delete the topmost item from a non-empty heap; [2 marks] (d) starting from an array holding N items in arbitrary order, rearrange those items so that they form a heap, taking time less than that which would be needed if the items were just inserted into the heap one after the other. [4 marks] A stable sorting method is one where items whose keys compare as equal will appear in the output in the same order that they appeared in the input list. Would a heap sort based on the algorithms you have documented be stable? Justify your answer. [5 marks] 5 [TURN OVER CST.98.10.6 7 Computer Design How can a pipeline be used to improve processor performance? [5 marks] Explain, with reference to the 5-stage pipeline diagram below, how feed-forwarding (also called bypassing) can be used to reduce the effects of load delays but cannot eliminate them. instruction register execute memory register fetch fetch access write back [10 marks] Most instructions in old accumulator machines read an operand from memory which is then combined with the accumulator. The only exception is usually the store instruction which writes the accumulator (without modification) to the memory. If you were to pipeline an accumulator machine, where would the memory access stage go? [5 marks] 8 Operating System Foundations You are to advise on the selection of an operating system on which networkaccessible services are to be provided. Each service must be capable of supporting a specified number of simultaneous clients and multiprocessor hardware may be used. Define and evaluate each of the following styles of support for multi-threaded processes: (a) user threads only [10 marks] (b) kernel threads only [10 marks] [Hint: include selected data held in process and thread descriptors; mention calls supported at the thread-package and kernel interfaces.]
(a) Write efficient microcontroller program (pseudocode) that outputs a continuous sine wave of frequency f = 440 Hz with values yn in the range 1 to 1 at a sampling frequency fs = 32 kHz. The programming language you have available lacks complex-number arithmetic, the runtime environment offers only basic floating-point arithmetic (i.e., no trigonometric functions), addition is much faster than multiplication, and there is insufficient memory to store a precomputed waveform. (b) The discrete sequence yn = cos(2nf1/fs) + A cos(2nf2/fs) is fed into a (hypothetical) digital-to-analogue converter that outputs a constant voltage y(t) = yn during the time interval n/fs t < (n + 1)/fs for all integers n. (i) Explain how this behaviour of the digital-to-analogue converter affects the amplitude spectrum of the resulting signal. (ii) What amplitude A has to be chosen for the second term such that the resulting amplitude spectrum shows equally high peaks at both f1 = 1 kHz and f2 = 2 kHz if the sampling frequency is fs = 6 kHz?
Write java program to read database tables from Microsoft Azure. The database is in azure. Write a java program how to access the database and read the tables. JAVA program to read in a c++ program and capitalize all the comments(/*, */, and //) in the program.
(a) Microkernel operating systems aim to address perceived modularity and reliability issues in traditional "monolithic" operating systems. (i) Describe the typical architecture of a microkernel operating system such as Mach 3.0, including its use of address spaces, processor privilege levels and communication channels compared with a traditional operating system structure. [6 marks] (ii) How does this structure affect the system performance? [4 marks] (b) Virtual machine monitors existed before microkernels and have experienced a recent resurgence of interest; using examples, describe some of the motivations for a virtual machine monitor approach.
(a) What is meant by dual-rail logic? When is it used? (b) Describe the purpose and operation of a Muller C element. (c) Sketch a transistor-level circuit for a 3-input C element in CMOS, including an inverted output. (d) Consider the design of a one-bit full-adder in asynchronous dual-rail logic. There will be three input pairs: (P0, P1), (Q0, Q1) and (R0, R1), and two output pairs: (S0, S1) for the high-order bit of the sum and (T0, T1) for the low-order bit. All inputs should become valid before any outputs become valid, and then all the outputs should remain valid until all the inputs are clear again. Sketch a circuit diagram for the adder using inverters, NAND gates, NOR gates and C elements.
tackle all questions
(a) Consider a general birth-death process with birth rate i and death rate i in state i (i = 0, 1, 2, . . .). What are the detailed balance equations for this process? (b) Derive the steady-state distribution for the general birth-death process considered in part (a). What are the conditions for the steady-state distribution to exist? [4 marks] (c) Describe the M/M/1 queue and give a stochastic model for the number of customers present. Find the steady-state distribution for the number of customers present and state the condition for it to exist. [4 marks] (d) Derive the mean number of customers present in steady state in the M/M/1 queue. (e) State Little's law and use it to derive the mean time spent in the M/M/1 queue in the steady state. (f ) Discuss what is meant by the traffic intensity for an M/M/1 and explain what happens to the mean number of customers present as the traffic intensity increases towards one.
address all questions
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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