Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

The TTL field refers to the maximum amount of time a DNS server can cache the record. Most of the TTLs in this record were

The TTL field refers to the maximum amount of time a DNS server can cache the record. Most of the TTLs in this record were chosen to be 86400 seconds (1 day). What is the trade-off between choosing a shorter or a longer time? Why was the MX record specifically chosen to have a 60 second TTL? [4 marks] (iv) Explain why the Internet DNS uses caching. [2 marks] (v) Comment on how the provision of name servers for lemon.co.uk affects the availabilty of the name service. [2 marks] (vi) Outline two strategies to improve availability of the DNS server for the lemon.co.uk domain. [2 marks] [continued 10km 10Gb/s glass 10km 10Gb/s copper 10km 1Gb/s copper A R B C Propaga,on Delay copper 4s/km glass 5s/km (b) Consider the scenario shown above. Host A is sending tiny packets to hosts B and C. R is a store-and-forward switch with an average arrival rate of 10Gb/s and a buffer that contains, on average, 8MBytes of packet data. Delays due to the packet size and packet-processing are negligible. Little's Law tells us that the average amount of buffered data equals the product of the arrival rate and the average delay experienced. (i) What is the average delay that packets will incur going through the switch? [3 marks] (ii) Compute the latency of the shortest path between each pair of end-nodes: A to B, A to C, and C to B. [3 marks] (iii) Without changing the network propose a solution to decrease the delay between A and B. [2 marks] 7 (TURN OVER) CST.2014.5.8 6 Computer Networking (a) Consider an unreliable message service where messages of a fixed size are sent between known endpoints. Outline the minimum set of additional features offered by a reliable byte-stream delivery service. [3 marks] (b) A researcher notes that the message service, fritter, resembles a datagram service. It is prone to delivery delays of up to 1 second, message re-ordering and message loss. Fritter permits a 140-byte message to be relayed between any two users and each message is delivered without data-corruption. You are asked to implement a Stop-and-wait ARQ to provide a unidirectional reliable byte-stream delivery service between two fritter users. Assume this is the only service between the two fritter users. (i) Provide a labelled diagram illustrating the format for a fritter message that could be used by a reliable, byte-stream, delivery service. Justify your answer.


b) We don't actually know the number of new infections xt on date t: we only know the number of new positive test results, yt . We anticipate yt dow(t)xt , where dow(t) gives the day of the week for date t. We would like to estimate not only but also Mon, ..., Sun from the dataset (y1, . . . , yT ). (i) Propose a probability model for Yt+1 in terms of yt . [5 marks] (ii) Explain briefly how to estimate the parameters of your model. In your answer, you should consider whether or not the parameters are identifiable. [6 marks] CST1.2021.6.9 8 Data Science (a) In a COVID vaccine trial, n0 subjects were given a placebo and n1 were given the vaccine; x0 of the placebo subjects developed the disease and x1 of the vaccinated subjects. Considering the probability model Xk Binomial(nk, pk), the vaccine efficacy is defined to be e = 1 p1/p0. (i) State the maximum likelihood estimators for p0 and p1. Give a formula for the maximum likelihood estimator for e. [2 marks] (ii) Explain how to compute a 95% confidence interval for e. Also explain how to test whether e > 0.5. [7 marks] (b) Further data about the trial has been made available, and we learn that subjects weren't all enrolled for the same length of time. We are given a fulet consisting of three features, the predictor variable di and the response variables (ti , ci) for subject i. Here di = 1 if the subject received the vaccine and di = 0 otherwise; ci = 1 if the subject developed the disease and ci = 0 otherwise; and ti is the day on which the subject developed the disease if ci = 1, and the number of days enrolled in the trial otherwise. Consider the following probability model. Among vaccinated subjects, the vaccine is effective with probability f and ineffective otherwise. Effectively vaccinated subjects never get the disease. For ineffectively vaccinated subjects, and for subjects on placebo, each day there is a probability q of developing the disease. The parameters f and q are unknown. (i) For a subject i who received placebo, give an expression for the likelihood of the pair (ti , ci). [4 marks] (ii) For a subject i who received the vaccine, give an expression for the likelihood of the pair (ti , ci).



Write program that will continuously accept a character and store in a stack until letter Z is entered.

import java.util.Arrays;

import java.util.Random;


public class CompletedMerging implements MergingAlgorithms {


//DO: implement interface methods.

@Override

public Queue mergeQueues(Queue q1, Queue q2) {

//DO: implement this!

return null;

}


@Override

public void sort(Comparable[] a) {

//DO: implement this!

}


@Override

public Comparable[] mergesort(Comparable[] a) {

//TO: implement this!

return null;

}


@Override

public Comparable[] merge(Comparable[] a, Comparable[] b) {

//TO: implement this!

return null;

}


@Override

public void shuffle(Object[] a) {

//TO: implement this!

}


/**

* entry point for sample output.

*

* @param args the command line arguments


*/

public static void main(String[] args) {

Queue q1 = new ListQueue<>(); q1.enqueue("E"); q1.enqueue("L"); q1.enqueue("O"); q1.enqueue("R"); q1.enqueue("T");

Queue q2 = new ListQueue<>(); q2.enqueue("A"); q2.enqueue("E"); q2.enqueue("M"); q2.enqueue("P"); q2.enqueue("S"); q2.enqueue("X");

Queue q3 = new ListQueue<>(); q3.enqueue(5); q3.enqueue(12); q3.enqueue(15); q3.enqueue(17); q3.enqueue(20);

Queue q4 = new ListQueue<>(); q4.enqueue(1); q4.enqueue(4); q4.enqueue(12); q4.enqueue(13); q4.enqueue(16); q4.enqueue(18);


MergingAlgorithms ma = new CompletedMerging();


//Q1 - sample test cases

Queue merged1 = ma.mergeQueues(q1, q2);

System.out.println(merged1.toString());

Queue merged2 = ma.mergeQueues(q3, q4);

System.out.println(merged2.toString());


//Q2 - sample test cases

String[] a = {"S", "O", "R", "T", "E", "X", "A", "M", "P", "L", "E"};

ma.sort(a);

assert isSorted(a);

show(a);



//Q3 - sample test cases

String[] b = {"S", "O", "R", "T", "E", "X", "A", "M", "P", "L", "E"};

ma.shuffle(b);

show(b);


ma.shuffle(b);

show(b);

}



//below are utilities functions, please do not change them.


//sorting helper from text

private static boolean less(Comparable v, Comparable w) {

return v.compareTo(w) < 0;

}


//sorting helper from text

private static void show(Comparable[] a) {

for (Comparable a1 : a)

System.out.print(a1 + " ");


System.out.println();

}



//sorting helper from text

public static boolean isSorted(Comparable[] a) {

for (int i = 1; i < a.length; i++)

if (less(a[i], a[i-1]))

return false;


return true;

}

}





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 LinearNode(item);


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 string

Write 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 Write function, RandomRange that takes an integer then it returns a list of length n, where n is an integer passed as an argument, and the numbers in the list are random numbers in the range 1 to n inclusive.


) Carefully 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. (You do not need to remember the exact syntax of the JARGON instructions as long as you clearly explain what your code is doing.) [6 marks] 5 (TURN OVER) CST1.2019.4.6 4 Compiler Construction This question explores how exceptions might be added to SLANG and the JARGON virtual machine. We will raise an exception with raise e where e is an expression. We will "trap" an exception with the following expression. try e with f end If e evaluates to a value v, then v is the result of the try-expression. Otherwise, the evaluation of e raises an exception E and the try-expression continues by evaluating the function application f(E). To simplify things we will assume that each f is an identifier. Uncaught exceptions at the top-level will result in a runtime error. (a) Do we need to define a fixed type for exceptions? Justify your answer. [3 marks] (b) What typing rule or rules would you implement for the expression raise e? Justify your answer. [3 marks] (c) A compiler may rewrite expressions in order to optimise generated programs. For example, here are two rewrite rules to simplify conditional expressions: code replacement 1 if true then e1 else e2 e1 2 if false then e1 else e2 e2 For each of the rules below, argue that it is, or is not, a valid optimisation rule. code replacement 1 raise (raise e) raise e 2 e1 + (raise e2) raise e2 3 try (raise e) with f end f(e) 4 try e with (fun x -> raise x) end e [6 marks] (d) Carefully describe the stack-oriented code you would generate for both the raise- and try-expressions. [8 marks] 6 CST1.2019.4.7 5 Further Java A programmer designs a client-server booking system for a meeting room. The role of the server is to distribute bookings between clients when they connect. Clients open a socket connection to the server regularly for a short period. When a client connects, the client first sends to the server an instance of Message which contains any new bookings made by the client; in response, the server sends an instance of Message containing all bookings made by other clients since the client last connected; the server then closes the connection. The key parts of the Message and Booking classes are defined as follows: public class Message implements Serializable { private final String uniqueClientId; private final java.util.List bookings; ... } public class Booking implements Serializable { private final String uniqueClientId; private final java.util.Date startTime; private final java.util.Date endTime; private final String description; ... } (a) Write a Java implementation of the server, using a single thread to serve each client in turn. You may assume the existence of a static method processBookings, which accepts a list of new bookings from a specified client and returns a list of bookings to be sent back to the client. You may assume suitable accessor methods for Message and Booking; you do not need to handle exceptions. [8 marks] (b) The programmer decides to extend the booking system with vector clocks. (i) Write down a suitable data structure for a vector clock in Java.

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_2

Step: 3

blur-text-image_3

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

Spreadsheet Modeling And Decision Analysis A Practical Introduction To Management Science

Authors: Cliff T. Ragsdale

5th Edition

324656645, 324656637, 9780324656640, 978-0324656633

More Books

Students explore these related Computer Network questions