December
1999 QUESTION 1 (Compulsory) Total Marks: 30 Marks |
Click here to access other
questions
Click to access |
(a) |
(i)Explain what is meant by the Java Virtual Machine .[2 marks ] (ii)Explain why the concept of the virtual machine adds to the portability of code.[2 marks ]
|
[4] |
(b) |
Define what is meant by the terms: (i)Encapsulation.[1 mark ] (ii)Polymorphism.[1 mark ]
|
[2] |
(c) |
Java supports single inheritance . (i)Explain what is meant by the term single inheritance .[1 mark ] (ii)Name the construct which is supplied in order to allow programmers to employ multiple inheritance techniques.[1 mark ]
|
[2] |
(d) |
(i)Briefly identify the difference between a class and an object .[2 marks ] (ii)State the purpose of a class constructor.[1 mark ] (iii)State the purpose of a class destructor.[1 mark ]
|
[4] |
(e) |
Define a class,called Employee,
which contains the following members:
|
[4] |
(f) |
(i)Write a method,called Test ,the signature
of which is given below,which takes in a single char parameter x .The
method should return 0 if the parameter is equal to a ,1 if the parameter
is equal to b ,and -1 otherwise. (ii)Write an iterative method,called
Sum ,the signature of which is given below, which takes a single integer
parameter x ,and will return the sum of all the integers from 0 to
x .You may assume that x will always be a positive integer. (iii)In mathematics,N!(known as N factorial
)can be computed using the formula N!=N*((N-1)!). |
[14] |