MU Computer Engineering (Semester 3)
Object Oriented Programming Methodology
December 2014
Total marks: --
Total time: --
(1) Assume appropriate data and state your reasons
(2) Marks are given to the right of every question
(3) Draw neat diagrams wherever necessary

1 (a) Write a program that queries a user for the no: of rows and columns representing students and their marks.
Reads data row by row and displays the data in tabular form along, with the row totals, column totals and grand total
Hint: For the data 1,3,6,7,9,8 the output is \[ \begin{matrix} \ 1 &\ 3 & \ 6 &\ | &10 \\ \ 7 &9 &\ 8 & \ | &24 \end{matrix} \\ \overline {\begin{matrix} 8 &12 &14 &| &34 \end{matrix}} \]
10 M
1 (b) Explain System.arraycopy()
5 M
1 (c) Explain multiple inheritance in java with suitable example.
5 M

2 (a) Identify classes and their attributes and draw the relationships that are described by the following business rules. Include the multiplicities for each relationship. i) A patient must be assigned to only one doctor and a doctor can have one or many patients.
ii) An employee has one phone extension and unique phone extension is assigned to an employee.
iii) A movie theater shows at least one movie and a movie can be shown at upto 4 other either has one star, 2 co-stars more than 10 people starting together. A star must be in at least one movie.
12 M
2 (b) Explain coupling and cohesion with suitable example.
8 M

3 (a) Each year, sleepy Hollow Elementary school holds a "principle for a Day" lottery. A student can participate by entering his/her name and ID into a pool of candidates. The winner is selected randomly from all entries. Each student is allowed one entry. Implement a student class that encapsulates a student. Implement StudentLottery class with addStudents() and pickwinner() and main () Hint: Use Random class to pick winner.
10 M
3 (b) With suitable example, explain creation and use of user defined packages.
10 M

4 (a) Write detailed note on following exception handling terms.
i) try-catch
ii) finally
iii) Catch multiple exception
iv) Throwing exception.
10 M
4 (b) Write a program that computes the sum of a list of integers that is supplied by a user. The end of data signaled by the value -99. This value is used only as a flag and not used in sum.
10 M

5 (a) Create Rectangle and Cube class encapsulates the properties of a rectangle and cube ie. Rectangle has default and parameterised constructor and area () method. Cube has default and parameterised constructor and volume () method. They share no ancestor other than Object. Implement a class Size with size() method. This method accepts a single reference argument z. If z refers to a Rectangle then size (z) returns its area and If z refers to a cue then size (z) returns its volume. If z refers to an object of any other class, then size (z) returns -1. Use main() method in size class to call size(..) method.
15 M
5 (b) Differentiate between Interface and abstract class.
5 M

Write short notes on any four:-
6 (a) JVM
5 M
6 (b) Package
5 M
6 (c) Polymorphism
5 M
6 (d) Wrapper class
5 M
6 (e) ArrayList and LinkedList
5 M
6 (f) Vector.
5 M

More question papers from Object Oriented Programming Methodology