DIT410  JAVA PROGRAMMING.

UNIVERSITY EXAMINATIONS: 2017/2018
ORDINARY EXAMINATION FOR THE DIPLOMA IN
INFORMATION TECHNOLOGY
DIT 410: JAVA PROGRAMMING
FULL TIME/PART TIME
DATE: MARCH, 2018 DURATION: 1 ½ HOURS
INSTRUCTIONS: Answer any THREE questions.

QUESTION ONE [20 MARKS]
a) Describe the four basic principles of object oriented programming.
4 Marks
b) Briefly explain the following concepts associated with Java as a programming language:
i. Simplicity
ii. Robustness
2 Marks
c) Write a java program to swap two values keyed in by the user. The two values must be stored in a
local variables x1 and x2.
4 Marks
d) Briefly describe the eight (8) primary data types in Java language.
8 Marks
e) Outline TWO disadvantages of arrays.
2 Marks
QUESTION TWO [20 MARKS]
a) Describe the general syntax of a java program.
4 Marks
b) Briefly describe static, instance and local variables.
6 Marks
c) Write a java program to read temperature in degrees Fahrenheit then convert to degree Celsius using
the formula: C=(F-32) *5/9, where C and F represent temperature in Celsius and Fahrenheit
respectively.
4 Marks
d) Briefly explain the following classes is used in string reference types.
i. String
ii. StringBuffer
iii. StringBuilder
6 Marks
QUESTION THREE [20 MARKS]
a) In java programming, a method can be defined as a named group of statements that perform a specific
task in the program. In this regard, describe the syntax of a method in java.
6 Marks
b) Define the concept of class as used in java programming.
4 Marks
c) In a bank account management system, the details such as account number, account name, deposits
and withdrawal are to be captured by the system. Write a java program to use two class methodsgetAccountDetails () and Display (). The method getAccountDetails () will get values of account
number, account name, deposits and withdrawal through the keyboard for three customers. The
Display () method will calculate and display account number, account name, deposits, withdrawal and
balance for the three customers. Hint balance=deposit-withdrawal.
10 Marks
QUESTION FOUR [20 MARKS]
a) Write a java program to receive two string values then using StringBuilder class do the following:
Reverses characters in the first string
Insert characters “abc” in the first string

Concatenate thee two strings
9 Marks
b) In java programming, interface can be defined a collection of abstract methods. Explain three uses of
interface in java.
6 Marks
c) Write a java program to display the following input dialog:
5 Marks


QUESTION FIVE [20 MARKS]
a) Differentiate between method overloading and method overriding in java.
4 Marks
b) Describe two ways for overloading a method in java
4 Marks
c) Differentiate between checked and unchecked exceptions. Give an example for each.
3 Marks
d) Discuss the life cycle of a thread in java
5 Marks
e) Differentiate between continue and break statements in a loop.
4 Marks

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

Written by