DIT410  JAVA PROGRAMMING.

UNIVERSITY EXAMINATIONS: 2016/2017
EXAMINATION FOR DEGREE OF DIPLOMA IN INFORMATION TECHNOLOGY
DIT410 JAVA PROGRAMMING
MODE: FULL TIME/PART TIME
DATE: JULY, 2017 DURATION 2 HOURS
INSTRUCTION: Answer Question One & ANY OTHER TWO questions.

QUESTION ONE [30 MARKS] – COMPULSORY
a) Describe any THREE characteristics of object–oriented programming.
[6 Marks]
b) Describe the FOUR basic concepts of object oriented programming.
[4 Marks]
c) Discuss the TWO key components of java platform.
[4 Marks]
d) Discuss the differences between a process and a thread in java
[4 Marks]
e) Discuss the life cycle of a thread.
[6 Marks]
f) Discuss the process of exception handling in Java.
[6 Marks]
QUESTION TWO [20 MARKS]
a) Describe the following components of a method in java.
i. Visibility
ii. Method name
iii. Parameter list
iv. Return type
[4 Marks]
b) Differentiate between an error and exception.
[2 Marks]
c) Briefly explain five methods used in stringBuffer class.
[5 Marks]
d) Briefly explain the following keywords as used in java exception handling
a. Try
b. Catch
c. Throw
d. Finally
[4 Marks]
e) Write a GUI program in java to display the following input dialog.
[5 Marks]
QUESTION THREE [20 MARKS]
a) Briefly describe the differences between primitive and reference data types.
[2 Marks]
b) Briefly describe the numeric and non-numeric data types in java.
[4 Marks]
a) Differentiate between static, instance and local variables.
[6 Marks]
b) Differentiate between widening and narrowing casting in java.
[2 Marks]
c) Write a program in java to demonstrate narrowing of the types, double, float, integer and long.
[6 Marks]
QUESTION FOUR [20 MARKS]
a) Describe the following accessibility modifiers in java.
i. Default
ii. Private
iii. Public
iv. Protected
[4 Marks]
b) Write a java program that uses overloaded method called Add() to calculate and display the sum
floating point values keyed in by the user.
[6 Marks]
c) Discuss the concept of method overriding using the program below:
class Part{
void Display(){
System.out.println(“We sell spare parts”);
}
}
class BiCyclePart extends Part{
void Display(){
System.out.println(“We do not sell bicycle parts”);
}
public static void main(String args[]){
BiCyclePart p = new BiCyclePart();
p.Display();
}
[6 Marks]
d) For each of the following java operators state the associativity
i. New
ii. []
iii. ++
iv. &
[4 Marks]
QUESTION FIVE [20 MARKS]
a) Write the following lines of code using if…else statement in java.
int num=x>y? x+1:x+2
[3 Marks]
b) What are the values of i and n after the following code is executed.
int i =10;
int n=i++%5;
[2 Marks]
c) Write a java program to store student marks and grades. Assume there are 5 students.
[6 Marks]
d) Outline THREE disadvantages of arrays.
[3 Marks]
e) Write a program that will read a string and rewrite it in alphabetical order
[6 Marks]

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

Written by