Code No: RR411006

Set No. 1

IV B.Tech I Semester Supplementary Examinations, February 2007 OBJECT ORIENTED PROGRAMMING THROUGH JAVA ( Common to Electronics & Instrumentation Engineering, Electronics & Control Engineering and Electronics & Telematics) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Write down the syntax and execution procedure of different kinds of if statements in Java. [8] (b) Write a Java program to find the sum of all elements in the one dimensional array. (Define a class representing array with necessary data members and a method to find the sum) [8] 2. (a) What is a class ? How does it accomplish data hiding ? (b) Explain the difference between an object and a class. (c) What is a constructor ? what are its special properties ? [6] [6] [4]

3. (a) Write a Java program to arrange a given set of numbers using Quick sort. [8] (b) Write a Java program which takes a text and search for a given pattern in the text and find out the place of its first occurrence. The pattern and the text given as command line arguments. [8] 4. Write a java program to print the fol1owing frame. The size increases when you move from left to right [16]

A

A

B

AAA BB B B

A B
[8] [8]

5. (a) Explain the class hierarchy of various window types. (b) Write down any event generators.

6. Explain how an applet itself updates its window during an information change.[16] 7. (a) What’s the difference between a runtime exception and a plain exception? Why don’t runtime exceptions have to be declared? [8] (b) Given a method that doesn’t declare any exceptions, is it possible to override that method in a subclass to throw an exception? Justify? [8] 8. Write a Java program to read a list of elements from a data file and store the list in the: 1 of 2

Code No: RR411006 (a) the same file (b) another file ⋆⋆⋆⋆⋆

Set No. 1
[8] [8]

2 of 2

Code No: RR411006

Set No. 2

IV B.Tech I Semester Supplementary Examinations, February 2007 OBJECT ORIENTED PROGRAMMING THROUGH JAVA ( Common to Electronics & Instrumentation Engineering, Electronics & Control Engineering and Electronics & Telematics) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Write down the syntax & working procedure of loop structures while & do while in Java. [8] (b) Discuss the following: i. Code reusability. ii. Data Abstraction. 2. (a) Can constructors in Java be overloaded? If so, illustrate with an example. [8] (b) Discuss the JDK and its components in brief. 3. (a) Write a Java Program to show the use of Abstract classes. (b) Explain constructor over loading with an example. (c) List out the characteristics of interface. [8] [5] [5] [6] [8]

4. Write a java program to print the fol1owing frame. The size increases when you move from left to right [16]

A

A

B

AAA BB B B

A B
[8] [8]

5. (a) How is a container different from other types of components? (b) What is window? What are the operations of window?

6. “Applets override update ( ) method of AWT. Justify the statement with an example in detail. [16] 7. (a) Explain how an exception handling mechanism can be used for debugging a program? [8] (b) Create a try block that is likely to generate three types of exception and then incorporate necessary catch blocks to catch and handle them appropriately? [8] 8. Explain the following : 1 of 2 [4x4=16]

Code No: RR411006 (a) InputStream (b) OutputStream (c) Reader (d) Writer ⋆⋆⋆⋆⋆

Set No. 2

2 of 2

Code No: RR411006

Set No. 3

IV B.Tech I Semester Supplementary Examinations, February 2007 OBJECT ORIENTED PROGRAMMING THROUGH JAVA ( Common to Electronics & Instrumentation Engineering, Electronics & Control Engineering and Electronics & Telematics) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Write down the syntax and execution procedure of different kinds of if statements in Java. [8] (b) Write a Java program to find the sum of all elements in the one dimensional array. (Define a class representing array with necessary data members and a method to find the sum) [8] 2. (a) Distinguish between overloading and overriding. (b) When do we declare a method as final. (c) Explain the difference between newBankAccount[2000]; And BankAccount b; (d) Implement a class Student. A Student has a name and a total quiz score. Supply an appropriate constructor and methods getName( ), addQuiz(int score) , getTotalScore( ) and getAverageScore( ). To Compute the latter, you also need to store the number of quizzes That the student took. [4] 3. (a) How identifiers used in a method are associated to a local variable, parameter or instance/class variable. Explain with examples. [8] (b) How the naming conflict can be avoided using the self-referencing pointer? [8] 4. (a) What is an AWT? What is component object in the java AWT. (b) Distinguish between component and container in java AWT. 5. With an example show the handling of mouse events in JAVA? [8] [8] [16] [4] [4] [4]

6. Explain the interface Runnable and show how to implement the interface runnable in the applet. [16] 7. (a) Describe briefly about “thread priorities”. Demonstrate with a suitable example situation. [8] (b) Identify the different states of a thread. 8. (a) Summarize the list of byte stream classes. 1 of 2 [8] [8]

Code No: RR411006

Set No. 3
[8] ⋆⋆⋆⋆⋆

(b) Summarize the list of the character stream I/O classes.

2 of 2

Code No: RR411006

Set No. 4

IV B.Tech I Semester Supplementary Examinations, February 2007 OBJECT ORIENTED PROGRAMMING THROUGH JAVA ( Common to Electronics & Instrumentation Engineering, Electronics & Control Engineering and Electronics & Telematics) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Explain the usage of switch statement in Java by writing suitable example program in Java. [8] (b) In which aspect, public data members differ from private and protected data members in Java program? Explain the concept with a suitable example. [8] 2. (a) What is a class ? How does it accomplish data hiding ? (b) Explain the difference between an object and a class. (c) What is a constructor ? what are its special properties ? [6] [6] [4]

3. (a) Consider two calls Public class D extends B { Public void f( ) { this.g( ); // 1 } public void g( ) { super.g( ) //2 } . . . . } Which one of them is an example of early binding ? Which one of them is an example of late binding ? Explain. [5] (b) Explain the term shallow copy and deep copy. [5] (c) Implement a super class Person. Make Y two classes , Student and Instructor. Inherit from Person. A person has a name and a year of Birth. A student has a major and an instructor has a salary. Write the Class definitions , the constructors. [6] 4. Write a program to create 4 x 4 grid and fills it in with the 15 buttons, each lable with its index. [16] 5. (a) Explain the class hierarchy of various window types. (b) Write down any event generators. 6. Explain the life cycle of an applet and the methods involved. [8] [8] [16]

7. (a) What is ‘Exception handling’ ? Why is it considered as a necessary feature in JAVA? [8] 1 of 2

Code No: RR411006

Set No. 4

(b) Write a program to catch Array Out Of Bounds exception when you enter more number of arguments at the command prompt. [8] 8. Write a Java program to read a list of elements from a data file and store the list in the: (a) the same file (b) another file ⋆⋆⋆⋆⋆ [8] [8]

2 of 2