UNIVERSITY EXAMINATIONS: 2024/2025
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN
SOFTWARE DEVELOPMENT
BSD 2304 ADVANCED JAVA PROGRAMMING
FULLTIME/ PART TIME/DISTANCE LEARNING
ORDINARY EXAMINATION
DATE: APRIL, 2025 TIME: 2 HOURS
INSTRUCTIONS: Question One Is Compulsory, Choose Two Other Questions
QUESTION ONE (20 MARKS) COMPULSORY
a) Define the following terms as used in distributed Java applications:
i. JavaBeans (1 Marks)
ii. Remote Method Invocation (RMI) (1 Marks)
iii. Java Database Connectivity (JDBC) (1 Marks)
iv. Servlet (1 Marks)
v. Socket (1 Marks)
b) Explain the life cycle of a Java servlet. (5 Marks)
c) Differentiate between Swing and AWT in Java GUI programming. (5 Marks)
d) Write a Java program using JDBC to connect to a MySQL database named student_db and
retrieve all records from a table called students. (5 Marks)
QUESTION TWO (15 MARKS)
a) Describe the ResultSet object and its importance when handling SQL queries in JDBC.
(4 Marks)
b) a) Write a Java program to create a simple TCP server that listens for client connections on
port 8080 and sends back a welcome message. (5 Marks)
c) Write the corresponding Java TCP client program that connects to the server and prints the
received message. (4 Marks)
d) Explain how stub and skeleton work in Java RMI. (2 Marks)
QUESTION THREE (15 MARKS)
a) Describe two importance of JavaBeans in software development. (4 Marks)
b) Write a simple JavaBean class named StudentBean with properties name and age, including
getter and setter methods. (3 Marks)
c) Explain the three-tiered layering of Java RMI and its significance in distributed applications.
(6 Marks)
d) Describe the role of Session Tracking in servlets. (2 Marks)
QUESTION FOUR (15 MARKS)
a) Write a simple servlet that retrieves a user’s name from an HTML form and displays a
personalized welcome message. (5 Marks)
b) What is the difference between synchronized methods and synchronized blocks in Java
(2 Marks)
c) Explain how multithreading improves the performance of a server application. (3 Marks)
d) Write a Java program that implements a multi-threaded server that can handle multiple
client requests using Thread class or ExecutorService. (5 Marks)