GTU previous years question papers -BE- Sem-Vth -Object Oriented Programming with Java -June- 2011

GTU previous years question papers


B. E. Sem. – V – Examination – June- 2011

Subject code:15  04

Subject Name: Object Oriented Programming with Java



1. Attempt all questions.

2. Make suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.

Q.1 (a) Explain final and super by giving examples.   

(b) Declare a class called employee having employee_id and employee_name as

members. Extend class employee to have a subclass called salary having

designation and monthly_salary as members. Define following:

– Required constructors

– A method to find and display all details of employees

drawing salary more than Rs. 20000/-.

– Method main for creating an array for storing these details given as command line arguments and showing usage of above methods.

Q.2 (a) Explain method overriding and method overloading with the help of examples.

(b) Write a method for computing xy by doing repetitive multiplication. x and y are of type integer and are to be given as command line arguments. Raise and handle exception(s) for invalid values of x and y. Also define method main. Use finally in above program and explain its usage.


(b) Explain package and interface by giving examples.   

Q.3 (a) Explain this reference, key word static and garbage collection.   

(b) Explain short circuited operators and shift operators.   


Q.3 (a) Explain inner class and working of concatenation operator + by giving examples.

(b) Explain File constructors, any two methods of class File and method seek.   

Q.4 (a) Explain various methods called during execution cycle of the applet. Also explain boarder layout.

(b) Write a program to create a frame with exit capabilities. Handle events for mouse pressed, mouse released, mouse clicked and mouse dragged by displaying appropriate message describing the event at the coordinates where the event has taken place.


Q.4 (a) Explain event handling and different event types of Java.   

(b) Write a complete program to create a frame for providing GUI to implement a stack for storing integer numbers. There are two buttons called PUSH & POP and a text field. Clicking of button PUSH pushes the number entered in  the text field onto the stack. The click of button POP pops an element from the stack and displays that in the text field.

Q.5 (a) Explain: wait, sleep and synchronize.   

(b) Write a complete multi-threaded program to meet following requirements:

– Read matrix [A] m x n

– Create m number of threads

– Each thread computes summation of elements of one row, i.e. i th row

of the matrix is processed by i th thread. Where 0 <= i < m.

– Print the results.


Q.5 (a) It is required to have total two threads, both capable of acting as a produce as well as a consumer. If first thread acts as a producer then, the second thread becomes the consumer and vice-versa. They communicate with each other through a buffer, storing one integer number. One of the threads initiates the communication by sending 1 to the other thread. The second thread, on receiving 1 sends 2 to the first thread. On receiving 2, the first thread sends three integer numbers, one by one to the second thread. The second thread consumes the numbers by displaying them. Both threads terminate after that. Note that both threads must be capable of initiating the communication.

Write complete multi-threaded program to meet above requirements.

(b) Explain utility class Hashtable and instanceof operator by giving examples.   


To download engineering ebooks, medical ebooks, management ebooks, free ebooks please visit

Leave a Comment