DIT 408 JAVA PROGRAMMING.

UNIVERSITY EXAMINATIONS: 2013/2014
ORDINARY EXAMINATION FOR THE DIPLOMA IN
INFORMATION TECHNOLOGY
DIT 408 JAVA PROGRAMMING
DATE: AUGUST, 2014 TIME: 1½HOURS
INSTRUCTIONS: Answer Any Three Questions.

QUESTION ONE
a) List four features of java [4 Marks]
b) List the importance of using comments in java. Describe using examples single
line and multiline comments [6 Marks]
c) List and explain three types of variables used in java [6 Marks]
d) Differentiate between object oriented programming languages and event driven
programming [2 Marks]
e) List three rules of naming variables [2Marks]
QUESTION TWO
a) Explain the meaning of the following escape sequences [4 Marks]
i. \n
ii. \t
iii. \b
iv. \’
b) Discuss the following elements of OOP [8 Marks]
c) Create a class named Commission that includes three variables: a double sales
figure, a double commission rate, and an integer commission rate. Create two
overloaded methods named compute Commission(). The first method takes two
double arguments representing sales and rate, multiplies them, and then displays
the results. The second method takes two arguments: a double sales figure and an
integer commission rate. This method must divide the commission rate figure by
100.0 before multiplying by the sales figure and displaying the commission.
Supply appropriate values for the variables, and write a main() method that tests
each overloaded method. [8 Marks]
QUESTION THREE
a) A cloth showroom has announced the following seasonal discounts on purchase
of items
Purchase Amount Discount
Mill Cloth Handloom Items
0-100 ____ 5.0%
101-200 5.0% 7.5%
201-300 7.5% 10.0%
Above 300 10.0% 15.0%
Write a program using switch and if statements to compute the net amount to be
paid by a customer [8 Marks]
b) Complete the table below by stating the name and an example of the operators
[4 Marks]
Operator Meaning Example
%
++
+=
x&=y
c) Differentiate between the following [6 Marks]
i. superclass and subclass
ii. overloading and overriding
iii. Aggregation and containment
d) Describe how you compile and run a java program [2 Marks]
QUESTION FOUR
a) Discuss the following elements of OOP [8 Marks]
i. Encapsulation
ii. Information Hiding
iii. Inheritance
iv. Polymorphism.
b) What is the difference between a break statement and a continue statement use
examples [2 Marks]
c) What is package in JAVA? [2 Marks]
d) Give 5 features of Java Programming Language [5 Marks]
QUESTION FIVE
a) The numbers in the sequence
1 1 2 3 5 8 13 21…
are called fibonacci numbers. Write a programming using a do…while loop to
calculate and print the first m fibonacci numbers
(Hint: After the first two numbers in the series, each number is the sum of the two
preceding numbers) [6 Marks]
b) Explain five method access modifiers used in java [10 Marks]
c) Differentiate between a package and interface [4 Marks]

(Visited 152 times, 1 visits today)
Share this:

Written by