August 2000 QUESTION 1 (Compulsory) Total Marks: 30 Marks |
Click here to access other
questions
Click to access |
(a) Java is an object oriented language. Give two main characteristics of an object oriented language. [2 marks] (b) State the scope of members of a
class if declared: (c) Explain the difference between a class and an object. [2 marks] (d) A Book is a type of class which
contains a number of pages, which is an int, and an array of pages,
which is a private class. (e) Give the result of evaluating the
following expressions: (f) (i) In order to calculate x^ y,
we can recursively calculate x *( x ^ (y - 1) ) until we reach the
base case x^ 1 = x. Write a recursive method, called Power, the signature
of which is given below, which takes in two ints, a mantissa, and
an exponent. The method should return the result of raising the mantissa
to the power exponent, using the method of calculating this given
above. |