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

Object Oriented Programming (Bbit 223) (Cisy-210) (Dcis-210) 1St Trimester 2016 Question Paper

Object Oriented Programming (Bbit 223) (Cisy-210) (Dcis-210) 1St Trimester 2016 

Course:Bachelor Of Business Information Technology

Institution: Kenya Methodist University question papers

Exam Year:2016



Object oriented programming (BBIT 223) (CISY-210) (DCIS-210) 1st trimester 2016
KENYA METHODIST UNIVERSITY

END OF 1'st 'TRIMESTER 2016 (FT) EXAMINATION

SCHOOL : SCIENCE & TECHNOLOGY
DEPARTMENT : COMPUTING AND INFORMATION SCIENCE
UNIT CODE : BBIT 223/BBIT 212/CISY 210/DCIS 210
UNIT TITLE : OBJECT ORIENTED PROGRAMMING
TIME : 2 HOURS


INSTRUCTIONS

Answer all questions in Section A and two in Section B.
SECTION A – 30 MARKS

1. Define the following terms: (3 marks)
Subclass
Object
Polymorphism
2. Differentiate between the following concepts: (6 marks)
A Constructor and a method.
Argument and Parameter
Method Overloading and Method Overriding.
3. Examine the program below and answer the questions that follow.

importjava.util.Scanner;

public class SectionA

{

public static void main(String[] args)

{

Scanner s = new Scanner(System.in);

System.out.println("Enter your age. ");

int age = s.nextInt();

if( age > 0 ) {

if( age % 2 == 0 ) {

System.out.println("Of course!");

} else {

System.out.println("That’s odd.");

}

} else {

System.out.println("You are too young!");

}

}

}

Briefly explain what this program does.
(3 marks)
What is the first line output if the program is executed and the user enters 19? (1 mark)
What is an example of a variable that is a primitive?
(1 mark)

4. Write a static integer method sum() that takes two parameters a and band then calculates the sum of the two values. (5 marks)
5. Using diagrams, differentiate between single, multiple and multilevel inheritance (6 marks)

6. Java does not support multiple inheritance. Explain this statement. (3 marks)

7. State two differences between an interface and an abstract class. (2 marks)
SECTION B – ANSWER ANY TWO QUESTIONS

Question 1 (15 marks) – Basic Java and Methods

Write a java program that is able to determine if a 5-digit number is a palindrome and output the required statement. For example, if you enter 12321, the program should output, ’12321 is a palindrome’.
(9 marks)
In Question 2, Section A you differentiated between method overloading and method overriding. Now illustrate the difference using Java code only.
(6 marks)

Question 2 (15 marks) - Inheritance

Using a program with two classes (A and B) demonstrate single inheritance. A is the superclass that contains a method showing the output "this is the parent". B is the subclass that contains a method showing the output "this is the child". Write the main method in another class ’C’ than calls the two methods from A and B.
(15 marks)


Question 3 (15 marks) – Interface and Abstract Classes

A concrete class that implements an interface must do two things. Which are these two things?
(2 marks)

Consider the interface Marksbelow. Write a class program that implements the interface. The Final is calculated using the formula Practicals * 0.2 + catMarks*0.2 + ExamMarks *0.6
(13 marks)

interfaceMarks

{

public void setMarks ( intPracticals, intcatMarks, intExamMarks );

public String getMarks ();

public float CalculateFinal ();






More Question Papers


Popular Exams



Return to Question Papers