ccm1 java attend all . . . r2 e1 e2 box r2 Write sound typing and subtyping
Question:
ccm1 java attend all . . . r2 e1 e2 box r2 Write sound typing and subtyping rules for these constructs. [5 marks] Now suppose that we add to this calculus the type variables and bounded universal quantification of System F6. Indicate how your typing and/or subtyping rules must change (while remaining sound!) so that the expression fun(X 6 Box (Top Top)) fun(x X) x (fun(y Top) y) has the type All(X 6 Box (Top Top)) X X [3 marks] 5 11 Specification and Verification II Explain how a register can be modelled either as a unit-delay, or with an explicit clock input. [4 marks] Describe the relationship between the two models. [4 marks] Design a device with input i and output o that outputs on o the sum of the inputs present at i at the preceding two clock edges. [4 marks] Give two specifications of the device: (a) as an abstract sequential machine and (b) with an explicit clock input. [4 marks] State a logical relationship between the two specifications. [4 marks] 12 Communicating Automata Define the notion of weak bisimulation over a labelled transition system. [3 marks] A one-cell buffer B can be defined by B def = in.B0 , B0 def = out.B (the content of messages being ignored). in out B Define the linking operator _, in terms of basic operators, so that B _ B represents two buffer cells in sequence. in out B B [3 marks] Derive B _ B in B0 _ B from the basic transition rules, and draw the complete transition graph of B _ B. [3 marks] A lossy buffer cell L (like B except that it may lose messages) can be defined by L def = in.L0 , L 0 def = out.L+.L. Draw the complete transition graphs of both B _ L and L _ B. [4 marks] Show that B _ L 6 L _ B, by considering the state L _ B0 (accessible from L _ B) and showing that no appropriate state of B _ L can be observation equivalent to L _ B0 . [4 marks] Is L _ L B _ L true? Outline an argument to prove or disprove it. [3 marks] 6 CST.96.7.7 13 Designing Interactive Applications When a new patient applies to join a doctor's practice, personal and medical-history details must be obtained. Usually the patient (or the patient's parent in the case of young children) must fill in a form of two pages or more for inclusion in the patient's records. With the computerization of one particular doctor's practice, P1, a means is needed for entering the new patient's details. Two approaches are considered: (A) the doctor interviews the patient at the start of the initial consultation, and enters the details as they are elicited; (B) upon application, the patient or parent sits down at a computer and enters the details. Write one-sentence problem statements for each design problem. Then, drawing on your knowledge of the work of the doctor, discuss the pros and cons of the two approaches. [12 marks] Suppose two practices, P1 and P2, adopt approaches A and B respectively. Each is dissatisfied with the results. Practice P1 therefore decides to switch to approach B, installing a computer in a booth adjoining its waiting room, running the system designed for the doctor (modified only to prevent access to existing records), so that patients and parents can enter their details. Meanwhile practice P2 decides to change to approach A, loading the patient data entry program, unchanged, onto the doctor's PC so that he or she can enter the details during consultations. If you were asked to advise practices P1 and P2 on these moves, what outcomes would you predict? What analytical method would you use, in each case, to back up your predictions, and why? [8 marks] 14 Additional Topics What is the principle of operation of the Global Positioning System (GPS)? [10 marks] Write short notes on four appplications which are made possible by information supplied by this system. [10 marks] 7 [TURN OVER CST.96.7.8 15 Additional Topics Explain the concept of environment as used in Natural Semantics. In particular, explain its use in the delivery judgements which describe the evaluation of phrases in Standard ML. What are the main kinds of result which such an evaluation may deliver, for different kinds of phrase? [6 marks] The following Standard ML program has three top-level phrases: val step = 5; fun sum(0) = 0 | sum(n) = step*n + sum(n-1); sum(3); What are the components of the three environments in which these three phrases are evaluated? During the evaluation of sum(3), the expression sum(n-1) is evaluated several times; in which environments do these evaluations take place? [7 marks] Give two examples of theorems which one may be able to prove about the delivery judgements for evaluation, and explain the practical relevance of these theorems. [7 marks]
Examine the following statements and indicate which are true and which are false. In most cases a simple one-word answer "true" or "false" will suffice, but, if you feel the need to make assumptions about circumstances or otherwise elaborate a little, please keep your notes as short as possible. (a) All methods in an abstract superclass must be declared abstract. (b) A class declared final cannot be subclassed. Every method of a final class is implicitly final. (c) A redefinition of a superclass method in a subclass need not have the same signature as the superclass method. Such a redefinition is not method overriding but is simply an example of method overloading. (d) A constructor is a special method with the same name as the class that is used to initialise the members of a class object. Constructors are called when objects of their classes are instantiated. (e) A method declared static cannot access non-static class members. A static method has no this reference because static class variables and static methods exist independent of any objects of a class. (f ) An array subscript may be an integer or an integer expression. If a program uses an expression as a subscript, then the expression is evaluated to determine the particular element of the array. (g) To pass one row of a double-subscripted array to a method that receives a single-subscripted array, simply pass the name of the array followed by the row subscript. (h) Overloaded methods can have different return values, and must have different parameter lists. Two methods differing only by return type will result in a compilation error. (i) The applet's paint method is called after the init method completes execution and the start method method has started executing to draw on the applet. It is also called automatically every time the applet needs to be repainted. (j) Any block of Java code may contain variable declarations. [1 mark each] 3 [TURN OVER CST.2003.1.4 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) Preemptive schedulers require hardware support. (b) The Unix shell supports redirection to the buffer cache. (c) A context switch can be implemented by a flip-flop stored in the translation lookaside buffer (TLB). (d) Non-blocking I/O is possible even when using a block device. (e) Shortest job first (SJF) is an optimal scheduling algorithm. [2 marks each] SECTION B 5 Foundations of Computer Science (a) Describe how lazy lists can be implemented using ML. [2 marks] (b) Code a function to concatenate two lazy lists, by analogy to the 'append' function for ordinary ML lists. Describe what happens if your function is applied to a pair of infinite lists. [3 marks] (c) Code a function to combine two lazy lists, interleaving the elements of each. [3 marks] (d) Code the lazy list whose elements are all ordinary lists of zeroes and ones, namely [], [0], [1], [0, 0], [0, 1], [1, 0], [1, 1], [0, 0, 0], . . . . [6 marks] (e) A palindrome is a list that equals its own reverse. Code the lazy list whose elements are all palindromes of 0s and 1s, namely [], [0], [1], [0, 0], [0, 0, 0], [0, 1, 0], [1, 1], [1, 0, 1], [1, 1, 1], [0, 0, 0, 0], . . . . You may take the reversal function rev as given. [6 marks] 4 CST.2003.1.5 6 Foundations of Computer Science (a) Explain in detail how a binary search tree represents a dictionary. If reference types are not used, what is the average-case cost of an update operation? [8 marks] (b) A mutable binary tree is either a leaf or a branch node containing a label and references to two other mutable binary trees. Present the ML datatype declaration for mutable binary trees. [2 marks] (c) Describe how to use this datatype to implement (mutable) binary search trees. Give ML code for the lookup and update operations. The update operation must never copy existing tree nodes. (a) Define the terms injective, surjective and bijective, and state the Schroder- Bernstein theorem concerning the existence of a bijection between two sets. [4 marks] (b) What is a countable set? [2 marks] (c) Prove the following assertions: (i) If C is a countable set and f : A C is an injection, then A is countable. [2 marks] (ii) If A and B are countable sets, then A B is countable. [2 marks] (iii) Z and Q, the sets of integer and rational numbers, are both countable. [4 marks] (iv) P(N), the set of all subsets of the natural numbers, is not countable. [2 marks] (v) If U is an uncountable set and f : U V is an injection, then V is not countable.
program that first gets a list of integers from the input and adds them to an array. The input begins with an integer indicating the number of integers that follow a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold value.
(a) You are to design a component of a distributed system which takes action on the arrival of an alarm event from another component. Discuss the design issues, relating to the characteristics of distributed systems, of the component and its communication. [4 marks] (b) You are to design a service that takes in streams of messages from distributed sources and notifies its clients when certain specified patterns of messages occur. Discuss the design issues associated with supporting the following operators for constructing message patterns, where A and B represent messages: (i) A OR B; (ii) A AND B (unordered pairs); (iii) A BEFORE B (ordered pairs). [16 marks] 5 Advanced Systems Topics (a) Considerable recent operating system research has focused on extensibility. (i) What is the motivation for this work? [1 mark] (ii) Describe with the aid of examples three different techniques for providing extensibility. In each case comment on the granularity of extensibility provided, and discuss the issues of performance and safety. [5 marks each] (b) Some researchers claim that programming language virtual machines such as the JVM should be extensible. (i) Why might this be desirable? [1 mark] (ii) How could this be safely achieved? Comment on how your solution might differ from those used in the case of operating system extensibility.
(a) The Digital Signature Standard is computed using the following equations: r = (g k mod p) (mod q) s = (h(M) xr)/k (mod q) Describe what the various symbols represent. [4 marks] (b) Write down the equation(s) used to verify a signature. [4 marks] (c) The standard specifies that r must lie strictly between 0 and q. What might go wrong if an implementation does not check this? [4 marks] (d) A designer decides to economise on code size by omitting the hash function computation, that is, replacing h(M) by M. What are the consequences of this optimisation?
(a) Explain in one sentence what is meant by the "phase order problem". [2 marks] For the rest of the question, it is recommended that you restrict attention to a single basic block containing only unary and binary arithmetic instructions, e.g. add#4 dst,src or mul dst,src1,src2 and with no variable written to after being read (SSA form). Consider all such instructions to execute in one cycle. (b) Describe how a directed acyclic graph expressing instruction dependencies suitable for instruction scheduling can be obtained from such a basic block. [4 marks] (c) Briefly describe how a (register interference) graph can be obtained from such a basic block. Also state a requirement for colouring this graph with registers. [4 marks] (d) Consider the two programs (where the first four lines are the same): add t1,a,b add t1,a,b add#2 t2,c add#2 t2,c add#3 t3,c add#3 t3,c mul t4,t2,t3 mul t4,t2,t3 sub z,t1,t4 sub t5,t1,t4 xor t6,t5,a xor z,t6,b In each case consider scheduling the add t1,a,b to appear as early as possible or as late as possible. Determine the number of registers required to colour the program in all four resulting cases. (Assume that only z, allocated to r1, is live on exit and that a,b,c are allocated registers r1,r2,r3.) [10 marks] [Remark: you might note that doing add t1,a,b in the left-hand program decreases the number of live registers by one, while it increases the number by one on the right-hand program.]
Early programming languages had relatively poor facilities for type checking, data abstraction, data hiding and encapsulation. Explain the meaning of these terms and discuss their importance. [6 marks] Outline the key features that a language must have to be called object-oriented and briefly discuss to what extent C++, Java and Smalltalk have them. [7 marks] Briefly discuss some of the reasons why C++ programs typically run faster than equivalent programs written in Java or Smalltalk. [7 marks] 6 Compiler Construction It is desired to obtain an unambiguous context-free grammar G0 which generates the same strings as the following grammar G with start symbol S. S -> E E -> ( E ) | [ E ] | E * E | a | b | c ( E ) -> ( + E ) [ E ] -> [ - E ] Define a suitable G0 or explain why G already satisfies the criterion. [6 marks] Write context-free (Type 2) grammar which describes floating-point numbers of the form []dd [.d ][e[]dd ] where d stands for decimal digit and d stands for zero or more decimal digits. [ ] means that the enclosed item is optionally present in the floating-point number. [7 marks] Sketch a recursive descent parser for the following grammar H with start symbol S. You should assume the existence of a routine lex() which sets variable token to one of '1', '2', '(', ')', '-' or eof. P -> 1 | 2 | (E) E -> P | E - P S -> E eof
Windows implements static inheritance for the access-control lists of NTFS files and folders. (i) What does static inheritance mean here and how does it differ from dynamic inheritance? [4 marks] (ii) Five flag bits (ci,oi,np,io,i) in each NTFS access-control entry (ACE) manage how it is inherited. Briefly describe the purpose of each bit. [5 marks] (iii) User mike gives his folder project the following access-control list: project AllowAccess mike: full-access (oi,ci) AllowAccess alice: read-execute (ci,np) AllowAccess bob: read-only (oi) It contains one folder and two text files, none of which have any noninherited access-control entries: project\doc.txt project\src project\src\main.c For each of these three objects, list all inherited access-control entries, showing in parentheses the inheritance-control flag bits that are set (using the same notation as above). [5 marks] (b) Describe the purpose and four typical functions of a root kit.
Given a sequence of points (Vi) n i=0 on a plane, consider the problem of interpolating a smooth curve through all of the points in order by constructing a sequence of polynomial parametric functions, one for each interval [Vi , Vi+1] n1 i=0 . (a) What is meant by Ck continuity at the junction between two curve segments? [2 marks] (b) Explain how the degree of the polynomial function for a curve segment constrains the continuity at its two ends. What continuity can be achieved at each end of a cubic segment? [4 marks] (c) Derive a cubic parametric function for the interval [Vi , Vi+1] where 0 < i < n1 Momentarily clarify the job of the attest articulation and why this program will trigger a state disappointment when executed. Supply two altered adaptations of the program that change the trade work definition and, assuming fundamental, its calls, to stay away from this state disappointment. One rendition should be in C, and the other should utilize C++ language highlights. [4 marks] (c) Describe the location space format (featuring four areas of memory) of a ordinary incorporated x86 C program, and how every one of these areas are utilized by C builds. [8 marks] (d) Briefly clarify what indistinct conduct is in the C norm. Under what circumstance(s) would calling the accompanying C capacity result in unclear conduct?
Project Management Achieving Competitive Advantage
ISBN: 978-0133798074
4th edition
Authors: Jeffrey K. Pinto