GTU Object Oriented Programming in JAVA Question Paper June 2012
GUJARAT TECHNOLOGICAL UNIVERSITY
BE- Vth SEMESTER-EXAMINATION – MAY/JUNE – 2012
Subject code: 150704
Subject Name: Object oriented programming with Java
Total Marks: 70
- Attempt all questions.
- Make suitable assumptions wherever necessary.
- Figures to the right indicate full marks.
Q.1 (a) Explain features of JAVA.
(b) Explain interface in JAVA. How do interfaces support polymorphism?
Q.2 (a) Explain Exception handling in JAVA. Write an application that generates 07 custom
exception if any value from its command line arguments is negative.
(b) Why synchronization is required in multithreaded programming and how can we 07 implement it in program?
(b) Explain Thread Life Cycle in detail. Write a code to create Thread in JAVA.
Q.3 (a) Write a program using Buffered Input Stream, File Input Stream, Buffered Output Stream, 07 File Output Stream to copy Content of one file File1.txt into another file File2.txt.
(b) Describe abstract class called Shape which has three subclasses say 07 Triangle, Rectangle,Circle. Define one method area () in the abstract class and override this area () in these three subclasses to calculate for specific object i.e. area() of Triangle subclass should calculate area of triangle etc. Same for Rectangle and Circle
Q.3 (a) Write a program to display the bytes of a file in reverse sequence. Provide the name of 07 the file as a command line argument. (Use Random Access File)
(b) Write a program that illustrates interface inheritance. Interface P is extended by P1 07 and P2. Interface P12 inherits from both P1 and P2.Each interface declares one constant and one method. class Q implements P12.Instantiate Q and invoke each of its methods. Each method displays one of the constants
Q.4 (a) Differentiate Applet and Application.
(b) Differentiate String class and String Buffer class with explanation of its methods.
Q.4 (a) Write an applet that contains three buttons OK, CANCEL and HELP and one text field. If
OK is pressed shown on the status bar-“OK is pressed” and the text field should turn red. When
CANCEL is pressed -shown on the status bar-“CANCEL is pressed “and text field should turn
green. When HELP is pressed- shown on the status bar-“HELP is pressed” and the text field should
(b) Explain Applet life cycle with demo program.
Q.5 (a) Explain package in java. List out all packages with short description. 07
(b) Differentiate Method Overloading and Method Overriding with example. 07
Q.5 (a) Explain Event Handling in java and describe methods of mouse event and key event.
(b) Explain Generics in java with demo program. 07