Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following is a shortened version of one of the definition modules described in the Modula-2 user manual: DEFINITION MODULE Processes; TYPE Semaphore; Procedure InitSemaphore

The following is a shortened version of one of the definition modules described in the Modula-2 user manual: DEFINITION MODULE Processes; TYPE Semaphore; Procedure InitSemaphore (VAR a:Semaphore); Procedure Signal (s:Semaphore); Procedure Wait (s:Semaphore); . . END Processes. Provide a suitable specification forf type Semaphore as it might appear in the associated implementation module. [5 marks] Write a fragment of Modula-2 code which uses a variable of type Semaphore and exploits the three procedures given above. Explain what the code does when each of the three procedures is invoked. [10 marks] 1 [TURN OVER CST.93.10.2 2 Modula-2 What is a Modula-2 union? [3 marks] A Modula-2 program includes the following declarations: TYPE SymbType = (plus, minus, multiply, divide); NodeType = (NumNode, OpNode); NumType = RECORD val : CARDINAL END; PtrToNode = POINTER TO Node; OpType = RECORD op : SymbType; f, s : PtrToNode END; The objective is to be able to include assignment statements like: test := MakeOpNode (multiply, MakeNumNode(4), MakeOpNode (minus, MakeNumNode(7), MakeNumNode(2))); he example assignment statement is to assign to test a syntax tree which represents the expression 4*(7-2). Provide a suitable declaration for type Node. [5 marks] Write the procedures MakeNumNode and MakeOpNode. [6 marks each] 2 CST.93.10.3 3 Common Lisp Consider trees that have two kinds of nodes. A node is either a leaf, labelled by a number, or a branch, and has one or more subtrees. For example: 3 9 1 8 7 2 5 One imagines that the edges from each branch node are numbered from left to right starting from 0. A list of these numbers thus designates the path from the root to a node. In the tree shown above, the path (2 1 1) designates the path to the node labelled 2. (a) Describe a good representation for such trees in Lisp. [3 marks] (b) Write a Lisp function getnode such that (getnode path tree) returns the node of tree designated by path, assuming that the tree contains such a node. [5 marks] (c) Write a Lisp function maxpath such that (maxpath tree) returns the maximum of the leaf nodes in the tree, together with the path to that node. For the tree shown above, maxpath should return 9 as the maximum and (0 1) as the path. [12 marks] 4 Programming Language Compilation Discuss the merits of translating the abstract syntax tree representation of a program into assembly language by means of (a) an ad hoc recursive tree walking program [10 marks] (b) an algorithm based on tables automatically generated from tree translation rules [10 marks] 5 Operating Systems Contrast UNIX pipes with a general, asynchronous message-passing facility as a basis for inter-process communication between processes which run in separate address spaces. [20 marks] 3 [TURN OVER CST.93.10.4 6 Operating System Functions Describe the functionality you would expect to find in the file system directory service of a multi-user operating system. [10 marks] Describe two ways in which multiple names for the same file can be supported, and what problems arise as a result.

You have to discover p, an eight-individual password, every person having been selected uniformly at random from a regarded alphabet of sixty four ASCII characters. In the weeks preparing for the opposition, you have got access to a small cluster of GPU photographs playing cards that can evaluate MD5 109 times consistent with 2d. During the competition, you have got only get admission to to a computer pc that may examine MD5 106 instances in line with 2d. Without any pre-computation, how long would it take to evaluate MD5 for all possible passwords p in a brute-pressure assault (i) at the laptop? [2 marks] (ii) at the GPU cluster? [2 marks] You determine to use the GPU cluster to pre-compute a rainbow desk for this undertaking. (iii) What functions aside from MD5 will the GPU cluster ought to evaluate as regularly as MD5 when building the rainbow table? [3 marks] (iv) Your laptop has sufficient RAM for storing the rainbow table as a hash desk of 232 key-value pairs (x, y) with x, y 0, 1 128. If you execute MD5 250 instances even as generating your rainbow table, how lengthy will your computer need (worst case) to discover a password p stored in it, given its MD5 hash value MD5(p)? Assume that the runtime is completely dominated with the aid of the MD5 opinions

(a) (i) Describe the difference between relevance remarks and question growth in phrases of person interplay. [2 marks] (ii) Explain what we mean by means of equivalence classing of phrases and why it is beneficial. Give one instance of equivalence classing that may fail to retrieve the right files. [2 marks] (iii) Give an example of how uneven growth of query terms can usefully version customers' expectations. Is uneven expansion of question phrases greater or much less green than equivalence classing? Justify your solution. [2 marks] (iv) How would you compare an Information Retrieval challenge for which there is high tolerance for left out applicable facts gadgets? How would possibly you modify the F degree for this kind of undertaking? Justify your answer. [3 marks] (b) (i) Given the query "elvis music" and the following term frequencies for the 3 files doc1, doc2 and doc3 : elvis presley mississippi pop tune life doc1 3 four zero 6 0 0 doc2 4 zero four zero zero 3 doc3 five 3 zero four four 0 calculate the cosine similarity between the question and every file (you can ignore the idf term) for you to rank those files so as of relevance. Show your workings. [2 marks] (ii) The Rocchio algorithm is a classic algorithm for imposing relevance remarks. Use Rocchio to compute the brand new query vector for "elvis track" the use of doc3 for relevance comments (i.E., doc3 has been marked as applicable). Give suitable values for Rocchio's weight parameters. As above, calculate cosine similarity (you could forget about the idf term) so one can rank the documents in order of relevance. Show your workings. [4 marks] (iii) In Rocchio's set of rules, advantageous feedback is typically greater beneficial than negative comments. Give two example cases of terrible files being fed lower back which could decrease the retrieval effectiveness of the Rocchio re-formulated query. Propose one way in which you could incorporate negative remarks greater correctly, and explain why this facilitates with the two examples you provided. Motivate your answer. [5 marks] 8 CST2.2018.8.Nine 8 Machine Learning and Bayesian Inference Evil Robot has determined to emerge as a playing cheat. He has a biased coin with Pr(head) = p and two dice. The first die is biased with Pr(n) = pn for the nth final results with n 1, 2, three, 4, five, 6. The 2d die is also biased, and has exclusive numbers: its distribution is Pr(n) = qn with n 4, 5, 6, 7, eight, 9. Evil Robot flips the coin. If he gets a head then he rolls the first die, in any other case he rolls the second one. He then tells you the final results. You see handiest the quantity received and nothing else. He does this m times, so you look at a sequence of m numbers in the range 1 to 9. Your aim is to estimate p and the distributions of every die, given the m numbers. In the subsequent, n is the vector of m determined numbers (n1 nm) T , is the set of parameters p, p1, . . . , p6, q4, . . . , q9 and we define q = 1 p. (a) Write down an expression for the distribution Pr(nwherein n 1, . . . , nine. [2 marks

This query deals with stochastic techniques N(t), t 0 wherein N(t) represents the wide variety of events in the time c language [0, t]. (a) (i) Define a Poisson technique N(t), t 0 of charge > 0. [2 marks] (ii) Show that N(t) Pois(t) for each constant t > zero. You can also use the end result that limn(1 x/n) n = e x with out proof. [4 marks] (iii) Let X1 be the time of the first occasion of the Poisson manner N(t). Show that X1 Exp(). (iv) Now given that N(t) = 1 derive the distribution of the time of the unmarried event in [0, t]. [4 marks] (b) Suppose that events of a Poisson method of charge are independently selected at random with probability p > zero. Show that the system of decided on occasions is likewise a Poisson procedure and set up its fee. [2 marks] (c) Describe how your result from part (b) may be used to simulate a nonhomogeneous Poisson method whose charge function (t) is such that (t) for all t zero. [6 marks] 4 CST2.2018.8.5 4 Computer Vision (a) Explain how every of the following equations or expressions can be used for detecting and estimating visual motion in a spatio-temporal picture collection I(x, y, t). Include for your solution the call used to explain each of those general classes of motion extraction fashions: (i) I(x, y, t) t = v I(x, y, t)

(a) A processor's most important memory is commonly carried out the use of DRAM. (i) Describe an average DRAM cellular. [2 marks] (ii) Show, with the aid of a diagram, how DRAM is organised, making reference to devices, ranks, banks and arrays. [4 marks] (iii) Describe the difference among an open-page and closed-page row-buffer policy and the styles of get entry to patterns they gain. [2 marks] (b) The MOSI cache coherence protocol provides a brand new owned (O) kingdom to the basic MSI protocol.When a cache preserving a line in M kingdom snoops a study request from another cache, it transitions to O kingdom and forwards the data to the requestor. Subsequent snoops for study requests are also fulfilled by means of this owner cache. An owned line is dirty and most effective one cache can preserve a line in O kingdom at any time. (i) Describe the distinction among cache coherence and memory consistency. [2 marks] (ii) Draw a country transition diagram for the MOSI protocol, the usage of a brand new motion Forward to suggest statistics being forwarded from one cache to every other. [6 marks] (iii) Draw a desk displaying how the nation of a line in one cache limits the states the equal line will have in a one of a kind cache. [2 marks] (iv) Give two benefits of adding this more owned country to the primary MSI protocol.

Forward to signify statistics being forwarded from one cache to another. [6 marks] (iii) Draw a table showing how the nation of a line in a single cache limits the states the identical line may have in a exclusive cache. [2 marks] (iv) Give two advantages of including this extra owned country to the basic MSI protocol.

(a) At the lowest level, what is the number one client of electrical energy in digital good judgment nowadays? Give a method for the anticipated electricity or power use for a CMOS gate. [2 marks] (b) A matrix (a 2-dimensional array) is saved on-chip in static RAM. What most important factors contribute to the time and energy had to transpose it? [4 marks] (c) Assume now a square matrix is to be held in DRAM. (i) When would possibly it's useful to shop multiple-copies of a given matrix in different DRAM banks? [1 mark] (ii) When would possibly it be helpful to shop a couple of-copies of the matrix (or any other example facts shape) in one DRAM bank? [2 marks] (iii) One way to avoid transposing a matrix is simply to hold an annotation that it's been transposed and to then change over the row and column arguments for every operation. Why would possibly physically acting the transpose in the long run advantage overall performance? Where would the annotation be held? [2 marks] (d) A computation operates on square matrices of length 105 one zero five . The inner loop, to be increased in hardware, has the following basic structure: for (int i= ...) for (int j= ...)

DD[i, j] = ff(SS[i-1, j], SS[i, j-1])

(i) Are there any loop-carried dependencies? What does this imply for overall performance optimisation? [1 mark] (ii) If the DRAM timings are eleven-11-eleven, that means row activation, column activation and writeback each take eleven clock cycles, estimate kind of the minimal time for a naive implementation of the computation. Assume a simple linear data layout. State all similarly assumptions. [6 marks] (iii) What determines whether or not it's miles possible or an awesome concept to carry out the operation 'in area' (ie. The use of the same reminiscence for DD and SS)?

. Write program to examine facts the usage of CL check in and test whether or not it's superb or negative. A java program that takes both n (as input) and n integer inputs and upload the given values to a described array. (a) Give typing regulations for the introduction form %(, M) and elimination shape unpack M as (x, ) in N of the existential kind ( ). [4 marks] (b) An countless move of booleans can be represented within the polymorphic lambda calculus using the existential kind stream , ( ( (bool ))) (i) Using the encoding above, outline a function head : circulation bool. [3 marks] (ii) Using the encoding above, outline a feature tail : circulate stream. [3 marks] (iii) Using the encoding above, define a feature spread : ( ( (bool )) stream) [11:50 PM, 4/26/2022] .: Describe the state-variable representation for planning by way of discussing the following, giving specific examples of each concept: (i) Rigid members of the family and kingdom variables. [2 marks] (ii) Actions. [2 marks] (iii) The illustration of state. [2 marks] (iv) Goals and solutions. [2 marks] (b) Your boss has recommended the usage of heuristic seek to clear up a making plans trouble expressed in the country-variable representation. Explain how this is probably achieved. You do not need to signify a particular heuristic at this degree. [3 marks] (c) Comment on whether or no longer heuristic seek is a superb approach to solving making plans issues within the state-variable representation, as compared with the opportunity of the use of a constraint satisfaction solver. [5 marks] (d) Suggest an admissible heuristic that would be used when applying A? Seek to fixing a planning hassle inside the kingdom-variable representation. Show that it's miles admissible. [4 marks] three (TURN OVER) CST1.2019.6.Four 3 Complexity Theory A Boolean formula is said to be satisfiable if there is an challenge : V proper, false of values to the variables of that makes it authentic. A quantified Boolean method is an expression that is (i) both a Boolean formula; or (ii) X in which is a quantified Boolean method and X is variable; or (iii) X in which is a quantified Boolean system and X is variable. We say that a quantified Boolean formula is glad by using an assignment : V real, fake if either is a Boolean formula this is made proper via ; or is X and both [X/true] or [X/false] make authentic; or is X and each [X/true] and [X/false] make genuine. Here, [X/v] denotes the undertaking that is similar to for all variables apart from X, and it maps X to the reality price v. We write QBF for the decision problem of figuring out whether or not a given quantified Boolean formulation is satisfiable. In answering the questions underneath, you could expect the NP-completeness of any general trouble, as long as you kingdom your assumptions definitely. 33

Skip Question

Do you want to answer this question

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Technology Project Management

Authors: Kathy Schwalbe

6th Edition

978-111122175, 1133172393, 9780324786927, 1111221758, 9781133172390, 324786921, 978-1133153726

More Books

Students also viewed these General Management questions

Question

=+1. Articulate what a stakeholder view of a firm is

Answered: 1 week ago