Saturday, 26 April 2014

Java Important Questions Unit Wise

Java Important Questions Unit Wise


1. Define Multithreading? Explain the differences b/w multithreading & multitasking?
2. What is an exception? Explain the exception in handling java?
3. What is exception? What are the different types of exceptions?
4. Explain user defined exceptions with e.g.?
5. What is multithreading? Explain?
6. What is a thread? Explain the life cycle?
7. Explain checked & unchecked exceptions?
8. Explain the following:
i).dead lock ii) daemon thread iii) thread group iv) thread priorities

9. Explain delegation event model?
10. Explain mouse events with e.g.?
11. What is an adapter class? Describe about various adapter classes in detail?
12. Explain various components in awt?
13. What are layout manager? Discuss the layout java supports?
14. What is an applet? Explain life cycle of an applet?
15. Discuss about applet tag & its importance?
16. Briefly explain about the following
i) check box ii) component event iii) focus event iv) Jbutton

17. Describe about various components in swings
18. Explain the functionality of Jcomponent & Jpanel
19. a)discuss briefly about the following: TCP,UDP,URL
b) Inet address? How to create an Inet address & what are its uses?
20. a) How different machines in hard ware can be addressed?
b) What are the uses of several socket class? Explain each of them in e.g.?

Unit I

1.Write a program that will compute the following series:
(a) 1/1 + 1/2 + 1/3 + ...... + 1/n
(b) 1/1 + 1/2 + 1/22+ ....... + 1/2n.
[April 07 Set 1][April 07 Set 3][Sep 07 Set 3]

2.(a) What are conventional styles for class names, method names, constants and variables?
(b) Can a java run on any machine? What is needed to run java on a computer?
(c) Explain the concept of keywords. List some java keywords.
[April 07 Set 2]

3.(a) Describe the genesis of java. Also write brief overview of java
(b) List and explain the control statements used in java. Also describe the syntax of the control statements with suitable illustration.
[April 07 Set 4]

4.(a) java is freeform language. Comment
(b) Describe in detail the steps involved in implementing a stand-alone program.
(c) What are command line arguments? How are they useful?
[Sep 07 Set 1]

5.(a) When dealing with very small or very large numbers, what steps would you take to improve the accuracy of the calculations
(b) What are symbolic constants? How are they useful in developing programs?
(c) Write a program to determine the sum of the following harmonic series for a given value 1 + 1/2 + 1/3 + ..... + 1/n The value of n should be given interactively through the keyboard. [Sep 07 Set 2]

Unit II
1.(a) What is an array? Why arrays are easier to use compared to a bunch of related variables?
(b) Write a program for transposition of a matrix using arraycopy command.
[April 07 Set 1][April 07 Set 3]

2.(a) What is a constructor? What are its special properties?
(b) How do we invoke a constructor?
(c) What are objects? How are they created from a class?
[April 07 Set 2]

3.(a) What is class? How does it accomplish data hiding?
(b) How do classes help us to organize our programs?
(c) Compare and contrast overloading and overriding methods.
[April 07 Set 4][Sept 07 Set 3]

4.(a) How does String class differ from the StringBuffer class?
(b) Write program to do the following:
i. To output the question “who is the inventor of java”?
ii. To accept an answer
iii. To print out “Good” and then stop, if the answer is correct.
iv. To output the message “try again”, if the answer is wrong
v. To display the correct answer when the answer is wrong even at the third attempt.
[Sept 07 Set 1]

5.Briefly explain following:
(a) final & this keywords
(b) garbage collection
(c) passing parameter-call by value
(d) Overloading methods & Constructors.
[Sept 07 Set 2]

6.(a) What is the difference between equality of objects and equality of objects and equality of references that refer to them?
(b) What is the difference between a public member and a private member of a class?
(c) write an application that computes the value of ex by using the formula:
ex = 1 + x/1! + x2/2! + x3/3! + ..........
[Sept 07 Set 4]

Unit III

1.Create an abstract class with no methods. Derive a class and add a method. Create a static method that takes a reference to the base class, downcasts it to the derived class, and calls the method. In main( ), demonstrate that it works. Now put the abstract declaration for the method in the base class, thus eliminating the need for the downcast.
[April 07 Set 1][April 07 Set 2]

2.Is there any alternative solution for Inheritance. If so explain the advantages and disadvantages of it.
[April 07 Set 3]

3.Explain about Object class in detail.
[April 07 Set 4]

4. Create an inheritance hierarchy of Rodent: Mouse, Gerbil, Hamster, etc. In the base class, provide methods that are common to all Rodents, and override these in the derived classes to perform different behaviors depending on the specific type of Rodent. Create an array of Rodent, fill it with different specific types of Rodents, and call your base-class methods. Explain the output.
[Sept 07 Set 1][Sept 07 Set 4]

5.What are the types of inheritances in java? Explain each of them in detail.
[Sept 07 Set 2][Sept 07 Set 3]

Unit IV

1.Write a program to create a private inner class that implements a public inter- face.Write a method that returns a reference to an instance of the private inner class, upcast to the interface. Show that the inner class is completely hidden by trying to downcast to it.
[April 07 Set 1]

2.Prove that all the methods in an interface are automatically public.
[April 07 Set 2]

3.Write a program create an interface U with three methods. Create a class A with a method that produces a reference to a U by building an anonymous inner class. Create a second class B that contains an array of U. B should have one method that accepts and stores a reference to a U in the array, a second method that sets a reference in the array (specified by the method argument) to null and a third method that moves through the array and calls the methods in U. In main( ), create a group of A objects and a single B. Fill the B with U references produced by the A objects. Use the B to call back into all the A objects. Remove some of the U references from the B.
[April 07 Set 3], [Sept 07 Set 2]

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.
[April 07 Set 4]

5.Write a program to create a class with a non default constructor and no default constructor. Create a second class that has a method which returns a reference to the first class. Create the object to return by making an anonymous inner class that inherits from the first class.
[Sept 07 Set 1]

6. Prove that the fields in an interface are implicitly static and final.
[Sept 07 Set 3]

7. Create three interfaces, each with two methods. Inherit a new interface from the three, adding a new method. Create a class by implementing the new interface and also inheriting from a concrete class. Now write four methods, each of which takes one of the four interfaces as an argument. In main( ), create an object of your class and pass it to each of the methods.
[Sept 07 Set 4]

Unit V

1.Explain the following exceptions with the help of examples:
(a) Arithmetic Exception
(b) Null Pointer Exception
(c) Number Format Exception.
[April 07 Set 1]

2. (A) with the help of an example, explain multithreading by extending thread class.
(b) Implementing Runnable interface and extending thread, which method you prefer for multithreading and why.
[April 07 Set 2]
3. (A) what is the role of stack in exception handling?
(b) Give the classification of exceptions.
[April 07 Set 3]

4. (A) what is the difference between unchecked and checked exceptions in java?
(b) Give the list of different unchecked exceptions in java and their meaning.
(c) Explain in detail any two unchecked exceptions.
[April 07 Set 4]

5.In JAVA, is exception handling implicit or explicit or both. Explain with the help of example java programs.
[Sept 07 Set 1]

6. (a) Is it possible to achieve true parallelism using multithreading. What are the limitations in it?
(b) What is the role of priorities in multithreading. What are its limitations? How do you set and get priority values for threads in Java.
[Sept 07 Set 2]

7.(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.
[Sept 07 Set 3]

8.(a) What is the meaning of rethrowing an exception? When it is useful. (b) What are the limitations of exception handling feature of java. [8+8]
[Sept 07 Set 4]

Unit VI

1. (a) Why creating a subclass of Frame is preferred over creating an instance of Frame when creating a window.
(b) Explain the steps in creating a subclass of frame with the help of examples.
[April 07 Set 1]

2. What are the methods supported by the following interfaces. Explain each of them
(a) Action Listener interface
(b) Mouse Motion Listener interface
(c) Text Listener interface.
[April 07 Set 2]

3.(a) What is the functionality supported by java related to Fonts.
(b) How using different fonts improves the user interface.
[April 07 Set 3]

4.What are the methods supported by Key Listener interface and Mouse Listener interface. Explain each of them with examples.
[April 07 Set 4]

5.(a) How event driven programming is different from Procedure oriented program-ming.
(b) Give overview of Java’s event handling mechanism.
[Sept 07 Set 1]

6.(a) Define Graphics context. How do you obtain graphics context.
(b) Explain in brief different drawing functions of Java.
[Sept 07 Set 2]

7.(a) Why creating a subclass of Frame is preferred over creating an instance of Frame when creating a window.
(b) Explain the steps in creating a subclass of frame with the help of examples.
[Sept 07 Set 3]

8.(a) What is Delegation Event model? Explain it. What are its benefits?
(b) Define Event. Give examples of events. Define event handler. How it handles events.
[Sept 07 Set 4]

Unit VII

1.(a) What is the use of JPassword Field? Explain with an aid of an application program. (b) What are the differences between JPopupMenu and JMenu?
[April 07 Set 1]

2.Differentiate following with suitable examples:
(a) Frame, JFrame
(b) Applet, JApplet
(c) Menu, Jmenu.
[April 07 Set 2]

3.Explain the following:
(a) Creating an applet
(b) Passing parameters to applets
(c) Adding graphics and colors to applets.
[April 07 Set 3]

4.Explain various methods of Applet class with necessary examples.
[April 07 Set 4]

5.What are containers? List various containers. Explain the usage of JPanel with example.
[Sept 07 Set 1]

6.What is JFC? Explain the differences between JTextArea, JTextComponent, JTextField with examples.
[Sept 07 Set 2]

7.Briefly explain the components of AWT.
[Sept 07 Set 3]

8.Create an applet with two toolbars. One toolbar should be created using JButtons and a separator and another toolbar should be created using 3 custom Action classes. Add one to the ”north” and another to the ”south” sides of border layout. When the user clicks one of the buttons in the toolbar, it will print a message to the console stating that which button is being pressed from which toolbar. Add functionalities to the buttons such as New, Open, Close, Save, Cut, Copy, Paste. [16]
[Sept 07 Set 4]


1.Briefly explain the constructors and methods of StringTokenizer class.
[April 07 Set 1]

2.Explain connection less client/server interaction with datagrams in detail. Give suitable example.
[April 07 Set 2]

3.(a) What is a port? What is the difference between port and socket?
(b) Explain several methods provided by URL?
[April 07 Set 3]

4.What is StringTokenizer class? What is its use? Write a program to display the course name, course fee & duration of course using StringTokenizer class.
[April 07 Set 4]

5.(a) How does Random class generate pseudo random numbers?
(b) Write a program to generate a set of random numbers. Find its sum and average. The program should also display * based on the random numbers generated. [Sept 07 Set 1]

6.(a) Briefly explain String class.
(b) Write a program to count the frequency of words, characters in the given list of text.
[Sept 07 Set 2]

7.(a) How does Random class generate pseudo random numbers?
(b) Write a program to generate a set of random numbers. Find its sum and average. The program should also display * based on the random numbers generated.
[Sept 07 Set 3]

8.What do you mean by URL? How to create an URL? Explain several methods provided by URL? Give appropriate examples.[4+4+8]
[Sept 07 Set 4]


Set 1

1. (a) What is the need of OOP paradigm?
(b) Write about agents of communities.

2. (a) How java is more secure than other languages?
(b) What is data type? Explain data types in java.

3. (a) What is method overloading? Explain with an example.
(b) Explain the usage of final and super keywords with an example.

4. What is a package? How do create a package? Explain about access protection in packages.

5. (a) What is an exception? Explain about exception handling mechanism in java.
(b) Compare thread based and process based multitasking.

6. What is the task performed by layout manager? Explain different layout managers.

7. (a) What is an applet? Explain applet life cycle.
(b) Write the difference between applet and stand alone applications.

8. (a) What is network programming? How are the different machines in a network addressed? Explain.
(b) What is a part? What are the differences between port & socket? Explain with an example.

Set 2

1. (a) Write about concept of responsibility in OOP.
(b) Write about information hiding with respect to message passing.

2. (a) What is an empty statement? Explain its usefulness.
(b) Compare in terms of their functionalities, the following pairs while and do-while.

3. (a) Can you declare abstract class members as final? Why?
(b) Explain the following:
i. Abstract methods.
ii. Concrete methods.

4. (a) Explain about classes of java.util package.
(b) Write the difference between class and interface.

5. (a) Explain the procedure to create user defined exceptions.
(b) Why finally keyword is necessary in exception handling?

6. (a) What are the functionalities supported by java related to drawing ellipses?
(b) What is event delegahan model? Explain it.

7. (a) Explain briefly how to pass parameters to an applet.
(b) Write the differences between applet and standalone applications.

8. Explain about various networking classes & interfaces available in java.


1. (a) Briey explain about abstract mechanism.
(b) How to cope up with complexity? What are the mechanisms used to do so?

2. (a) Explain briey about bitwise operators.
(b) Explain the structure of java program with an example.

3. (a) What is multilevel inheritance? Explain with suitable example.
(b) Explain how you can de_ne constants in java. Explain with an example.

4. (a) Write a java program to demonstrate implementing two interfaces by single class.
(b) Discuss java.util package in detail.

5. (a) Write a java program to implement runnable interface to create a thread.
(b) Write short notes on Daemon threads.

6. Explain the following layout managers with a simple program.
(a) Card layout managers.
(b) Grid bad layout managers.

7. (a) What are mandatory attributes of applet tag? Explain them.
(b) Write a program which draws dashed line and dotted line using applet.
8. (a) What is socket? What are the two important TCP socket classes? Explain.
(b) Explore package.

Set 4

1. (a) What is the difference between message passing and a procedure call?
(b) Briefly write about OOP principles.

2. (a) Write a program to find the roots of quadratic equation.
(b) What is type casting? What are the rules followed for type casting?

3. Explain the following:
(a) Super.
(b) Static members of class.
(c) Abstract methods Vs Concrete methods.

4. (a) Write a java program to find date and time.
(b) What is the significance of CLASSPATH environment variables in creating loosing a package?

5. (a) Differentiate checked and unchecked exception.
(b) What is thread? Explain thread life cycle.

6. (a) Write the difference between AWT components and SWING components.
(b) Write short notes on inner class and adapter class.

7. (a) Write an applet program that display simple message “ ALL THE BEST”.
(b) How do applets differs from application programs?
(c) Write short notes on different types of applets.

8. (a) Discuss briefly about the following:
(b) Write a client-server application that takes the password as input and check whether it is correct. The program should print the appropriate messages.

Java R07

1. (a) List the difference between while and do-while statements
(b) Write a program to compute the sum of the digits of a given integer number.

2. Explain the following:
(a) Static members.
(b) Parameter passing techniques.
(c) Inner class.

3. Describe various forms of inheritance.
4. (a) List the advantages of package & interface.
(b) What are the major differences and similarities between class & interface?

5. (a) When should we use an exception handling?
(b) Explain about rethrowing an exception with an example.

6. List out various layout managers in java. Explain boarder layout manager.
7. Explain the life cycle of an applet and methods involved.
8. (a) What do you understand by sockets? What are the classes in regard to sockets?
(b) What is Inet address? How to create an Inet address?


Post a Comment