Code No : R19 II B.Tech I Semester Regular Examinations, ______ - 21 JAVA PROGRAMMING (CSE) Time : 3 Hours Max. Marks : 60 _________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ___ Note : Answer ONE question from each unit (5 × 12 = 60 Marks) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. a) b) UNIT-I What is an anonymous array? Give an example? CO BL CO 1 K2 What is method overloading? can you define two CO 1 K2 methods that have same name but different parameter types? Can you define two methods in class that have identical method names and parameter profile with different return values types or different modifier? PO XM [4M] [6M] (OR) 2. a) Compare and contrast static and final methods. Write a java program to demonstrate the usage of static and Final methods? CO 1 K2 [5M] b) Write a java program that collects input as a decimal CO 1 K2 number of integer type and converts it into String of equivalent hexadecimal number. [5M] UNIT-II 3. a) What are packages? How are they created and used? CO 2 K2 [5M] b) What are the supplementary inner classes present in CO 2 K2 Java? Explain each of them. [5M] (OR) 4. a) What is inheritance? List various types of inheritances? CO 2 K2 Is multiple inheritance was supported in java? If not how it can be achieved justify your answer? [6M] b) Define package? Explain how a package can be created and imported to a java class CO 2 K2 [4M] UNIT-III 5. a) Explain any four character stream I/O Classes. CO 3 K2 [4M] b) Define multi-threading? Write a java program to create CO 3 K2 two threads one thread will perform the sum of odd numbers and other thread will perform even numbers sum in given series of 1 to n numbers? [6M] (OR) 6. a) Explain different ways defined by the java to create Page 1 of 2 CO 3 K2 [4M] thread. b) Write a program that creates a user interface to perform integer division. The user enters two numbersthrough command line arguments as Num1 and Num2, perform division and returns the remainder. IfNum1 and Num2 are not integers, then Number Format Exception has to be generated . If Num2 is Zero,Arithmetic Exception has to be generated CO 3 K2 [6M] UNIT-IV 7. a) With a program explain the difference between ArrayList and Vector CO 4 K2 [6M] b) Consider the MyArray example handed out in class. Is the following code legal? If so, what does it print? If not, why isn’t it legal? CO 4 K2 [4M] MyArray a = new MyArray(10); a.set(0,"hi"); a.set(1,"there"); Iterator i = a.iterator(); System.out.println(i.next()); (OR) 8. a) Explain various interfaces used in collection framework CO 4 K2 [6M] b) Suppose you have a set s containing some strings. Write CO 4 K2 a code fragment that uses an iterator to print out each element in s. [4M] UNIT-V 9. a) Write a program that works as a simple calculator. Use CO 5 K2 a grid layout to arrange buttons for the digits and for the + , - ,*,% operations. Add a text field to display the result. Handle any possible exception like divided by zero. [6M] b) Explain the event handling mechanism, with suitable example. CO 5 K2 [4M] Explain about different layouts in AWT CO 5 K2 [4M] Write a java program that simulates a traffic light. The program lets the user select one of three lights:red, yellow, or green with radio buttons. On selecting a button, an appropriate message with ”Stop” or”Ready” or ”Go” should appear above the buttons in selected color. Initially there is no message shown. CO 5 K2 [6M] (OR) 10. a) b) ***** Page 2 of 2