1. Answers the following questions: a. Write any four differences between a Java Applet and a Java Application. Also, write any two common properties of them. Explain through an example for each. b. Indicate the name, type , size and range of values of any four primitive data types in Java. c. Write any three advantages of multi-threaded programing. d. Write a program in Java for l/O operations using BufferedlnputStream and BufferedOutputStream. 2. Answers the following questions: a. What is meant by Java Virtual Machine ? Explain. b. Explain any six bitwise operators of Java. Also, demonstrate each operator with an example. 3. Answers the following questions: a. Write a program in Java that accepts the name of a text file as input and prints the content of that file to standard output. b. Explain the architecture of a Java Applet with the help of a figure. 4. Answers the following questions: a. Explain the extends keyword with an example. b. What is an exception ? How will you handle them in Java programs ? c. How can a package be created in Java ? Give an example. 5. Answers the following questions: a. Do you agree with the statement that any Java program is 100% platform independent ? Justify your answer. b. Explain the three categories an Event. c. Write a program in Java that accepts a list of strings as input and prints all those strings to standard output which consistof all vowels in them.
IT 2301 JAVA PROGRAMMING PART A (10 2 = 20 Marks) 1. What is the difference between static and non-static variables? 2. What is the purpose of finalization? 3. What is the difference between the String and String Buffer classes? 4. Can an abstract class be final? Why? 5. What is an anonymous inner class? 6. What is the difference between the File and Random Access File classes? 7. What are the advantages of the event-delegation model? 8. What happens if an exception is not caught? 9. What is the use of Reflection API? 10. What are three ways in which a thread can enter the waiting state? PART B (5 16 = 80 Marks) 11. (a) Explain briefly the following object oriented concepts. (i) Abstraction and Encapsulation. (4) (ii) Methods and messages. (4) (iii) Inheritance. (4) (iv) Polymorphism. (4) Or (b) (i) How objects are constructed? Explain constructor overloading with an example. (Marks 10) (ii) Write short notes on access specifiers in java. (Marks 6) 12. (a) What is a Package? What are the benefits of using packages? Write down the steps in creating a package and using it in a java program with an example. (Marks 16) Or (b) What is Dynamic binding? Show with an example how dynamic binding works. (Marks 16) 13. (a) What is object cloning? Why it is needed? Explain how objects are cloned. (Marks 16) Or (b) How is a Frame created? Write a java program that creates a product enquirer form using frames. (Marks 16) 14. (a) With a neat diagram explain the Model view controller design pattern and list out the advantages and disadvantages of using it in designing an application. (Marks 16) Or (b) What is an Exception? Explain how to throw, catch and handle Exceptions. (Marks 16) 15. (a) What is Generic programming and why is it needed? List the limitations and restrictions of generic programming. (Marks 16) Or (b) Explain how to create threads. Write a java program that prints numbers from 1 to 10 line by line after every 5 seconds. (Marks 16)
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011 Fifth Semester Information Technology IT 2301 JAVA PROGRAMMING PART A (10 2 = 20 marks) 1. Give the properties of abstract classes and methods and write a suitable example. 2. Why does Java not support destructors and how does the finalize method
help in garbage collection? 3. Write a declaration to convert the value Programmer in the string variable convert to programming. 4. Distinguish between static and dynamic binding. 5. How does the declaration of a local inner class differ from the declaration of an anonymous inner class? 6. Write a code to copy the contents of the file input.txt one byte at a time to output.txt using FileInputstream and FileOutputStream. 7. When do the following events occur? (a) AdjustmentEvent (b) ItemEvent 8. Write down the statements used to create a JFrame and a JButton and then add the JButton to the JFrame. 9. List any two advantages of type parameters. 10. When would you use the CountDownLatch synchronizers and Exchange Synchronizers? PART B (5 16 = 80 marks) 11. (a) (i) Write a program to find whether a number is a palindrome or not. (8) (ii) Discuss the working and meaning of the static modifier with suitable examples. (8) Or (b) Explain in detail as to how inheritance and polymorphism are supported in Java with necessary examples. (16) 12. (a) (i) Write a Java program to perform matrix multiplication using arrays. (8) (ii) Write a java program to search for a number in the given array using binary search. (8) Or (b) Give a detailed explanation of packages in Java(16). 13. (a) What is reflection and how does it help to manipulate java code? (16) Or (b) Consider a class person with attributes firstname and lastname. Write a java program to create and clone instances of the Person class. (16) 14. (a) Write a program to create a calculator using swings with the four basic arithmetic operations : +, , *, /. (16) Or (b) Draw the exception hierarchy in java and explain with examples throwing and catching exceptions and the common exceptions.(16) 15. (a) With suitable examples consider the number of restrictions to consider when working with java generics. (16) Or (b) Write short notes on what threads are and the thread states and properties. (16)
4. a) Wrilc a servlet to accept students information from HTML page, and store the details in a database. (Note : Take suitable fields, student table is already present), b) Explain the scopes of access specifiers in Java. 5. a) i) Write a Java Socket program that runs on client and sends a file name to server at port 8000. The program should display appropriate message returned by server. ii) Write a Java socket program that runs on server at port 8000, which accepts a file name from client and checks file exists or not and returns proper message to client. I b) Explain Inner class with example. 6. Write short notes on any 3 : 1) EJB Architecture. 2) Adapter classes.
5. Accept mobile HANDSET details through HTML page. Pass the accepted details to servlet. Servlet will insert record in HANDSET table with values received from HTML page. Servlet will send response as whether record is inserted or not. Assume suitable table structure. 6. Write notes on (any 3) : a) Java. io. File class b) Thread life cycle c) Session tracking in servlets d) EJB architecture.