UNIVERSITY EXAMINATIONS: 2023/2024
EXAMINATION FOR THE DEGREES OF BACHELOR OF
SCIENCE IN IN INFORMATION TECHNOLOGY/ BUSINESS
I.T/APPLIED COMPUTING/ SOFTWARE DEV./INFO. SECURITY&
FORENSICS
BIT 2204A/ BBIT 310 /BAC 2201/ BSD 2107/BISF 2201:
JAVA PROGRAMMING
PART TIME/FULL TIME/DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: APRIL, 2024 TIME 2 Hours
INSTRUCTIONS: Answer Question ONE and ANY other TWO questions
Question One (20 marks) (Compulsory)
a) Explain the following terms as used in JAVA programming.
a) Character stream (2 marks)
b) Thread (2 marks)
c) IDE (2 marks)
b) Construct a switch statement with a suitable default case for the input below so as to generate
the specified output: (4 marks)
Input Output
S “Single”
M “Married”
D “Divorced”
c) A student read a program and found some access specifiers in it. Highlight their uses
i) Public (2 marks)
ii) Private (2marks)
iii) Protected (2 marks)
d) Using suitable examples distinguish between error and exceptions. (2 marks)
e) List two methods of flow control in JAVA. (2 marks)
Question 2(15 marks).
a) Using a suitable java code, show how java handles exception using blocks (4 marks)
b) Using suitable code examples highlight two methods of concatenating text in JAVA
programming. (4 Marks)
c) Consider a JDframe form shown below.
The user is expected to input course work in the text field known as cats and exams
marks in the text field known as Exams. Upon pressing the save button, the system sums
the cats and exams in the Total text field and calculate the grade using the following
criteria:
Total MARKS GRADE
>=70 A
60-69 B
50-59 C
40-49 D
<40 E
Required:
i. Write Java Skeleton code to calculate total marks (2 marks)
ii. Write Java Skeleton code to calculate the grade (5 marks)
Question 3(15 marks).
a) Explain the output from the following JAVA bit wise operations
i. 9^5 (3 marks)
ii. 7 << 3 (3 marks)
b) Explain the following types of casting as used in JAVA programming
i. int myInt = 9; double myDouble = myInt; (2 marks)
ii. double myDouble = 9.78d; int myInt = (int) myDouble; (2 marks)
c) Using a suitable diagram describe clearly the Java architecture (5 marks)
Question 4( 15 marks).
a) i)List the two types of polymorphism (2 marks)
ii) Using suitable program code implement the polymorphism discussed in i) above
(6 marks)
b) James a student in KCA university wanted to create a program using JAVA programming
language. Justify using two points his choice JAVA over others. (4 marks)
c) Highlight three tools for creating GUI programs in JAVA. (3 marks)