0% found this document useful (0 votes)
47 views

SPC 2206 Spe 2207 Object Oriented Programming II Year II Semester II-1

Best

Uploaded by

nyakundip11
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

SPC 2206 Spe 2207 Object Oriented Programming II Year II Semester II-1

Best

Uploaded by

nyakundip11
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

UNIVERSITY EXAMINATION 2022/2023

YEAR II SEMESTER II EXAMINATION FOR THE DEGREE OF BACHELOR OF


SCIENCE IN COMPUTER SYSTEMS ENGINEERING/ SOFTWARE
ENGINEERING/COMPUTER SCIENCE/INFORMATION TECHNOLGY

spc 2206/ spe 2207: object oriented programming ii /

advanced object oriented programming

DATE: MONDAY 17TH APRIL 2023 TIME: 8.30 AM – 10.30 AM


Instructions: Attempt question ONE and ANY OTHER TWO Questions

Question One
a) Describe the following Object Oriented terminologies as used in Java.
(3 Marks)
i. Packages
ii. Interfaces
iii. Garbage collection
b) Using sample codes, describe the term Java Socket as used in Java programming.
(3 Marks)
c) Write a code snippet to demonstrate how to declare a constant using the final
keyword in Java. (3 Marks)
d) Distinguish between inheritance and polymorphism. (4 Marks)
e) Describe the term namespace as used in Java Programming. (2 Marks)
f) Write a code snippet to create the frame below in Java. (4 marks)

g) Describe any four elements of Graphical User Interface Programming in Java.


(4 Marks)
h) Write a Java code snippet to demonstrate function overloading. (4 Marks)
i) Describe any three benefits of writing programs using the concept of inheritance.
(3 Marks)
Question Two
a) Using the concept of Exception handling, write a Java program to calculate factorial
of any positive integer provided through the keyboard. (8 Marks)
b) Explain any two advantages of garbage collection in Java programming.
(4 Marks)
c) Write a Java Graphical User Interface program that can produce the following
interface. (8 Marks)

Page 1 of 3
Question Three
a) Using super class ‘Animal’, base class ‘Horse’ and a method called ‘sound’, Write a
code snippet to demonstrate runtime polymorphism in Java. (7 Marks)
b) Write a Java program that can take two parameters and determine whether they are
equal or not. The program should be implemented using the following: a
constructor and a method named ‘compare’. (7 Marks)
c) Distinguish between the following terminologies. (6 Marks)
i. Function definition and function declaration
ii. Class and object
iii. Stubs and skeletons

Question Four
a) A second year Bachelor of Science in Mathematics and Computer Science student
was tasked to write a Java program that can calculate area of various shapes.
Assuming you are the student, using the concept of inheritance and class ‘Rectangle’
as the base class, ‘Square’ as the derived class. Write the above Java program.
(8 Marks)
b) Write a code snippet to demonstrate how a parameterized constructor can be used
to initialize data members ‘length’ and ‘width’ in class ‘Shape’. (6 Marks)
c) Using for structure, write an Object Oriented Program to calculate sum of odd
numbers between 15 and 70. (6 Marks)

Page 2 of 3
Question Five
a) Using sample codes, describe three ways an object can be unreferenced in Java.
(6 Marks)
b) Using the knowledge of Sockets, write a TCP Server code snippet that sends the
Client the current date and time when the Client connects; then closes the
connection. (6 Marks)

c) Using class ‘Student’, write code snippets to describe two types of constructors that
can be used in Java programming. (8 Marks)

Page 3 of 3

You might also like