Get premium membership and access revision papers, questions with answers as well as video lessons.

Cisy 210:Object Oriented Programming Question Paper

Cisy 210:Object Oriented Programming 

Course:Computer Science

Institution: Kenya Methodist University question papers

Exam Year:2015



KENYA METHODIST UNIVERSITY

END OF 1''st ''TRIMESTER 2015 (PT) EXAMINATION
FACULTY : COMPUTING & INFORMATICS
DEPARTMENT : COMPUTER SCIENCE
UNIT CODE : BBIT 223/CISY 210
UNIT TITLE : OBJECT ORIENTED PROGRAMMING
TIME : 2 HOURS




INSTRUCTIONS:

Answer ALL questions in Section A and any other two questions in Section B.

SECTION A:

Question One

Differentiate between source code, source file and byte code; demonstrate this using a suitable example.

(5 marks)

List the three categories of variables; hence show how a variable is declared in Java using a suitable example

(4 marks)

Using three steps describe how to create an array of data items; hence show this using an example of your choice.

(5 marks)

List four items you need to declare a method of Java.

(4 marks)

Differentiate between the "is – a" and "has – a" relationship in Java, giving a suitable example of each.

(4 marks)

What does the term loose coupling mean in object oriented programming? Hence list three advantages of loose coupling.

(4 marks)

List two ways of handling exceptions

(2 marks)

Differentiate between method overriding and method overloading (2 marks)

SECTION B:

Answer any two questions from this section

Question Two

Seafaring Ltd is running a promotion for all their customers. When a customer makes a purchase for electric goods the system awards the customer 10% of the purchase value as points. In reality, however, the customer is awarded 40% in points of the profit on that particular sale. Non-electric goods are not awarded any points. At the end of the promotion period customers who have accumulated over 1000 points will all be awarded random rewards. The management are concerned that this little trick they are using will be discovered when a customer called Mutua who is IT savvy comes calling. Write a program that will allow Mutua to enter all his sales for the month show him his points as 10% of purchase price but still award him points based on the 40% rule. i.e. what it displays and what it stores are different values.

(18 marks)

List and briefly describe three characteristics of effective encapsulation using suitable examples.

(7 marks)

Question Three

List the access modifiers applicable to the following:
Class
Sub class
Package

World

(8 marks)

A simple library information system is supposed to store details about books. The program will check how many books a user has borrowed at a given time and check the following.
Number of books borrowed by the user
If the user has any books that have been out for more than 21 days they will pay a fine at the rate of ten shillings per day.
If the user has borrowed more than three books the program will display a message to that effect and not allow him to borrow.

Demonstrate this using a Java program (7 marks)

Question Four

Define the term encapsulation and tight encapsulation. Hence demonstrate encapsulation using two programs of your choice, one showing tight encapsulation and the other normal encapsulation; make sure you use appropriate comments to differentiate the two types of encapsulation.

(7 marks)

Write a program that demonstrates how to get connected with a web server by using sock-getInet Address () method of net-socket class (you will need to import Java.net.*)

(8 marks)






More Question Papers


Popular Exams


Mid Term Exams

End Term 1 Exams

End Term 3 Exams

Opener Exams

Full Set Exams



Return to Question Papers