📘 Access 10,000+ CBC Exams With Marking Schemes

Prepare your learners for success! Get CBC-aligned exams for Grades 1–9, PP1–PP2, Playgroup and High School - all with marking schemes.

Browse Exams

Instant download • Trusted by 100,000+ teachers • Updated weekly

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


Exams With Marking Schemes

End Term 3 Exams

Mid Term Exams

End Term 1 Exams

Opener Exams

Full Set Exams



Return to Question Papers