peps [3 marks] 8 CST.2005.5.9 SECTION C 9 Logic and Proof (a) In…

Question Answered step-by-step peps [3 marks] 8 CST.2005.5.9 SECTION C 9 Logic and Proof (a) In… peps[3 marks] 8 CST.2005.5.9 SECTION C 9 Logic and Proof (a) In order to prove the following formula by resolution, what set of clauses should be submitted to the prover? Justify your answer briefly. ?x [P(x) ? Q ? ¬R(x)] ? ?x [(Q ? ¬S(x)) ? (P(x) ? R(x))] ? ?x S(x)(a) Many computer scientists believe that languages with strong compile-time typechecking are better than those that are typeless, dynamically typed, or areweakly type checked(b) If strictly-checked data types are seen as good, discuss whether augmentinga language with many more primitive data types is better. Consider, inparticular, the possibility of incorporating into a language such as Java manynew numerical types such as packed decimal of various precisions, scaledarithmetic, and new types to hold values representing distance, mass and time.How would these additions affect the readability and reliability of programs?(c) Some languages allow different modes of calling of function arguments, suchas call by value, call by reference and call by name. Discuss the advantagesand disadvantages of incorporating the argument calling modes into the datatypes of functions. (a) Define a function subsets in ML with the typesubsets : ‘a list -> ‘a list listwhich treats its input list as a set of n elements and returns a list of all 2nsubsets of that set. [5 marks](b) Define an exception NoFit with no arguments, and an exception Successwhose constructor takes an int list as an argument. [1 mark each](c) Use subsets to define a function knapsack with the typeknapsack : int -> int list -> int listwhich finds a subset of the ints in its second argument whose sum is exactly thefirst argument. Use at least one functional (map, foldl, etc.) in the definitionof knapsack. The NoFit exception should be raised in the event that nosolution exists. [5 marks](d) Define another version of knapsack called knapsack2 with the typeknapsack2 : int -> int list -> unitknapsack2 should use simple recursion to generate its candidate solutionson-the-fly as it tests them, and should raise Success with the solution onsuccess or return unit if no solution exists. It is proposed to send information across a fixed delay channel using a simple(window of 1) ARQ protocol with a transmitter timeout of T. That is, if thetransmitter does not receive an acknowledgement for a packet within time T ofsending the packet, it retransmits.The delay of the underlying channel is ? , the data rate is B and the packet size is pbits. Bit errors in the channel are independent and packets of size p have a packeterror rate of e. Errors in the small acknowledgement packets are rare enough to bediscounted in this analysis.(a) What is the expected throughput of the ARQ protocol if e is zero? [4 marks](b) What is the expected throughput if e is non-zero, but small enough that e2isnegligibly small? (c) How could a forward error code help the throughput of the ARQ scheme?[2 marks](d) What is meant by the term code rate of a forward error code? (e) What code rate must a code which squared the error rate have in order toimprove throughput of the ARQ scheme? [4 marks](f ) If the forward error coder adds delay, how will this affect performance?4CST.2005.5.54 Concurrent Systems and Applications(a) Mutual exclusion is an important consideration in many multi-threadedprocesses.(i) Describe the syntax and semantics of each of the different ways of usingthe synchronized keyword in Java. (ii) What is a re-entrant mutual exclusion lock and why is it helpful thatthe locks used by the Java Virtual Machine to implement synchronizedmethods be re-entrant? (iii) Accesses to fields of most data types in Java are atomic but some are not.Give an example of a field access that is not atomic and explain how readand write access can be achieved in a thread-safe fashion. (iv) Recent editions of the complete Java language include generics. What is the scopeof the mutual exclusion caused by the use of the synchronized keywordin a generic class definition? (b) Deadlock can occur in multi-threaded applications.(i) What four properties hold when deadlock exists? [4 marks](ii) Which of these are properties of the Java language and which depend onthe program being executed? [1 mark](iii) A practical strategy to avoid deadlock is to enforce an ordering onacquiring locks. Explain how this ensures that deadlock is never possible.[2 marks](c) Mutual exclusion locks are language-level features. Explain how they canbe implemented in terms of either Counting Semaphores provided by theoperating system or atomic compare-and-swap operations provided by thehardware. A leisure park has decided to adopt a variety of mobile and sensing technologies tomonitor the usage of its attractions. An app is offered to customers willing to installit on their smartphone, which tracks customers’ location throughout the park anduses the phone accelerometer to monitor activity.(a) Describe how app developers could make sure the app delivers the best accuracyon location and activity tracking while preserving the phone battery as much aspossible through system and sensor sampling optimizations. [6 marks](b) A customer installs the app on their device. They have two other applicationson the phone which monitor their physical activity as well as their locationthroughout the day for clinical reasons. Describe how the phone operatingsystem could optimize the battery efficiency of the sensing across applications.[5 marks](c) A variety of wireless sensors are scattered throughout the park to monitorthe operation of the attractions by continuously gathering temporal data (e.g.,mechanical vibration, load, temperature, humidity).(i) Describe a combination of medium access and network layer protocols forinfrastructure-less multi-hop networks to aid the sensor data delivery tothe park management servers. Discuss advantages and disadvantages ofthe solution devised. [5 marks](ii) Describe a solution which uses protocols from the Internet of Things domainto offer a non multi-hop solution. Discuss the advantages and disadvantagesof the solution devised. (a) In the quantum teleportation protocol, Alice and Bob are each in possession ofone qubit of a pair in the joint state ?12(|00i + |11i). In addition, Alice has aqubit in an arbitrary state |?i. Explain how the protocol works. In particular,show that it involves the transmission of exactly two classical bits of informationfrom Alice to Bob and demonstrate how, at the end of the protocol, Bob is inpossession of a qubit in state |?i. [10 marks](b) Suppose now that Alice has two qubits in a state|?i = ?0|00i + ?1|01i + ?2|10i + ?3|11i.In addition, there is a pair of qubits in the state ?12(|00i + |11i) such that Aliceis in possession of one qubit of the pair while Bob is in possession of the other.Alice now uses the quantum teleportation protocol to transmit to Bob the firstqubit of |?i. What is the resulting joint state of the two-qubit system composedof the second of Alice’s qubits and the qubit in Bob’s possession? (a) When defining space-complexity we use two-tape Turing Machines, with aread-only tape for input data and a read-write working tape. We count onlythe space used on the work tape. What difference would be made if we workedwith standard one-tape Turing machines, loaded the input data onto the tapeto start with and measured space in terms of total tape cells touched by theend of the computation? [4 marks](b) Comment on the following: “The problem of finding a factor of a number Nis NP, because if we have a factor P of N we can do a simple trial divisionand check it in time related to log(N). Thus finding factors of numbers of theform 2p ? 1 (these are known as Mersenne Numbers) is a problem in the classNP”.(c) Define the class co-NP. State an example of a problem that lies in it.(d) What is a witness function for an NP problem? Why might some problem suchas 3-SAT have many different witness functions associated with it? [2 marks](e) Give and justify a relation between NTIME(f(n)) and SPACE(f(n)).[4 marks](f ) Matchings on bi-partite graphs can be found in polynomial time. The matchingproblem on tri-partite graphs is known to be NP-complete. Does this suggestthat the corresponding problem with a graph whose nodes are partitioned intofour sets (“quad-partite” matching) is liable to be exponential in complexity?Justify your answer. [4 marks](g) Comment on the following proposition: “Determining which player can forcea win from a given starting position in the game of Chess is an NP problembecause given any sequence of moves it will be easy to verify that they are alllegal moves and easy to see who wins at the end of them.” (a) What does the ML function map do? Give an example, first coded withoutmap and then with it, to illustrate how it can lead to more compact orcomprehensible code. [3 marks](b) Functions foldl and foldr might be defined asfun foldl f (e, []) = e| foldl f (e, x::xs) = foldl f (f(e,x), xs);fun foldr f ([], e) = e| foldr f (x::xs , e) = f(x, foldr f (xs,e));Explain what these two functions do and why they may be useful. [4 marks](c) Here is a typical use of map:fun mangle n = (n-2)*(n+7);fun manglelist x = map mangle x;Show how to express manglelist using one of the “fold” functions rather thanmap. [3 marks]2 Discrete Mathematics(a) Given a set A, define the following terms:(i) a relation on A; [1 mark](ii) an equivalence relation on A; [1 mark](iii) a partial order on A; [1 mark](iv) a well-founded relation on A. [1 mark](b) If two relations

Leave a Comment

Your email address will not be published. Required fields are marked *