DIT410  JAVA PROGRAMMING .

UNIVERSITY EXAMINATIONS: 2018/2019
EXAMINATION FOR DIPLOMA IN INFORMATION
TECHNOLOGY
DIT410 JAVA PROGRAMMING
MODE: FULL TIME/PART TIME
ORDINARY EXAMINATIONS
DATE: NOVEMBER, 2018 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO.

QUESTION ONE [30 MARKS]
a) Briefly explain the following components in java platform:
i. JDK
ii. JRE
iii. JVM
[6Marks]
b) Explain the components of the Java main method below:
public static void main(String args[]).
[5 Marks]
c) Java is considered to be platform independent. Explain.
[3 Marks]
d) Differentiate between method overloading and method overriding in Java.
[6 Marks]
e) Explain the differences between processes and threads as used in Java.
[2 Marks]
f) Explain any six available thread states during execution of program in Java.
[6 Marks]
g) Explain the differences between the two types of exceptions in Java.
[2 Marks]
QUESTION TWO [20 MARK]
a) Explain the differences between double and float types in Java.
[4 Marks]
b) Differentiate between widening and narrowing casting in java.
[4 Marks]
c) Briefly explain the concept of packages in Java.
[3 Marks]
d) Discuss the strictfp modifier keyword as used in Java.
[3 Marks]
e) Assuming x and y are java variables assigned integer values of 23 and 27 respectively. Predict the
output of the following java statements.
i. System.out.println(x^y);
ii. System.out.println(x|y);
iii. System.out.println(x&y);
[6 Marks]
QUESTION THREE [20 MARKS]
a) Write a Java program to declare two number variables, one float variable, and one string variable and
assign 1250, 12.50, and “Java programming” to them respectively. Then display their values on the
screen.
[5Marks]
b) Explain any four differences between StringBuffer and StringBuilder in Java programming.
[4 Marks]
c) Briefly explain the concept of a block statement in Java Programming.
[2 Marks]
d) Show and explain the exact output that would be produced by the following Java program:

[9 Marks]
QUESTION FOUR [20MARKS]
a) Write a Java program that converts gallons to liters. The program should display gallons from 10
to 20 in one-gallon increments and the corresponding liter equivalents. Use the relationship of
3.785 liters to a gallon.
[10 Marks]
b) With regard to Java API, swing is a set of program components that provide the ability to create
graphical user interface (GUI) components, such as buttons and scroll bars, that are independent
of the windowing system for specific operating system. Using swing, write a Java program to
display the window below:

QUESTION FIVE [20 MARKS]
a) Write a Java Program to read an integer number keyed in by the user, then reverse the digits and display
the reversed number on the screen. Hint: Use while loop.
[8 Marks]
b) Discuss the following exception handling operations in Java programming.
i. Declaring exceptions
ii. Throwing an exception
iii. Catching an exception
[6 Marks]
c) Write a Java Program to receive 10 integers keyed in by the user, store them in an array, sort them in
ascending order and display the sorted numbers on the screen. Hint use for loop.
[6 Marks]

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

Written by