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:2013




a) Give the structure of a Java program. (3 Marks)
b) Explain the components of a class using an example code snippet. (3 Marks)
c) i) Give a syntax for declaring interfaces. (1 Mark)
ii) List three main properties of an interface. (3 Marks)
d) create a class named houseHold that includes data fields for the number of occupants and
the annual income, as well as methods named setOccupants(),setIncome(),
getOccupant(), and getIncome() that set and return those values, respectively.
Additionally create a constructor that requires no arguments and automatically sets the
occupants field to 1 and the income field to 0. Create a program named TestHousehold
that demonstrates that each method works correctly. (6 Marks)
e) differentiate between the following keywords;
i. catch and try
ii. extends and implements
f) Discuss the life cycle of a Thread. (4 Marks)
g) Explain the following keywords using a programs; (4 Marks)
i. this
ii. new
h) Explain the properties of a constructor using a code example. (2 Marks)
i) Discuss the concept of instanceOf. (2 Marks)
j) Write a Java program that demonstrates the concept of Logical operators. (2 Marks)
2
QUESTION TWO (20 MARKS)
a) Explain the following using suitable examples: (6 Marks)
i. Method overloading
ii. Dot operator
iii. Finalizer methods
b) Enumerate and discuss Java access modifiers. (4 Marks)
c) List the major advantages of Vectors have over arrays. (2 Marks)
d) Why are wrapper classes useful? (2 Marks)
e) Create a class named Shirt with data fields for collar site and sleeve length. Include a
constructor that takes arguments for each field. Also include string can variable named
material and initialize it to cotton. Write as Java program TestShirt to instantiate two
shirts objects with different collar sites and sleeve length, and then display, all data,
including material for each shirt. (6 Marks)
QUESTION THREE (20 MARKS)
a) Discuss the following using suitable examples;
i. Exception handling (5 Marks)
ii. Multithreaded programming. (5 Marks)
iii. Applet life cycle. (4 Marks)
b) List the main properties of Object Oriented Paradigm. (2 Marks)
c) Write a program to find the number of sum of all integers greater than 100 and less than
200 that are divisible by7. (4 Marks)
QUESTION FOUR (20 MARKS)
a) Explain the concept Scanner class using an example program. (5 Marks)
b) Write a program that prompts the user to input length, width and height of a box. The e
program then outputs the surface area and volume. (5 Marks)
c) Create a Circle class and test it. The class Circle has exactly one data member radius.
Your class must provide getRadius(), setRadius(), and toString() methods. There are
two application specific methods: getArea() and getCircumference(). Use Math.PI, a
constant defined in Math class in your code for the value of PI. (5 Marks)
d) Mark the following statements true or false. (5 Marks)
i. A static method has no explicit parameter.
ii. A static method must be invoked using the class name.
iii. Only a static method can modify a class variable.
iv. Only a static method can access a class variable.
v. In order for a class variable to exist there need not be any instances.
3
QUESTION FIVE (20 MARKS)
a) Writer a program that displays employee IDs and first and last names of employees. Use
two classes. The first class named Emp contains the employee data and separate
methods to set the IDs and names. The other class creates objects for the employees and
uses the objects to call the set methods. Create several employees and display their data.
(6 Marks)
b) Computer programs are very closely tied to the specific hardware and operating system
they run. A Widows program will not run on a computer that only runs DOS. A Mac
application can’t run an a UNIX workstation. VMS code can’t be executed on an IBM
mainframe, and so on. How does java resolve this platform problem? (3 Marks)
c) What is the relevance of the following keywords as used Java programming?
Give examples to support your answer;
i. new
ii. extends
iii. implements
iv. Throws ( 4Marks)
d) Draw a flowchart illustrating the try/finally/catch exception hardly mechanism.
e) Write using an example code a syntax for: (3 Marks)
i. For statement
ii. Ternary operator
iii. Switch statement






More Question Papers


Popular Exams



Return to Question Papers