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

Bit2115:Object Oriented Programming Iii Question Paper

Bit2115:Object Oriented Programming Iii 

Course:Bachelor Of Business Information Technology

Institution: Meru University Of Science And Technology question papers

Exam Year:2010




a. Differentiate between: (6 Marks)
i. A while and a do while loop
ii. Super-class and sub-class
iii. Conventional programming and event driven programming
b. Discuss three access modifiers used in java programming. (3 Marks)
c. Discuss in detail the following concepts as used in object oriented programming: (4 Marks)
i. Set ()
ii. Get ()
iii. Operator overloading
iv. Function overriding
d. Write a program in java that accepts two user input numbers: number 1 and number 2, the
program them compares the two numbers and outputs: number 1 equals number 2 or number 1 is
less than number 2 or number 1 is greater than number 2 depending on the outcome. (4 Marks)
e. Discuss in detail citing examples three main object oriented programming concepts. (6 Marks)
f. Write the syntax and explain the parts that make up for a loop. (4 Marks)
g. Write a program in java that accepts a user input number and checks if the number is even or odd,
the program then outputs the appropriate message. (3 Marks)
2
QUESTION TWO – 20 MARKS
a. Use an if-else statement to write an object oriented program in Java that awards students grades
based on the following guidelines; A=70-100, B=60-69, C=50-59, D=40-49, F=0-39. The
program should request the user to input the mark attained by the student and should return “an
invalid input” error in case the user tries to input any value that is not in the range 0-100.
(6 Marks)
b. Write an object oriented program in Java that implements a class Bank Account with the
attributes: Ownername, AccountNumber and Balance and the methods; getBalance(), Deposit()
and withdrawal(), the program should then implement a class OverdraftAccount with the attribute
CreditLimit and inherits from the class BankAccount and override the method withdraw by
adding the account balance to the CreditLimit i.e (DispensableAmount = Balance + CreditLimit)
(10 Marks)
c. Differentiate between the following flow control statements citing example usage of each:
(4 Marks)
i. Exit
ii. Break
QUESTION THREE – 20 MARKS
a. Java exception handling is managed by five keywords: state and discuss the role of each of the
keywords. (5 Marks)
b. Define the term array and write a statement that declares and initializes an array to store the marks
of five students. (3 Marks)
c. Write a recursive program that accepts a user input number and calculates the factorial of the
number. (4 Marks)
d. Write a program in Java that accepts user input of the CAT marks of ten students and stores them
in an array; the program then calculates and outputs the: lowest, highest, sum and average CAT
marks. (8 Marks)
QUESTION FOUR – 20 MARKS
a. Differentiate between an applet and an application. (2 Marks)
b. Discuss in detail the life cycle methods of an applet. (10 Marks)
c. Write an object oriented program in java that defines a class circle with the attributes radius, area
and circumference and the methods getArea and getCircumference which calculates and outputs
the Area and the circumference respectively of an object CircleA, the program should make use of
a constructor. (8 Marks)
3
QUESTION FIVE – 20 MARKS
a. Discuss the role of comments in Java; state and discuss the two kinds of comments. (5 Marks)
b. Write a program in Java that accepts the mass (in kilograms) and the height (in meters) of an
individual then calculates the body mass index (BMI) based on the formula:
BMI=mass/(height*height), the program should then output the health risk associated with a BMI
based on the following: (5 Marks)
? Underweight BMI<18.5
? Normal weight>=18.5 and <25
? Overweight >=25 and <30
? Obese >=30
c. Discuss any five major benefits associated with the use of an object oriented programming
language like java as opposed to procedural languages. (10 Marks)






More Question Papers


Popular Exams



Return to Question Papers