question archive Prove that the information measure is additive: that the information gained from observing the combination of N independent events, whose probabilities are pi for i = 1
Subject:Computer SciencePrice:9.82 Bought3
Prove that the information measure is additive: that the information gained
from observing the combination of N independent events, whose probabilities
are pi
for i = 1 . . . N, is the sum of the information gained from observing each
one of these events separately and in any order.
Consider a causal digital IIR filter of order 2, operated at a sampling frequency
of 48 kHz, where the impulse response {hn} has (for n > 2) the shape of a sine
wave of frequency 8 kHz (amplitude and phase do not matter).
(i) Where in the z domain can you place two zeros and two poles to achieve
such an impulse response {hn} in the time domain?
(ii) Write down the z transform of {hn} as a rational function (with those zeros
and poles). [6 marks]
(iii) Provide the constant-coefficient difference equation that describes the
time-domain behaviour of that filter. [4 marks]
(iv) How can you use such a filter design to digitally generate an 8 kHz sinewave
sampled at 48 kHz with very little computational effort?
tackle every question here
(a) Considerable recentch has focused on alignment of sequences.
(i) Why do we use dynamic programming algorithms for sequence alignment
problems? [3 marks]
(ii) Describe what needs to be taken into account for gaps in DNA sequence
alignment. [3 marks]
(b) Considerable recent research has focused on sequence database search methods.
(i) What are the most important differences between PatternHunter, BLAST,
Smith-Waterman and Needleman-Wunsch algorithms?
(ii) Compare the heuristic used by Clustal with a dynamic programming
algorithm for multiple alignment. [5 marks]
2
CST.2012.9.3
2 Computer Systems Modelling
(a) Consider a general birth-death process with birth rates λi and death rates µi
in state i (i = 0, 1, 2, . . .). What are the detailed balance equations for this
process? [2 marks]
(b) Derive the steady-state distribution for the general birth-death process
considered in part (a). What are the conditions for the steady-state distribution
to exist? [4 marks]
(c) Describe the M/M/1 queue and give a stochastic model for the number N
of customers present. Find the steady-state distribution for N and state the
conditions for it to exist. [4 marks]
(d) Derive the mean and variance of N. [4 marks]
(e) State Little's law and use it to derive the mean time spent in the M/M/1 queue
under steady state conditions. [2 marks]
(f ) Discuss what is meant by the traffic intensity for an M/M/1 queue and explain
what happens to the distribution of the number of customers present as the
traffic intensity increases towards one. [4 marks]
3 (TURN OVER)
CST.2012.9.4
3 Computer Vision
(a) Briefly define each of the following concepts as it relates to vision:
(i) active contours and energy-minimising snakes [2 marks]
(ii) Hadamard's criteria for well-posed problems [2 marks]
(iii) the hermeneutical cycle [2 marks]
(iv) reflectance map [2 marks]
(v) Bayesian prior and its role in visual inference [2 marks]
(b) Detecting, classifying, and recognising human faces is a longstanding goal in
computer vision. Yet because the face is an expressive social organ, as well as
an object whose image depends on identity, age, pose and viewing angle, and
illumination geometry, many forms of variability are all confounded together,
and the performance of algorithms on these problems remains very poor. Discuss
how the different kinds and states of variability (e.g. same face, different
expressions; or same identity and expression but different lighting geometry)
might best be handled in a statistical framework for generating categories,
making classification decisions, and recognising identity. In such a framework,
what are some of the advantages and disadvantages of wavelet codes (Haar or
Gabor) for facial structure and its variability?
Given a closed PCF term F of type nat → nat and a function f : N → N, say that
F represents f if F(succn
(0)) ⇓nat succf(n)
(0) holds for all n ∈ N.
(a) What is the soundness property of the denotational semantics of PCF? Use it to
show that if f is not a constant function (that is, f(m) 6= f(n) for some m 6= n),
then the denotation JFK : N⊥ → N⊥ of any F that represents f is the strict
function that equals f when restricted to N. [4 marks]
(b) If f is a constant function (f(n) = c for all n, say), give, with justification, two
PCF terms that represent it and that are not contextually equivalent.
program to read an integer number and display number is even or odd
: Write program to read two strings then concatenate and display them
Write the following program to c++.
Write program to read four integer numbers and display the biggest one, i.
: Write program to read JSON object array and covert it to ArrayList of strings.
Here are four options for improving web page performance.
Option 1: HTTP Caching with a Forward Proxy
Option 2: CDN using DNS
Option 3: CDN using anycast
Option 4: CDN based on rewriting HTML URLs
You have been asked to help reduce the costs for networking in the University.
(a) The University pays its service provider networks'r'us, based on the bandwidth it
uses; bandwidth use is dominated by students downloading external web pages.
Which, if any, of the above four options would reduce the bandwidth usage?
Explain your choice. [4 marks]
(b) The delivery of online courses has become a tremendous success - but this has
led to a significant increase in network costs for the University.
You must select one of the options above to minimize load on the servers.
Compare the operation of each option and justify a selection that provides the
finest granularity of control over load to the content-servers and a selection that
will serve each customer from the closest CDN server. [12 marks]
(c) You have looked up the IP address of your favourite search engine on the
University network and noticed the answer is different from that given to your
friend when he did the lookup in Newfoundland, Canada.
For each option above, indicate why it might, or might not, be used by your
favourite search engine to improve web page performance. [4 marks]
6
CST.2013.5.7
6 Computer Networking
(a) Considering either TCP/IP or UDP/IP, write a description of how server-port,
client-port, source-port and destination-port relate to each other. You may wish
to give examples and use diagrams as appropriate. [4 marks]
(b) What is a routing-loop? Include a diagram in your answer. [4 marks]
(c) Describe a mechanism that prevents routing-loops in Ethernet networks.
[4 marks]
(d) (i) Describe and, with the aid of an example, illustrate the IP Time-To-Live
(TTL) mechanism for minimising the impact of routing-loops. [2 marks]
(ii) Assuming, in part (d)(i), a perfect implementation, describe a disadvantage
of the approach including the symptoms that might be experienced in a
network subject to this disadvantage, and a test that may identify the
problem. [2 marks]
(e) Explain the technical and architectural argument behind the decision in IPv6
to retain header TTL but not a header checksum. [2 marks]
(f ) Explain why there is ambiguity about handling packets with TTL values of 1
and give a practical solution. [2 marks]
7 (TURN OVER)
CST.2013.5.8
7 Concurrent and Distributed Systems
(a) Deadlock is a classic problem in concurrent systems.
(i) What are the four necessary conditions for deadlock? [4 marks]
(ii) Deadlock is often explained using the Dining Philosopher's Problem. In
this pseudo-code, each fork is represented by a lock:
Lock forks[] = new Lock[5];
// Code for each philosopher (i)
while (true) {
think();
lock(fork[i]);
lock(fork[(i + 1) % 5]);
eat();
unlock(fork[i]);
unlock(fork[(i + 1) % 5]);
}
Partial ordering is a common deadlock prevention scheme. Describe
modifications to the above code, changing only array indices, such that
philosophers can be fed not only safely, but also deadlock-free, using a
partial order. [4 marks]
(b) Priority inversion can occur when threads of differing priorities synchronise on
access to common resources - threads of greater priority may end up waiting on
threads of lesser priority, leading to undesirable realtime properties.
(i) Describe how this problem can be solved for mutexes using priority
inheritance. [2 marks]
(ii) Describe how priority inheritance would need to be modified to handle
reader-writer locks. [2 marks]
(iii) Priority inversion can also arise between two threads involved in process
synchronisation - for example, when one thread uses a semaphore to signal
completion of work. Why might implementing priority inversion be more
difficult with process synchronisation than with mutual exclusion?
public class Test {
public static void main(String[] args) {
Apple f1=new Apple(new Date(8,8,2021), "Apple", false);
System.out.println(f1);
System.out.println("Total No of Calories :"+f1.calculateTotalCalories());
Banana f2=new Banana(new Date(10,8,2021), "Banana", false);
System.out.println(f2);
f2.peelBanana();
}
}
import java.util.Date;
public class Apple extends Fruit {
boolean hasStem;
public Apple() {
hasStem = false;
}
public Apple(Date d, String n, boolean b) {
super(d, n);
hasStem = b;
}
public boolean isHasStem() {
return hasStem;
}
public void setHasStem(boolean hasStem) {
this.hasStem = hasStem;
}
public double calculateTotalCalories() {
return 550.0;
}
public String toString() {
return super.toString() + ", hasStem=" + hasStem;
}
}
import java.util.Date;
public class Banana extends Fruit {
boolean isPeeled;
public Banana() {
isPeeled = false;
}
public Banana(Date d, String n, boolean b) {
super(d, n);
isPeeled = b;
}
public boolean isPeeled() {
return isPeeled;
}
public void peelBanana()
{
if(!isPeeled)
{
System.out.println("Peeling....");
isPeeled=true;
}
else
{
System.out.println("Banana already peeled...");
}
}
import java.util.Date;
public class Fruit {
Date datePicked;
String name;
/**
* Instantiates a new Fruit.
*/
public Fruit() {
datePicked = new Date();
name = "";
}
public Fruit(Date d, String n) {
datePicked = d;
name = n;
}
/**
* @return the datePicked
*/
public Date getDatePicked() {
return datePicked;
}
Purchased 3 times