Get premium membership and access revision papers, questions with answers as well as video lessons.
Got a question or eager to learn? Discover limitless learning on WhatsApp now - Start Now!

Cisy 210:Object Oriented Programming  Question Paper

Cisy 210:Object Oriented Programming  

Course:Computer Science

Institution: Kenya Methodist University question papers

Exam Year:2014



KENYA METHODIST UNIVERSITY

END OF 2''ND ''TRIMESTER 2014 (SB) EXAMINATION
FACULTY : EDUCATION AND SOCIAL SCIENCES
DEPARTMENT : EDUCATION
UNIT CODE : BBIT 223/CISY 210
UNIT TITLE : OBJECT ORIENTED PROGRAMMING
TIME : 2 HOURS





INSTRUCTIONS: Answer Question ONE and any Other TWO

Question One

Explain the function of the following access specifies as used in java:
Static
Protected

Default

(6marks)

In java how do you prevent a class from being extended?

(4marks)

Distinguish between interfaces and abstract dresses and give the importance of each.

(6marks)

Explain the difference between method overloading and method overriding.

(6marks)

With the help of a program, describe the principle of polymorphism in java.

(4marks)

What is the value of y after the following switch statement is executed?

x= 3 ; y=3

switch (x+3)

{

case 6 : y=1;

default: y +=1;

What is the cause of the following errors?

i) no suchmethod error
ii) no classdeffound error (4marks)

Question Two

Support that the tuition for a university is ksh 90,000 this year and it increases by 5% every year. Write a program that computes the tuition in 10 years and the total cost of four years worth of tuition starting ten years from now.

(10marks)

What does the JM do when an exception occurs. How do you catch an exception?

(5marks)

Question Three

Find and print the index of the largest element in an array of 10 integer elements.

(10marks)

How do you write a statement to let the user enter an integer or a double value from the keyboard?

(2marks)

Define JVM and outline its importance.

(3marks)

Question Four

What is the output after the execution of class c below?

(5marks)

Class A

{

Public A ()

{

System out prints ("As no-osy constructors is invoked");

}

Class B extends A

{

}

Public class c

{

Public static void main (string (Jag)
{
8 b = new B();
{

What is wrong with the following program? Correct the errors. (5marks)

Public class test implements runnable

{

Public static void main (strong [] args)

}

New test ( );

}

Public test ( )

}

New thread (task). Start ( );

}

Public void run ( )

{

System out prints ("test")

}

}

Write a program in java that displays the following table:

(5marks)
a a^2 a^3
1 1 1
2 4 8
3 9 27
4 16 64






More Question Papers


Popular Exams



Return to Question Papers