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

Object Oriented Programming In Java Question Paper

Object Oriented Programming In Java 

Course:Computer Science

Institution: Kenya Methodist University question papers

Exam Year:2009



Instruction:
• Answer ALL questions in Section A and then answer two questions in Section B.


SECTION A - [COMPULSORY]

QUESTION ONE (30 MARKS)
Give four advantages of Java as an object oriented programming language. [4Mks]

Explain the five states of a Thread in Java programming [5Mks]

Write programs the count 1 to 10 using the following iterations; while, do while and for, respectively. [9Mks]

Describe the following terms
Interface
Package
Overloading of methods
Classes [4Mks]

The following code has errors, correct the errors
class AutoArray;
{
Public static void main(string args)
{
int month days[ ] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31,30, 31 };
system.out.print("April has " + month_days[ ] + " days.")
}
} [4Mks]

Briefly explain 4 benefits of bundling code into individual software objects [4Mks]


SECTION B – [ANSWER TWO QUESTIONS]

QUESTION TWO (15 MARKS)

Write a Java program that will generate a 10 by 10 multiplication table [8Mks]

Use this statement (year % 4 = = 0 && year % 100 != 0) || (year % 400 = = 0) to write a program that determines a Leap Year [7Mks]

QUESTION THREE (15 MARKS)

Write a Java program that demonstrates multilevel inheritance of named classes: class A, class B and class C. [10Mks]

Write a simple program showing inheritance with a parent class bicycle and a child class mountain bike [5Mks]

QUESTION FOUR (15 MARKS]

Write a Java program using multidimensional arrays that generates the following output:
0
1 2
3 4 5
6 7 8 9 [8Mks]

Write a program that changes text from lowercase to uppercase [7Mks]

QUESTION FIVE [15 MARKS]

Outline the four (4) access control specifiers and illustrate them in Java, under a class name Test [4Mks]

What is Garbage collection in Java [2Mks]

Write a program using try and catch that divided a number by zero and outputs the following
"Division by zero."
"After catch statement."






More Question Papers


Popular Exams



Return to Question Papers