bv Computer Vision (jgd1000) (a) Neural receptive fields used in…

Question Answered step-by-step bv Computer Vision (jgd1000) (a) Neural receptive fields used in… bv Computer Vision (jgd1000) (a) Neural receptive fields used in early stages of vision can be regarded as linear integro-differential operators of the first- and second-orders, represented by the elongated ovals within the diagram below. Explain how they can be used for oriented edge detection, and also state the basis for a Fourier interpretation of them as anisotropic bandpass filters. Explain how combining their outputs by the nonlinear operations depicted in the rest of this diagram (sum-of-squares, and response ratio) can be used for higher-level feature detection. [8 marks] 2D Gabor Phasor Modules  Projected Image I( x, y) . . . . . . (b) In self-driving cars, the following acronyms are names for automated vision systems. Define them and briefly describe how they work. (i) LIDAR [3 marks] (ii) SLAM [3 marks] (c) Discuss the use of texture gradients as a depth cue in computer vision. How can texture gradients be measured? What prior assumptions are needed to make computations about depth and shape possible? You may find it helpful to refer to the following texture examples. [6 marks] 8a. Structure from texture I Most surfaces are covered with texture, of one sort or another I Texture is both an identifying feature, and a cue to surface shape I If one can assume uniform statistics along the surface itself, then textural foreshortening or stretching reveals 3D surface shape I As implied by its root, linking it with (woven) textiles, texture is defined by the existence of statistical correlations across the image I From grasslands to textiles, the unifying notion is quasi-periodicity I Variations from uniform period, the guarded command executes as one of the commands ci whose associated guard bi evaluates to true. The execution of the command abort does not yield a final state from any initial state. The command if gc fi executes as the guarded command gc, if gc does not fail, otherwise, it acts like abort. The command do gc od executes repeatedly as the guarded command gc, while gc continues not to fail, and terminates wheys terminate, and that the rules for their evaluation are given. Write down a collection of rules for an inductively defined evaluation relation of the form c, S ⇒ S 0 whose sense is “starting from the initial state S, the evaluation of the command c terminates at the final state S 0 .” [10 marks] (b) Give the commands in Dijkstra’s guarded language which simulate the standard imperative programming commands if b then c1 else c2 and while b do c respectively. You may assume that if b is a boolean expression, then so is ¬b, the negation of b. [2 marks] (c) Give an appropriate definition of semantic equivalence of commands with respect to the evaluation relation defined in (a). Prove that for any boolean expression b and any command c, the command do b → c [] b → c od is semantically equivalent to the command if b → (c; do b → c [] b → c od) [] ¬b → skip fi [8 marks] 7 [TURN OVER CST.94.7.8 14 Concurrency Define what is meant by observational equivalence of CCS agents. [5 marks] A transmitter T, transmission medium M, and receiver R are modelled by CCS agents with the following definitions: T def = in.i.T0 T 0 def = r.i.T0 + a.T M def = i.M0 M0 def = o.M + τ.r.M R def = o.out.a.R M is an unreliable medium: having received an input message from T (action i) it either outputs the message to R (action o), or loses it (represented by the τ action) and then sends a request for retransmission (action r). If R does receive the message, after broadcasting it (action out) it sends an acknowledgement directly to T (action a). Calculate the transition graph of (T|M|R) {i, o, r, a} and hence show that this agent is observationally equivalent to a simple buffer B with definition B def = in.out.B [10 marks] Are (T|M|R) {i, o, r, a} and B observationally congruent? [3 marks] Do the two agents have the same behaviour with respect to divergence, that is, the ability to perform a series of actions ending in an infinite sequence of τ -actions? (a) Briefly describe the update operations supported by a priority queue.[2 marks](b) Explain the data structure known as a heap and describe how a heap can beimplemented using a simple linear block of memory. [2 marks](c) Describe, and estimate the costs of, procedures to(i) find the parent and offspring of a given node; [2 marks](ii) insert a new item into an existing heap; [2 marks](iii) delete the topmost item from a non-empty heap. [2 marks]SECTION B5 Foundations of Computer Science(a) Describe how lazy lists, which have possibly infinite length, can beimplemented in ML. Illustrate your answer by presenting a function thataccepts one (or more) lazy lists and produces another lazy list. [6 marks](b) A lazy binary tree either is empty or is a branch containing a label and two lazybinary trees, possibly to infinite depth. Present an ML datatype to representlazy binary trees. [2 marks](c) Present an ML function that produces a lazy binary tree whose labels includeall the integers, including the negative integers. [3 marks](d) Present an ML function that accepts a lazy binary tree and produces a lazylist that contains all of the tree’s labels. [9 marks]All ML code must be explained clearly.3 (TURN OVER)CST.2008.1.46 Foundations of Computer ScienceA puzzle, or one-person game, can be represented in ML by two functions:• a next-state function, which maps a state to a list of possible next states, and• a wins function, which returns true if the given state counts as a win.A simple example is a puzzle that has states consisting of positive integers, a nextstate function that maps n to [n+ 2, n+ 5], and a “wins” function that returns trueif n = 10. We can win if we start from n = 2 but not from n = 7.(a) Code a polymorphic datatype ‘a puzzle, to represent a puzzle by the pair ofa next-state function and a wins function. [2 marks](b) Briefly contrast depth-first search, breadth-first search and iterative deepeningas techniques for solving such puzzles. [6 marks](c) Write a function depth that accepts a puzzle, a state and a depth limit. Itshould use depth-first search to determine whether the puzzle can be solvedfrom the given state within the given depth limit. [6 marks](d) Write a function breadth that accepts a puzzle and a state. It should usebreadth-first search to determine whether the puzzle can be solved from thegiven state. [6 marks]All code must be explained clearly. You may assume that any necessary ML datastructures or functions are available.4CST.2008.1.5SECTION C7 Operating Systems(a) What is file metadata? [2 marks](b) Explain with the aid of a diagram how file metadata is managed in:(i) the Unix file-system; [4 marks](ii) the FAT32 file-system; [4 marks](iii) the NTFS file-system. [4 marks](c) A researcher suggests using non-volatile flash memory to store the NTFS logfile. He believes this will improve performance, reduce power consumption andmake the system more resilient to failure. Is he right? Briefly justify youranswer in each case. [2 marks each]8 Operating Systems(a) In general we can consider a process to move between five process states duringits existence. Discuss, with the aid of a diagram, the circumstances in whicha process will enter or leave each of these states. [6 marks](b) Both Unix and Windows NT use dynamic priority scheduling. Compare andcontrast their scheduling algorithms, with a particular focus on how dynamicpriorities are managed. [8 marks](c) Which data structures would you use if implementing a dynamic priorityscheduling algorithm? Justify your answer. [2 marks](d) Some industry predictions suggest that in less than five years we shall havechips with hundreds or even thousands of CPUs on them. What kinds ofscheduling algorithms do you think will be appropriate for such systems? Whatproblems do you foresee? [4 marks]5 (TURN OVER)CST.2008.1.6SECTION D9 Programming in Java(a) Show how you would create a Java array of 1000 integer values. [1 mark](b) The values in an array could be used to represent digits in the decimalrepresentation of a number. For example, the number 17has decimalrepresentation 0.142857 . . . and that could be stored in an array whose elementsstarted {1, 4, 2, . . .}. For a number stored that way write code that multipliesthe number by a given integer, returning the whole number part of the resultand leaving the array updated to hold the fractional part of the product.[5 marks](c) To convert a fraction to a representation base 16 (i.e. hexadecimal) you canmultiply it by 16, and the resulting integer part is the first digit of the base-16representation. Multiplying the fraction left over by 16 gets the second digitand so on. Write a method that accepts an array of digits (base 10) and createsand returns a new array representing the same fraction but now base 16. Yourcode should work for any length input array, not just one of length 1000, andyou may make the output array have the same length as your input array.[6 marks](d) Suppose the input to your method in part (c) was of length 1000 and startedoff with the decimal digits of 17in it. Although the initial digits in the outputarray are the correct hexadecimal representation of 17the last few end uplooking odd. Explain. [3 marks](e) One way to ensure that numerical results are correct is to use intervalarithmetic. A value is represented as a pair of arrays, one representing anumber less than (or equal to) the true value and one a value greater thanit. So if using 6 decimal places the number 17would be held as a pair{142857, 142858}. If the two final digits differ by at most 1 then the smallerof them can be viewed as fully accurate. Using this idea, write code thataccepts a fraction in decimal form and returns a vector denoting the samevalue in another base n (now no longer necessarily 16) such that all the digitsin the result vector are correct. Clarity in your code is to be preferred toperformance, but if you are aware of particular ways in which the code youpresent is particularly inefficient, you should note and explain them.[5 marks]6CST.2008.1.710 Programming in JavaThe following is one of the examples from the Foundations of Computer Sciencecourse:exception Change;fun change (till, 0) = []| change ([], amt) = raise Change| change (c::till, amt) =if amt<0 then raise Changeelse (c :: change(c::till, amt-c))handle Change => change(till, amt);(a) Define a Java class of your own (i.e. do not use any library class that you maybe aware of) to represent linked lists of integers. Provide it with methods thatcan be used to reverse a list and to append two lists. Comment on whetheryour design has led you to make the methods for append and reverse static.[7 marks](b) Prepare a method called change that works in the same way as the ML codeshown above. Provide the class that you define it in with a main method thatuses it to try to make change for 73p using 2p, 5p and 20p coins, printing theresult neatly. [7 marks](c) If you have lists of non-zero integers such that all the values in them are lessthan 256 and you have at most 8 items in any list you can pack eight 8-bitfields into a single 64-bit “long”. That gives a representation that some peoplemight expect to be faster than using lists represented by chained up instancesof a class. Re-work your change-giving code based on the above idea, andmodelling the use of exceptions by making the change function return -1L inthe exceptional case.With reference to the 5-stage pipeline, what are data hazards and how can they be resolved to ensure that the programmer’s model of sequential execution is always preserved whilst minimising performance impact? [6 marks] (ii) With reference to the 5-stage pipeline, what are control hazards and how can they be resolved? [4 marks] (b) If we wanted the above pipeline to mimic two processors running at half the speed, then we could have two copies (A and B) of the register state and keep the existing pipeline. The instruction-fetch stage would alternate between fetching from threads A and B on alternate clock cycles. As a consequence, if instruction fetch was from thread B, then an instruction from thread A would be in decode, B in execute, A in memory access and B in write back. (i) For this dual-threaded processor, if branches are performed in the decode stage, does the pipeline exhibit a branch delay slot? [5 marks] (ii) How can the resolution of data hazards be simplified for this dual-threaded processor? [5 marks] 3 (TURN OVER) CST.2008.5.4 3 Digital Communication I (a) Describe five physical properties of a communications channel. [5 marks] (b) Consider the figure below. Entities N and N0 use an ARQ system. Channel – 1 Channel Channel + 1 Entity – 1 Entity Entity + 1 Entity – 1 Entity Entity + 1 n n n N N N N’ N’ N’ (i) Explain how the latency of channel n − 1 can have a direct effect on the capacity of channel n. [6 marks] (ii) Define windowing as it relates to an ARQ system and describe how the capacity of the ARQ system may be improved through its use. [4 marks] (iii) If an ARQ system is used for an interactive session, the ARQ system can lead to many small packets, each under-full and perhaps sent with significant overhead. Design and describe an algorithm that overcomes the limitation of sending many mostly-empty packets for an interactive session. [5 marks] 4 CST.2008.5.5 4 Concurrent Systems and Applications (a) A web server is an application that listens for incoming network connections on TCP port 80. Once a connection is established, the task of processing client requests and sending replies can be handled by an instance of a Worker class which you may assume already exists. Worker implements the java.lang.Runnable interface and has an accessible constructor that takes as argument a java.net.Socket object representing the network connection to a client. Provide the Java code for a webserver which, upon start-up, attempts to listen on TCP port 80 and starts a new Thread running a new Worker for every connection. Your program should print helpful error messages indicating the likely cause of problems when it is unable to proceed as expected. [10 marks] (b) A busy web server might expect to handle concurrent requests to read and update some shared data and could use Timestamp Ordering (TSO) to enforce isolation between concurrent transactions. (i) Explain how TSO enforces isolation. [5 marks] (ii) Is TSO appropriate for a web server application? Explain your reasoning. [5 marks] 5 (TURN OVER) CST.2008.5.6 SECTION B 5 Computer Graphics and Image Processing (a) Describe in detail an algorithm that returns the minimum distance from a point to a line segment in two dimensions. Ensure that you include all of your assumptions and all necessary mathematical calculations. [7 marks] (b) A quadratic Be´zier curve is defined by three points, P1, P2, P3, and a parameter, t: P(t) = (1 − t) 2 P1 + 2t(1 − t)P2 + t 2 P3, 0 ≤ t ≤ 1 Describe an algorithm that draws the quadratic Be´zier curve, using straight lines only, to within a tolerance τ . You may use the algorithm from part (a) and you may assume that you already have an algorithm for drawing a straight line. [8 marks] (c) Consider the control of detail in a curve that is represented by a sequence of many straight line segments. Describe how Douglas and P¨ucker’s algorithm can be used to remove superfluous points. You may use the algorithm from part (a). [5 marks] 6 CST.2008.5.7 6 Compiler Construction Consider the following grammar for expressions (where Id is a terminal symbol representing an identifier resulting from lexical analysis): Expr ::= 1 | 2 | Id | Expr + Expr | Expr / Expr | Expr ^ Expr | (Expr) (a) Explain in what principal respect this grammar is unsatisfactory. [1 mark] (b) Assuming further that + is to be left-associative, ^ is to be right-associative and / is to be non-associative (i.e. 2/2/2 is forbidden but (2/2)/2 and 2/(2/2) are allowed), re-write the grammar to reflect this. [4 marks] (c) List the terminal symbols and non-terminal symbols, and count the production rules both in the original grammar and in the grammar in your answer to part (b). Indicate the start symbol in both grammars. [2 marks] (d) Define a type or types (in C, Java, or ML) suitable for holding an abstract syntax tree resulting from your answer to part (b). [2 marks] (e) Give a brief and elementary explanation of the principles of how the grammar resulting from part (b) might be used to create a syntax analyser taking a token stream as input (via calls to function lex()) and giving as output an abstract syntax tree corresponding to part (d). Mention both hand-written and automatically-generated syntax analysers. [8 marks] (f ) Summarise any issues related to left- or right-associative operators in the two techniques (in implementing the parser and in constructing the tool) you outlined in part (e). [3 marks] 7 (TURN OVER) CST.2008.5.8 7 Concepts in Programming Languages (a) Write a procedure and a call to it in block-structured pseudocode such that the execution of the procedure under pass-by-reference and under pass-by-value/result yields different outcomes. Justify your answer. [7 marks] (b) Explain the meaning of static (i.e. compile-time) and dynamic (i.e. run-time) type checking. Compare the advantages and disadvantages of these two approaches to type checking from the point of view of the language designer, the language implementer, and the programmer. [6 marks] (c) Explain how objects can be simulated in SML, giving an example. Does it follow that SML, together with its module system, is an object-oriented programming language? Why? [7 marks] 8 Databases (a) What is the difference between a key and a functional dependency? [3 marks] (b) The schema R(A, B, C, D, E) has the following functional dependencies. A, B → C B, C → D C, D → E D, E → A (i) What are all of the keys of R? [3 marks] (ii) Which functional dependencies violate Boyce-Codd Normal form (BCNF)? [3 marks] (iii) Which functional dependencies violate Third Normal form (3NF)? [3 marks] (iv) Find a lossless-join decomposition of R into BCNF relations. [8 marks] 8 CST.2008.5.9 SECTION C 9 Foundations of Functional Programming (a) Define the translation of the call-by-name λ-calculus into continuation passing style. [9 marks] (b) How does the translation differ for the call-by-value λ-calculus? [2 marks] (c) Now consider extending the call-by-name λ-calculus with exceptions: M ::== try M catch M | raise | λx. M | M M | x where it reduces in the following way: try raise catch M → M try λx.M1 catch M2 → λx.M1 raise M → raise Show how to translate this language into pure λ-calculus using continuations. [Hint: Use two continuations: one for the exceptional case, and one for the normal case.]  Computer Science Engineering & Technology Software engineering COMPUTER S 211 Share QuestionEmailCopy link Comments (0)