+1 (208) 254-6996 essayswallet@gmail.com

QuestionAnswered step-by-stepDescribe the code you would generate for the JARGON virtual machine…Describe the code you would generate for the JARGON virtual machine for the body of the function sum defined above. If you need to extend the virtual machine with new instructions, then define their semantics. Give a detailed explanation of how in general GBB decides where to make its first backjump. Illustrate your answer using the example above, assuming that it is not possible to make a consistent assignment at V8.(d) In the example illustrated, assume the first backjump made is from V8 as in part (c). We find after the first backjump that the variable we have arrived at has no further consistent assignments. Give a detailed explanation of how GBB decides what to do next, including in your answer a description of the set of induced ancestors that are relevant in making the decision. Computer Graphics and Image Processing Consider the transformations used in the construction and rendering of a threedimensional model on a screen. (a) List the three principal transformations in the processing pipeline and explain their rˆoles.  (b) Why is it convenient to represent the transformations as matrices? [2 marks] (c) What are homogeneous coordinates? Explain how they are used in modelling these transformations as matrices. [2 marks] (d) Derive the matrix to represent a perspective transformation for a viewer at the origin of a point in three dimensions to a point on a screen in the plane z = d. [5 marks] (e) Perspective in classical art has vanishing points towards which parallel lines converge. Explain mathematically why this is the case and show how to calculate the location on the screen of the vanishing point for lines in a particular direction. [5 marks] [Hint: It may be helpful to represent lines parametrically in vector form as P(s) = A + sV where V is a direction and A is any point on the line.] 4 Computer Graphics and Image Processing Consider a curve defined by polynomial parametric segments Pi(s) for i = 1, 2, . . . m that interpolates a set of points {Ai}0=i=m in three dimensions. (a) What is meant by Ck continuity at the junction of two segments? [3 marks] (b) What is the least order of the polynomials that must be used to achieve Ck continuity at the junctions? [2 marks] (c) Derive the Overhauser formulation for a set of weighting functions w-2(s), w-1(s), w0(s) and w1(s) so that the cubic curve segment joining Ai-1 and Ai can be expressed as Pi(s) = w-2(s)Ai-2 + w-1(s)Ai-1 + w0(s)Ai + w1(s)Ai+1 for 1 < i < m. [10 marks] (d) Extend this formulation to give a set of paerametric patches Pi,j (s, t) for 1 < i < m and 1 < j < n interpolating a surface through an array of points {Ai,j}0=i=m,0=j=n. [5 marks] 4 CST.2015.4.5 5 Databases (a) The relational schema R(A, B, C, D, E) has the following functional dependencies. A ? E B ? D A, B ? C Decompose this into a set of relations in BCNF. Show your working. [5 marks] (b) By inspecting your answer to (a), describe a possible interpretation in the language of Entity-Relationship modelling. [5 marks] (c) Heath's Rule tells us that if R(A, B, C) is a relational schema with functional dependency A ? B, then R = pA,B(R) ?A pA,C(R). This rule is often applied in the relational decomposition process that seeks to arrive at relations in a particular normal form. For example, we might decompose R into two implemented relations R1(A, B) and R2(A, C). Some people have been very critical of this approach since it ignores the fact that the implementation of such a decomposition is normally associated with foreign key constraints between tables. What is missing? Can you express, in the relational algebra, what such a missing constraint might look like for the decomposition described above using Heath's rule? Justify your answer. [5 marks] (d) Using your answer to (c), discuss which constraints might be missing from your decomposition in question (a). package edu.ser222.m02_02;* @author Lewis et al., Acuna* @version 4.0* @param contained type*/public class LinearNode {   private LinearNode next;   private Item element;      * @param elem element to be stored    */   public LinearNode(Item elem) {       next = null;       element = elem;   }    /**    * Returns the node that follows this one.    * @return reference to next node    */   public LinearNode getNext() {       return next;   }    /**    * Sets the node that follows this one.    * @param node node to follow this one    */   public void setNext(LinearNode node) {       next = node;   }    /**    * Returns the element stored in this node.    * @return element stored at the node    */   public Item getElement() {       return element;   }    /**    * Sets the element stored in this node.    * @param elem element to be stored at this node    */   public void setElement(Item elem) {       element = elem;   }}    package edu.ser222.m02_02; import java.util.NoSuchElementException;  * @author Acuna* @version 1.1* @param item type*/public class ListQueue implements Queue {   LinearNode tail; //back   LinearNode head; //front   private int count;    public ListQueue() {       head = tail = null;       count = 0;   }    @Override   public boolean isEmpty() {       return count == 0;   }    @Override   public void enqueue(Item item) {    LinearNode newNode = new LinearNem);        if(isEmpty())           tail = newNode;       else           head.setNext(newNode);        head = newNode;       count++;   }    @Override   public Item dequeue() {       if(isEmpty())           throw new NoSuchElementException();        Item result = tail.getElement();       tail = tail.getNext();       count–;            if(isEmpty())           head = null;        return result;   }    @Override   public Item peek() {       if(isEmpty())           throw new NoSuchElementException();        return tail.getElement();   }    @Override   public String toString()   {       LinearNode iter = tail;       String result = “(tail) “;            while(iter != null) {           //result = iter.getElement() + ” ” + result;           result = result + iter.getElement() + ” “;           iter = iter.getNext();       }                return result.strip();   }    @Override   public int size() {       return count;   }}   package edu.ser222.m02_02; public interface MergingAlgorithms {     public Queue mergeQueues(Queue q1, Queue q2);    /**    * Sorts the contents of an array. Array is sorted in-place. Uses a mergesort approach involving    * helper methods mergesort(), and merge(). Assumes input does not contain nulls.    * @param a Array to sort.    */   public void sort(Comparable[] a);    /**    * Implementation of mergesort. Only uses arrays as parameters, not integer indices. Assumes    * input does not contain nulls.    *    * @param a array to sort    * @return sorted array    */   public Comparable[] mergesort(Comparable[] a);    public Comparable[] merge(Comparable[] a, Comparable[] b);    /**    * Shuffles an array in nlog(n) time using a recursive merging mechanism. It must be possible    * for any element to reposition to any other position. Assumes input does not contain nulls.    * @param a an array    */   public void shuffle(Object[] a);}    package edu.ser222.m02_02; import java.util.NoSuchElementException; /*** A simple queue interface.** @author Wedgewick and Wayne, Acuna* @version 1.1*/public interface Queue {    /**    * Add an item.    * @param item an item    */   public void enqueue(Item item);    /**    * Remove the least recently added item.    * @return an item    */   public Item dequeue() throws NoSuchElementException;    /**    * Return, but do not remove, the least recently added item.    * @return an item    */   public Item peek() throws NoSuchElementException;    /**    * Is the queue empty?    * @return if empty    */   public boolean isEmpty();    /**    * Number of items in the queue.    * @return number of items    */   public int size();}Write  C program that prompts the user for an input string with all lowercase letters. Your program should then sort the characters in the string and print the sorted stringWrite  program that separately prompts the user for a first name and last name and outputs a string containing the following information,Write  program that prompts the user to enter the name of a file. The program encoded sentences in the file and writes the encoded sentences to the output file.Write  static method named textcount that takes a scanner representing a file as a parameter and that reports various statistics about the file.Write  recursive function that takes positive int n as its input and returns sum of the first n squares An older home-network router has an upload bandwidth of 1Mbit/s to the Internet, and a 100kbyte first-in first-out (FIFO) buffer for packets awaiting transmission. Packets have a maximum transmission unit (MTU) of 1500 bytes. (i) If the buffer is completely full, how long does it take the router to transmit all of the bytes in the buffer? [2 marks] (ii) Suppose the router supports two FIFO queues, one high-priority for interactive applications (like Voice over IP) and the other lower-priority for all remaining traffic. If a VoIP packet arrives when the queue for interactive applications is empty, what is the maximum time before the router starts transmitting the VoIP packet? (Assume that the router does not preempt any ongoing packet transmission.) [2 marks] (b) Consider the delay at each node (router or switch) in a network given by this equation: dnode = dproc + dqueue + dtrans + dprop For each term: dproc, dqueue, dtrans and dprop (i) explain what it represents; (ii) state one way to reduce it; and (iii) indicate a typical range of values in a 1Gbit/s local area network with link-length less than 500m. State your assumptions throughout. [4 × 3 marks] (c) A lecturer remarks that “centralised multiplexing” offers potential gains in efficiency over non-centralised multiplexing. Give two reasons why this could be so. In each, state clearly what feature must be centralised to achieve these gains. [4 marks] 8 CST.2015.5.9 7 Concurrent and Distributed Systems (a) (i) Name the four necessary conditions for deadlock. [2 marks] (ii) Which of these conditions is frequently precluded in operating-system kernel designs in order to prevent deadlocks and why? [2 marks] (b) Deadlocks are not limited to locks; cycles of waiting on condition variables can also lead to the “deadly embrace”. (i) Explain why it might be more difficult to debug deadlocks involving condition variables than those simply involving locks. [2 marks] (ii) Briefly describe a condition-variable API change that might allow this problem to be solved in some cases; explain why it cannot always help. [2 marks] (c) FreeBSD’s WITNESS feature checks statically defined and dynamically discovered lock orders. Each time a lock is acquired, any previously undiscovered graph edges involving lock types currently held by the thread and the newly acquired lock type will be added to the graph. Cycle detection is performed, and debug information is printed if a previously unreported cycle is discovered. (i) Describe a common code structure in which programmers are likely to be able to define a static order between two lock types. [2 marks] (ii) Describe a common case in which programmers are likely to rely instead on dynamic discovery of an order between two lock types. [2 marks] (iii) Unlike the deadlock-detection algorithm presented in lecture, the WITNESS algorithm does not remove edges when locks are released. Explain why WITNESS’s behaviour might be more useful in practice. [2 marks] (iv) WITNESS is subject to false positives: warnings can be emitted due to legitimate cycles even though, by design, the cycle could never trigger an actual deadlock. Describe a situation in which this might arise, and explain why deadlock could never occur. [3 marks] (v) WITNESS, as written, is intended to be used with mutexes and other lock types providing mutual exclusion. A developer might na¨ively extend WITNESS to support reader-writer locks (rwlock) by introducing graph edges for both read and write acquires as it does for mutex acquires. Explain why this might not always lead to the desired result.Computer ScienceEngineering & TechnologyC++ ProgrammingTVVHFF VFShare Question

Don't use plagiarized sources. Get Your Custom Essay on
Top answer: Describe the code you would generate for the JARGON virtual machine…
Just from $10/Page
Order Essay

Order your essay today and save 10% with the discount code ESSAYHELP