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

Object Oriented Programming Ii Question Paper

Object Oriented Programming Ii 

Course:Bachelor Of Science In Computer Science

Institution: Kenyatta University question papers

Exam Year:2012



KENYATTA UNIVERSITY
UNIVERSITY EXAMINATIONS 2011/2012
SECOND SEMESTER EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN COMPUTER SCIENCE
SCT 105: OBJECT ORIENTED PROGRAMMING II

DATE: WEDNESDAY 11TH APRIL 2012 TIME 2.00 P.M - 4.00 P.M

INSTRUCTIONS
Aswer Question 1 and any other Two Questions.

QUESTION 1 (30 MARKS)

a) Explain why java can be written and compiled o one platform and then executed on a different platform (6 Marks)

b) State and explain four advantages of Java as an object oriented programming language. (4 Marks)

c) By use of relevant examples, state the difference between a statement and a block.(4 Marks)

d) Explain the following terms: (6 Marks)
i)inheritance:
ii)encapsulation:
iii)polymorphism:

e) State four differences between applications and applets in java programming language.(4 Marks)

f) State and explain the usage of any three modifiers in java programming language. (6 Marks)


QUESTION 2 (20 MARKS)

a) Differentiate between abstract classes and interfaces as opposed in object oriented programming (4 Marks)

b) Discuss the importance of threads in Java language (4 Marks)

c) Explain the difference between AWT components and the Swing components using examples (6 Marks)

d) Differentiate between the following layout managers (6 Marks)
i.Grid Layout Manager
ii.Flow Layout Manager
iii.Border Layout Manager

QUESTION 3 (20 MARKS)

a) Explain the procedure for converting an applet to an application. (6 Marks)

b) State and briefly describe the four methods that define the structure of an applet.(8 Marks)

c) Write an applet that displays the string "This is my first applet".(4 Marks)

QUESTION 4 (20 MARKS)

a) Write a java program that prompts the user to enter the amount of rainfall recorded every month of the year and then display the output in reverse order. The user should get a prompt to enter the amount of rainfall as illustrated below: (10 Marks)

Enter Rainfall for Month 1: 50
Enter Rainfall for Month 2: 100
.
.
.
.
Enter Rainfall for Month 12: 67

The program should then give an output as illustrated below:
Month 12:67
.
.
.
.
Month 2:100
Month 1:50

b) Write a java program that prompts the user to enter their name and then return the length of their name plus the first character of the name.(10 Marks)

Sample output:

Enter Your First Name
Bildad
The length of your name is: 6
The first letter of your name is: B

QUESTION 5 (20 MARKS)

a) A local bank has approached you to create a software with the following functionalities
i)Accepting deposits
ii)Withdrawals
iii)Check account balances
iv) Perform withdrawals
Implement methods to perform the above functions.
NB:Withdrawal of funds from an account can only if there is sufficient funds in the account.
Transfer of funds from an account can only be possible if there are sufficient funds in the original account

b) Differentiate between an accesor method and a mutator method by use of an appropriate example in question 5a. (4 Marks)

c) State and explain 2 errors encountered in java and explain their causes. (4 Marks)






More Question Papers


Popular Exams



Return to Question Papers