JNTU exam papers B.Tech I Sem – Oops through java – November 2008

JNTU II B.Tech I Semester Supplimentary Examinations, November 2008

Oops through java

( Common to Mechanical Engineering, Mechatronics, Metallurgy &

Material Technology, Production Engineering and Automobile Engineering)

SET-3

 

 

1. (a) Can you convert a for loop to a while loop? List the advantages of using for loops

(b) Convert the following for loop statement to a while loop and to a do loop: for (int i=0;i<=1000;i++) long sum=sum+i; .

 

2. (a) When do we declare a method or class final?

(b) When do we declare a method or class abstract?

(c) Describe different levels of access protections available in java.

 

3. Create a 3-level inheritance hierarchy. Each class in the hierarchy should have a

finalize( ) method, and it should properly call the base-class version of finalize( ). Demonstrate that your hierarchy works properly.

 

4. Create an interface with at least one method, in its own package. Create a class in a separate package. Add a protected inner class that implements the interface. In a third package, inherit from your class and, inside a method, return an object of the protected inner class, upcasting to the interface during the return.

 

5. (a) Give the Class hierarchy in Java related to exception handling. Briefly explain each class.

(b) What is the necessity of exception handling? Explain exception handling taking “divide-by-zero” as an example.

 

6. (a) What is Unicasting and Multicasting of event. Explain with example.

(b) What is the meaning of registering and unregistering in the context of events. Why they are needed. In Java how do you register and unregister an event. Explain with an example.

 

7. Explain the following:

(a) Creating an applet

(b) Passing parameters to applets

(c) Adding graphics and colors to applets.

 

8. (a) How different machines in a network can be addressed.

(b) What are the uses of ServerSocket class? Explain each of them with an example.

 

Leave a Comment