Networking cores. Comparative Programming Languages (a) Briefly…Networking cores.Comparative Programming Languages (a) Briefly describe the concept of coroutines as provided in BCPL, and outline the effect of the library functions createco(f, size), deleteco(cptr), callco(cptr, val), and cowait(val). [6 marks] (b) Discuss the relative merits of BCPL coroutines versus those of threads such as provided in Java. [6 marks] (c) Outline the overall design and organisation of a BCPL program to perform discrete event simulation using coroutines to implement the simulated activities. Concentrate on the design of the simulation event loop, the organisation of the priority queue and what functions you would provide to simplify the implementation of the activities. It would probably be sensible to adopt a programming style similar to that used in Simula 67. You should hold simulated time as a global (integer) variable. [8 marks] 4 CST.2004.11.5 6 Operating System Foundations Two operating systems OS-A and OS-B offer only synchronous system calls, for example, for I/O. In addition, OS-A supports only one process per user-level address-space whereas OS-B supports multi-threaded applications. (a) (i) Explain how an application-level runtime system or library running on OS-A can provide the user threads needed by concurrent programs. [8 marks] (ii) Discuss any disadvantages of supporting a concurrent programming language in this way. [3 marks] (iii) Are there any advantages of having only user threads? [1 mark] (b) (i) Explain the differences from the runtime described for OS-A of a runtime for OS-B which maps user threads to kernel threads. [5 marks] (ii) Are the disadvantages you discussed in part (a)(ii) overcome? Explain. [2 marks] (iii) Have any problems been introduced by the use of kernel threads? [1 mark] 5 [TURN OVER CST.2004.11.6 7 Continuous Mathematics For non-negative integers r and s we have the orthogonality properties Z 2p 0 cos(rx) cos(sx)dx = 2p if r = s = 0 pdrs otherwise Z 2p 0 sin(rx) sin(sx)dx = 0 if r = s = 0 pdrs otherwise Z 2p 0 sin(rx) cos(sx)dx = 0 ? r, s where drs = 1 if r = s 0 otherwise . (a) Derive expressions for the Fourier coefficients a0, an, bn (n = 1, 2, . . .) such that the infinite series a0 2 + X8 n=1 (an cos(nx) + bn sin(nx)) is the Fourier series for the function f(x) in an interval of length 2p. [6 marks] (b) For any fixed integer N = 1 let SN (x) = a0 2 + N X-1 n=1 (an cos(nx) + bn sin(nx)) be the Fourier series for f(x) truncated to the first N terms and let S 0 N (x) = a 0 0 2 + N X-1 n=1 (a 0 n cos(nx) + b 0 n sin(nx)) be any other Fourier series truncated to the first N terms. Show that Z 2p 0 (f(x) – SN (x)) (SN (x) – S 0 N (x)) dx = 0 . [8 marks] (c) Given the function f(x) show that Z 2p 0 (f(x) – S 0 N (x))2 dx is minimised by the unique choice a 0 0 = a0, a 0 n = an, b 0 n = bn (n = 1, 2, . . .), that is, the Fourier series gives the best approximation to f(x) using N terms in the sense of minimising the mean-squared error. [6 marks] 6 CST.2004.11.7 8 Numerical Analysis I (a) 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, 8, by summing only the first N terms and estimating the remainder by integration. [5 marks] (b) Assuming that f 00(x) is a positive decreasing function, derive an estimate of the error |EN | in the method. [5 marks] (c) Given Z dx (1 + x) v x = 2 tan-1 v x illustrate the method by applying it to X8 n=1 1 (1 + n) v n . Verify that f 00(x) is positive decreasing for large x, and estimate the integral remainder to be added to S1,N . [6 marks] (d) How large should N be to achieve an absolute error of approximately 2×10-15? [You may assume N + 1 ‘ N for this purpose.] [4 marks] 7 Mathematics for Computation Theory (a) Prove Arden’s Rule for events, that X = A*B is the least solution of the inequality X > B + AX. [6 marks] (b) Let M = A B C D be a (2 × 2) event matrix. Show that the matrix Y = (A + BD*C)* A*B(D + CA*B)* D*C(A + BD*C)* (D + CA*B)* satisfies the equation Y = I + MY . [4 marks] (c) The deterministic finite automaton M has a 2-symbol alphabet {a, b}, and a single accepting state a, the initial state. The transition diagram is as follows: b a a a b b a ß ? Show that the event accepted by M can be denoted by the regular expression [a*b(a a*b)*b]* [10 marks] 8 CST.2004.11.9 10 Computation Theory (a) Explain what is meant by the following statements: (i) f : N ? N is a total recursive (TR) function; [3 marks] (ii) the sequence {fn : N ? N}n?N of TR functions of a single variable is recursively enumerable. [4 marks]Discuss how neural operators which encode, analyse and represent image structurein natural visual systems can be implemented in artificial neural networks. Includefour of the following issues in your discussion: receptive field structure adaptiveness and perceptual learning hierarchies of tuning variables in successive layers of the visual pathway wavelet codes for extracting pattern information in highly compressed form self-similarity of weighting functions associative memory or content-addressable memory for recognizing patternssuch as faces and eliciting appropriate response sequences[20 marks]9 SecurityWrite brief notes on each of the following:(a) the Internet Worm(b) Trojan horses(c) polymorphic viruses(d) virus exploitation of covert channels(e) the distinguishing characteristics of viruses written in interpreted languages Discuss two possible strategies that you might use to translate the abstract syntaxtree corresponding to an integer expression composed of simple variables, integerconstants and the usual integer operators +, -, * and / into reasonable qualitycode for a machine with eight general-purpose registers.You should pay particular attention to how you would control the allocation ofregisters and anonymous store locations, and you should outline what optimizationsare convenient to perform. [20 marks]7 Artificial Intelligence IIExplain how genetic algorithms differ from conventional mathematical methods foroptimization. [10 marks]What are the advantages and disadvantages of genetic algorithms? [10 marks]Describe how a data model is represented in a relational database, and explain howone might specify a relational database schema. [5 marks]What is meant by a referential integrity constraint in a relational database?[3 marks]Each year the number of tourists coming to Cambridge increases by 10%. Mostof the pressure falls on a limited number of identified sites in the city centre. TheTourist Board has restricted the size of any group visiting such a site to 20, andrequires a group of ten people or more to get a permit in advance. Most bookingsare made either by tour operators or directly by independent guides: the TouristBoard will arrange guides for groups if asked to do so.A database is being installed to coordinate bookings and to provide informationabout the opening times of sites. Each site has separate opening times for summerand winter (owing to college autonomy, changes of season differ from site to site).Permits are issued to start on the hour or on the half-hour: they are valid eitherfor 1 hour or for 2 hours, the duration being fixed for each site. The final permitsof each day are timed to expire at the site’s closing time. Each site has a fixedcapacity, and no booking can be accepted that would cause it to be exceeded. Thecharge for a permit depends only on the site and the season. (Occasionally sitesare closed for several hours during the normal opening period, for example whenrecording is taking place in King’s College Chapel. The protocol is to inform theTourist Board at least 6 months in advance.)The Tourist Board issues permits to visit an identified site at a given time on agiven day, specifying the booking agent and the number in the group. Bookingscan be made up to 6 months beforehand. Permits are issued to registered touroperators and guides on account, but in all other cases payment must be made inadvance. The data held for registered guides includes not only account details butalso their working hours and charges.Design a schema for the relational database that is to record this information forthe Tourist Board. You may find it helpful to use domain types DATE, TIME andMONEY in addition to standard programming language datatypes. You do not needto specify the transactions that maintain the database, but you should state clearlyany assumptions that influence the schema design. [12 marks]3 [TURN OVERCST.94.13.49 Specification and Verification of HardwareDiscuss the problems of providing tractable models of transistors suitable forhardware verification by formal proof. Compare and contrast at least two differentmodels. Illustrate your discussion with concrete examples of transistor circuits.[20 marks]10 ComplexityFor each of the following statements state whether the claim made is true, false orif more information is needed before a judgement can be made. Give one-sentencejustifications of your assertions.(a) Sorting a list of numbers into ascending order is an NP problem.(b) Sorting a collection of programs into order so that the ones that finish quicklycome before those that run for a long time is an NP-complete problem.(c) To be NP-complete is to be as difficult as any solvable problem can be.(d) Any NP problem can be solved (on an ordinary computer) in polynomial spaceand exponential time.(e) The problem of determining whether a k-clique is present in a graph is knownto be NP-complete. Therefore for large graphs and large values of k it willalways be impossible (in practice) to find such a clique even if it is known thatone exists.(f ) For the purposes of complexity theory each of the cost functions n log n, n1.573and n! counts as polynomial growth.[20 marks]11 Computation TheoryExplain Turing’s Thesis. [5 marks](a) What is meant by saying that a Turing machine has searching states? Showthat any Turing machine computation can be effected by a machine withsearching states, equivalent in the sense that the head movements are identicaland the same symbols are written to the tape. [5 marks](b) Show that, subject to suitable encoding, any computation can be carried outby a Turing machine having only two states. Define the types and terms of the language PCF. Describe the denotationalsemantics of PCF using domains and continuous functions. In what sense is thedenotational semantics of PCF compositional? [12 marks]Explain the soundness and adequacy properties of the denotational semantics withrespect to the operational semantics of PCF. (A definition of the PCF operationalsemantics need not be given.) [4 marks]Define the notion of contextual equivalence for PCF terms. Explain why thecompositional, soundness and adequacy properties mentioned above imply thatif two closed PCF terms of the same type have equal denotation, then they arecontextually equivalent. [4 marks]11 Information Theory and CodingThe information in continuous but bandlimited signals is quantised, in that suchcontinuous signals can be completely represented by a finite set of discrete numbers.Explain this principle in each of the following four important contexts or theorems.Be as quantitative as possible:(a) The Nyquist Sampling Theorem. [5 marks](b) Logan’s Theorem. [5 marks](c) Gabor Wavelet Logons and the Information Diagram. [5 marks](d) The Noisy Channel Coding Theorem (relation between channel bandwidthW, noise power spectral density N0, signal power P or signal-to-noise ratioP/N0W, and channel capacity C in bits/second). [5 marks]12 Computer VisionDiscuss the role of non-linear operators in vision for the extraction of motioninformation, texture information, colour information, and stereo information.What are the limitations of linear operators (such as filters) compared withnon-linear ones? What is a quadrature pair, and what is a Hilbert pair?What is a Hilbert Transform, and what is a natural way to build a usefulnon-linear operator from it? [20 marks]6CST.97.9.713 TypesGive the syntax of (types and terms of) the second-order polymorphic lambdacalculus ?2 whose five ways of constructing terms, M, are: identifiers, lambdaabstraction, application, type abstraction and type application. (The last two aresometimes known as generalisation and specialisation.) Make it clear which, if any,sub-phrases of terms represent types or type variables. [4 marks]Give a term M conforming to the syntax of ?2 which is not well-typed accordingto the usual inference rules for ?2. [2 marks]Let ?U be the untyped lambda calculus whose terms N have syntax:N ::= x | ?x.N1| N1N2.Define a function erase : ?2 ? ?U which removes all types from a ?2 term, butwhich preserves the rest of it.[Hint: erase(?a.M) = erase(M).] [3 marks]Now find (or briefly justify why this is impossible):(a) two well-typed ?2 terms M1 and M2 without free type variables such thaterase(M1) = erase(M2) = ?x.x and that M1 and M2 differ by more than typevariable renaming;(b) a well-typed ?2 term M3 such that erase(M3) = ?x.xx;(c) a well-typed ?2 term M4 such that erase(M4) = (?x.xx)(?x.xx);(d) a well-typed ?2 term M5 such that N5 = erase(M5) has no ML type;(e) a ?U term N6 which has an ML type, but such that there is no well-typed ?2term M6 with erase(M6) = N6. using c programing Write program to calculate the average of a set of students (we don’t know their count) (using functions)write program to print Hello world in C language. post screen shot after doing in computer Explain the term positive semi-definite. [1 mark]Let A be a square matrix. State Schwarz’s inequality for the product Ax. Whatare the singular values of A, and how are they related to the `2 norm of A?[4 marks]Describe briefly the singular value decomposition of the matrix A, and how it maybe used to solve the linear equations Ax = b. [4 marks]Let x be an approximate solution of Ax = b, and write r = b – Ax, e = x – x.Find an expression for the relative error kek/kxk in terms of computable quantities.Show how your formula is related to the singular values of A. [8 marks]How may this formula be used if some singular values are very small? [3 marks]15 Communicating Automata and Pi CalculusDefine the notions of sort and sorting for the p-calculus, and explain what is meantby the assertion that a process P respects a sorting. Give two reasons why sortingis useful. Simple data values can be represented as abstractions in the p-calculus. Inparticular, if True and False are abstractions representing the two truth-values,then b.True, b.False are processes in which each truth-value is located at b.Define the abstractions True and False. Also, for arbitrary processes P and Q,define the abstraction CASES(P, Q) such thatCASES(P, Q)hbi | b.True -?*PCASES(P, Q)hbi | b.False -?* Qand demonstrate these reductions. Give a sorting respected by all theseconstructions. ) A data object exists in persistent memory.(i) A single operation is invoked on it in response to a request from a client.The result of the invocation is output to the client.How can the operation be made atomic? [4 marks](ii) A client requests a high-level operation which comprises more than oneof the type operations on the data object.How can the high-level operation be made atomic? [8 marks]3 [TURN OVERCST.93.5.48 DatabasesDescribe the relational model of data. [4 marks]What is meant by a candidate key? [2 marks]Explain what it means for a relational data model to be presented in(a) Third Normal Form (3NF) [5 marks](b) Fourth Normal Form (4NF) [5 marks]in each case illustrating your answer with a suitable example data model.In what circumstances might it not be sensible to hold relational data according tothese normal forms? [4 marks]SECTION C9 Foundations of Functional ProgrammingDescribe how the ?-calculus models the operations of addition, test for zero andsuccessor, representing the natural numbers by Church numerals. [4 marks]The Fibonacci sequence is defined by F0 = 0, F1 = 1 and Fk = Fk-1 + Fk-2for k > 2. Present a ?-term fib that computes the Church numeral for Fk giventhe Church numeral for k, for all k > 0. Do not use Y or any other fixed pointcombinator. You may take as primitive the ?-calculus encodings of standard datastructures. [6 marks]Describe how to assign G¨odel numbers to ?-terms and explain the notation pMq.Describe an application of these techniques. [3 marks]Present a ?-term iszero, such thatiszeropMq =true if M = 0false if M 6= 0or prove that no such term exists. [7 marks]4CST.93.5.510 Computation TheoryShow that there is no way of deciding by algorithms whether a general registermachine program with code p will terminate when started with initial data of 0 inevery register. [10 marks]Show that there is no way of deciding by algorithm whether the blank character willbe printed during the course of a general Turing machine computation. [10 marks]Note: any standard form of the undecidability result for the general halting problemmay be assumed, but should be stated clearly.11 Complexity TheoryExplain how to measure the size of a problem in complexity theory. [3 marks]What is meant by reducing one problem to another? [4 marks]Given that the Boolean Satisfiability Problem is NP-complete, show that theHamiltonian Circuit Problem for undirected graphs is also NP-complete.[13 marks]12 Formal Languages and AutomataExplain what is meant by a regular expression over an alphabet S, and by thelanguage L(r) denoted by such a regular expression r. [5 marks]For any regular expressions r, s, t, show that if L(r) contains L(t|sr) then it alsocontains L(s*t). [5 marks]Assuming that the empty string e is not in L(s), show that if L(r) = L(t|sr) thenL(r) = L(s*t). Hint: argue by induction on the length of strings in L(r). [5 marks]Give an example to show that the above assumption e 6? L(s) is necessary.[3 marks]Deduce that when e 6? L(s), r and t|sr denote the same language if and only if r ands*t denote the same language. import java.util.Scanner; public class Client{ public static void main(String args[DX Coin quarter = new Coin(25); Coin dime = new Coin(10); Coin nickel = new Coin(5); Scanner keyboard = new Scanner(System.in); inti 0 int total = 0; whiletrue) i+ System.out.printin(“‘Round “+ i+ “: “); quarter.toss); System.outprintln(“Quarter is ” quarter.getSideUp0); while(true)X i++ System.out.println(“Round ” +i+” “); quarter.toss0; System.out.printin(“‘Quarter is ” +quarter.getsidelUp0)% if(quarter.getSideUp) == “HEADS”) total = total +quarter.getvalue0; dime.toss0: System.out.println(“Dime is” + dime.getSideUp0); if(dime.getSideUp0 == “HEADS) total = total +dime,.getvalue| nickel.toss0; System.out.printin(“‘Nickel is” + nickel.getsideUp0)% if(nickel.getSideUp) = = “HEADS”) Computer ScienceEngineering & TechnologyNetworking COMP CGS 1101

Don't use plagiarized sources. Get Your Custom Essay on

solved: Networking cores. Comparative Programming Languages (a) Briefly…

Just from $10/Page

The price is based on these factors:

Academic level

Number of pages

Urgency

Basic features

- Free title page and bibliography
- Unlimited revisions
- Plagiarism-free guarantee
- Money-back guarantee
- 24/7 support

On-demand options

- Writer’s samples
- Part-by-part delivery
- Overnight delivery
- Copies of used sources
- Expert Proofreading

Paper format

- 275 words per page
- 12 pt Arial/Times New Roman
- Double line spacing
- Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Delivering a high-quality product at a reasonable price is not enough anymore.

That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more