UNIVERSITY EXAMINATION 2020/2021
YEAR 2 SEMESTER II EXAMINATION FOR THE DEGREE OF BACHELOR OF
SCIENCE IN COMPUTER SCIENCE /SOFTWARE ENGINEERING /COMPUTER
SYSTEMS ENGINEERING/INFORMATION TECHNOLOGY
SPC 2206 SPE 2206 Object Oriented Programming II Advanced Object Oriented
Programming Year 2 Semester II
Date: Thursday 16th September, 2021 Time: 8.30 am- 10.30 am
Instructions
Attempt question ONE and ANY OTHER TWO Questions
Question One
a) Explain the two types of polymorphism in Object Oriented Programing. (4 Marks)
b) Describe two benefits of threads in network programming in Java. (4 Marks)
c) Using a diagram, explain multilevel inheritance. (4 Marks)
d) Write a sample code to demonstrate method overloading in Java. (4 Marks)
e) Distinguish between a frame and a panel as used in Java GUI programming.
(3 Marks)
f) Write an Object Oriented Program in Java to calculate sum of even numbers
between 0 and 200. (5 Marks)
g) Using examples describe exception as used in Java programming. (2 Marks)
h) Write a GUI program to display the following window. (4 Marks)
Page 1 of 3
Question Two
a) Write an OOP program in Java to convert degrees celsius to fahrenheit.
The program should include a default constructor. Hint:
Fahrenheit= (°C × 9/5) + 32 (8 Marks)
b) Describe message passing concept as used in OOP programming. (3 Marks)
c) Using the knowledge of exception handling, write a program to calculate
the area of a trapezium. (7 Marks)
d) Outline two advantages of implementing inheritance during program
development. (2 Marks)
Question Three
a) Write a GUI program that can display the interface of an email message
as shown below. (7 Marks)
b) Write an Object Oriented Program code snippet in Java to demonstrate
function Overloading. (7 Marks)
c) Explain any three access modifiers used in Java Programming. (6 Marks)
Question Four
a) Write an Object Oriented Program in Java using single inheritance to
calculate area of a rectangle and square. (7 Marks)
b) Explain any two benefits of garbage collection. (4 Marks)
c) Using examples, describe any three built-in Packages used in Java
programs. (6 Marks)
d) Using class PersonalDetails, write a code snippet for a Java parameterized
constructor. (3 Marks)
Question Five
a) Write an OOP program in Java to create a server socket, wait for client
request, and then respond to a client that requested it. (8 Marks)
Page 2 of 3
b) Using examples, distinguish between a heavy weight and lightweight
Java containers. (4 Marks)
c) Write an Object Oriented Java program to capture three numbers,
compare them and display the largest. (8 Marks)
Page 3 of 3