Question
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 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 Computer Graphics and Image Processing
(a) Describe the A-buffer polygon scan conversion algorithm using 4×4 sub-pixels
in each pixel. [10 marks]
(b) It is possible to represent continuous tone greyscale images using just black
ink on white paper because of limitations in the human visual system. Explain
how and why. [4 marks]
(c) Describe an algorithm which, given a greyscale image, will produce a black
and white (bi-level) image of four times the resolution in each dimension which
provides a good approximation to the greyscale image
Write program that reads a sequence of integers into an array and that computes the alternating sum of all elements in the array.
a Java program that reads a 1D array of integers from standard input and returns it.
(a) (i) Explain the difference with respect to polymorphic occurrences of variables
between the way let-bound and lambda-bound variables are treated in
languages featuring ML-style polymorphism. Illustrate your answer by
explaining why in the Mini-ML language one of the two expressions
λg (let f = λx (let u = g x in x) in f f)
let f = λx (let u = x in x) in f f
is typeable and the other is not. As part of your answer you should define
what it means for a type to be a specialisation of a type scheme and
give the Mini-ML typing rules for variables, function abstractions, function
application and let-expressions. [14 marks]
(ii) What property of the type system is lost if one attempts to treat
polymorphic occurrences of lambda-bound variables in the same way as
let-bound ones? [1 mark]
(b) Give the typing rules for expressions associated with ML-style reference types,
namely reference creation ref M, reference look-up !M and assignment M :=M0
expressions. What is the value-restriction that is imposed on the typing rule
for let-expressions in the presence of these forms of expression and what is its
purpose?
A zoologist wants to record the echo-location sounds emitted by a bat. The species
of bat to be recorded emits only sounds in the frequency range 40 kHz to 80 kHz and
the microphone used includes an analog filter with that passband.
(a) Explain for each of the following sampling techniques how it can be used to
convert a continuous ultrasonic microphone signal x(t) into a discrete-time
sequence {xn} and state for each technique the lowest sampling frequency fs
that enables the exact reconstruction of x(t) from {xn}:
(i) Passband sampling [3 marks]
(ii) IQ downconversion [5 marks]
(b) Using a 32-bit floating-point data type, how many bytes per second are required
to store each of the two resulting discrete sequences from part (a)? [2 marks]
(c) Compare your answers to part (b) with the memory required for storing x(t)
sampled at the Nyquist rate of 160 kHz and explain the difference in terms of
redundancy in the acquired spectrum. [2 marks]
(d) If the sampling techniques from part (a) are applied to a test signal x(t) =
cos(2πf t) with f = 45 kHz, what does the discrete-time Fourier transform of
the resulting discrete sequence {xn} look like (over the normalized frequency
range −π < ω˙ ≤ π) for each technique? [4 marks]
(e) For both sampling techniques described in part (a), briefly outline the steps
needed to reconstruct the original continuous waveform from the discrete
sequence.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started