6 CST.99.3.7 10 Numerical Analysis I Define absolute error, relative error and machine epsilon m. Although m
Question:
6 CST.99.3.7 10 Numerical Analysis I Define absolute error, relative error and machine epsilon m. Although m is defined in terms of absolute error, why is it useful as a measurement of relative error? In Java, expressions are evaluated strictly left-to-right. Consider compiling
the function f in the following Java class definition:
class A
{
static int a,b;
void f() { ... <
int g(int x) { ... a++; ... }
};
Indicate what both the intermediate code and (improved as above) target code
might be for <
(i) b = g(7) + a;
(ii) b = a + g(7);
(iii) b = (-g(7)) + a;
(iv) b = a - g(7);
Comment on any inherent differences in efficiency at both the intermediate
code and target code levels.
[8 marks]
7 [TURN OVER
CST.2005.5.8
7 Comparative Programming Languages
Most large programs that have been written with considerable care and thoroughly
checked still seem to contain bugs at a rate of over one per 3000 lines of source
code. Systems involving hundreds of millions of lines of code can thus be expected
to contain tens of thousands of potentially catastrophic errors. 7 Operating System Functions Why is it important for an operating system to schedule disc requests? [4 marks] Briefly describe each of the SSTF, SCAN and C-SCAN disc scheduling algorithms. Which problem with SSTF does SCAN seek to overcome? Which problem with SCAN does C-SCAN seek to overcome? [5 marks] Consider a Winchester-style hard disc with 100 cylinders, 4 double-sided platters and 25 sectors per track. The following is the (time-ordered) sequence of requests for disc sectors: { 3518, 1846, 8924, 6672, 1590, 4126, 107, 9750, 158, 6621, 446, 11 } The disc arm is currently at cylinder 10, moving towards 100. For each of SSTF, SCAN and C-SCAN, give the order in which the above requests would be serviced. [3 marks] Which factors do the above disc arm scheduling algorithms ignore? How could these be taken into account? [4 marks] Discuss ways in which an operating system can construct logical volumes which are (a) more reliable and (b) higher performance than the underlying hardware. [4 marks] 5 [TURN OVER CST.2000.4.6 8 Computation Theory Let N be the natural numbers {0, 1, 2 . . . What is meant by each of the following statements? The subset S N is recursive. The subset S N is recursively enumerable. [5 marks] How would you extend the definition of recursive enumeration to sets of computable functions? [3 marks] A sequence of natural numbers is a total function s : N N. The sequence is recursive if and only if s is computable. A finite sequence of natural numbers is specified by a pair (l, x), where l N is the number of elements, and x : [1, l] N is a function that defines those elements. The case l = 0 defines the null sequence. In each of the following cases, establish whether the set defined is recursively enumerable: (a) the set of all recursive subsets of N [5 marks] (b) the set of all recursive sequences of natural numbers [2 marks] (c) the set of all finite sequences of natural numbers [5 marks] If a continuous signal is discretely sampled by multiplying it with a sequence of uniformly-spaced Dirac delta functions, having frequency fs, what happens to the Fourier spectrum of the signal? [3 marks] (b) What is the conditional probability p(x|y), the probability of event x given that event y has occurred, provided that we know the following? p(x), the unconditional probability of event x p(y), the unconditional probability of event y p(y|x), the probability of event y given that event x has occurred [3 marks] What is the state transition diagram for this mystery module?
Chemical Principles The Quest For Insight
ISBN: 9781464183959
7th Edition
Authors: Peter Atkins, Loretta Jones, Leroy Laverman