Object Oriented Programming Using Java - Dec 2014
Computer Engineering (Semester 5)
TOTAL MARKS: 100
TOTAL TIME: 3 HOURS (1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks. 1 (a) Describe the following features of java:
7) Dynamic(7 marks) 1 (b) Differentiate between Method overloading and method overriding with example.(7 marks) 2 (a) Explain the followings with example
Dynamic Method Dispatch , this, super, final(7 marks) 2 (b) Write a program to demonstrate the multipath inheritance for the classes having relations as shown in figure 1. (7 marks) 2 (c) Write a program that illustrates interface inheritance. Interface A is extended by A1 and A2. Interface A12 inherits from both P1 and P2.Each interface declares one constant and one method. Class B implements A12.Instantiate B and invoke each of its methods. Each method displays one of the constants(7 marks) 3 (a) What are the benefits of using generic types?(3 marks) 3 (b) Differentiate between abstract class and interface.(4 marks) 3 (c) Discuss public, private, protected and default access modifier with example.(7 marks) 3 (d) What is collection in Java? Differentiate between Vector and Array List.(7 marks) 3 (e) Justify statement.
(i) JVM is platform dependent.
(ii) There is no destructor in Java.(7 marks) 4 (a) Write a simple GUI application that traces the user's action such Keyboard action.(7 marks) 4 (b) Write a program to replace all 'word1' by 'word2' from a file1, and output is written to file2 file and display the no. Of replacement.(7 marks) 4 (c) Create an applet which has a Text Field to accept a URL string, and displays the document of the URL string in a new browser window.(7 marks) 4 (d) Differentiate String class and StringBuffer class with explanation of its methods.(7 marks) 5 (a) Write a program to create two threads, one thread will print odd numbers and second thread will print even numbers between 1 to 20 numbers.(7 marks) 5 (b) Write a program that counts number of characters, words, and lines in a file. Use exceptions to check whether the file that is read exists or not.(7 marks) 5 (c) Explain the following terms with respect to exception handling.
i) try ii) catch iii) throw iv) finally(7 marks) 5 (d) What is a thread? Describe the complete life cycle of thread with example.(7 marks)