Thursday, October 22, 2009

JAVA/OOPs IMPORATANT Questions for final exam unit wise

UNIT I

1

Briefly explain the concept of encapsulation with an example

2

Bring out the importance of inheritance with the help of an example?

3

Why the concept of polymorphism is is considered to be very important Explain?

4

Briefly explain the salient features of java language?

5

What is stand alone application? Briefly explain the procedure of creating and executing a standalone application?

6

List 5 major differences between JAVA C and C++?

7

Explain how java is strongly associated with the Internet?

8

Explain how java is more secured than other languages?

9

What is a Buzzword? List and explain any 10 java buzzwords?

10

What is a data type? List any basic eight data types in java, explain them with examples?

11

What is a constant? Explain different types of constants used in java

12

What is a variable? Explain about the scope of variable in detail?

13

Write a program that reads the radius of a circle as input taken dynamically while running and then computes the circumference and area?

14

What is an operator? Explain various types of operators used in java?

15

Determine the value for each of the following expression if a=5, b=10, and c=-6

a) a>b && a

b) a && a>c

c) a<=c || b>a

d) b>15 && c>0 || a>0

e) (a/2==0 || b/2==0) && c<0

16

Why do we need control statement? Name and explain any five important control statements in java?

17

What does the break statement do? How it is used in the switch statement, explain with example?

18

How does do while differ from the while statement, Explain with an example?

19

Explain with example the use of break and continue statements in a “for” loop?

20

What is an array? Explain why arrays are usually processed with “for” loops?

21

Write a java program to print the following pattern using “for” loops

I

2 3

4 5 6

22

Given a number write a program using while loop to reverse the digits of a number?

For Example Input:12345 Output:54321

23

Write a java program to eliminate the duplicate elements from the given set of input elements

Sample input: 1 2 3 4 4 5 3 2

Sample Output: 1 2 3 4 5

24

Write a java program to find the nth smallest number in the given set of elements

Sample input 2 4 3 5 8 7 N=3

Sample output: The third smallest element is:4

25

Write a java program to sort the elements of the matrix in row wise

Sample input 1 3 2 sample output: 1 2 3

6 5 4 4 5 6

9 7 8 7 8 9

26

Write a java program to find the N prime numbers

Sample input:7

Sample output: 2 3 5 7 11 13 17

27

Write a java program to arrange the elements of the array in an ascending order

28

Write a java program to find the Fibonacci series

Fibonacci series 1 1 2 3 5 8…………

29

Define type casting? Explain typecasting with an example?

30

Write a java program to find the factorial of a given number?

UNIT II

1

What is a class? How does it accomplish data hiding explain with example?

2

What are objects? Explain with example how are object created from a class?

3

What are the three parts of a simple empty class explain with example?

4

What is a constructor? How do we invoke a constructor? What are its special properties?

5

What is a method? Explain in detail about method overloading?

6

What is the advantage of constructor overloading explain with example?

7

When do we declare the members of the class as static explain with example?

8

When do we declare a method or class as final explain with example?

9

When do we declare a method or class as abstract explain with example?

10

What is the advantage of using “this” keyword, explain?

11

What are the difference between constructor and a method explain with examples?

12

What do you mean by garbage collection, explain with example?

13

Explain about inner classes with an example?

14

Define a class method square as defined below

Data member: side

Methods : squarearea() To compute the area of a square

Squareperimeter() To compute the perimeter of a square

Within the main method of the class square create an object for the class square . Compute the area and perimeter by invoking the appropriate methods

15

Define a class method circle as defined below

Data member: radius

Methods : constructor()

circlearea() To compute the area of a circle

Within the main method of the class circle create an object for the class circle . Compute the area of circle when radius is 20 by invoking the appropriate methods

16

What is a string? Explain any of the five string methods with syntax and examples?

17

Write a java program to arrange the array of strings in an alphabetical order

18

Write a java program to find whether the given string is a palindrome or not

Sample Input: MALAYALAM

(Note: reversing a string should be the same as input)

19

Explain about string bufferclass with example?

20

Explain streamtokenizer and its methods with an example?

21

Explain the following methods of strings with examples

a) charAt()

b) IndexOf()

22

Explain the following methods of strings with examples

a) getChars()

b) getBytes()

23

Explain the various methods involved in strings to extract the substrings?

24

Write a java program to convert the uppercase letters to lowercase and vice versa

Sample Input: jntu uNIVERSITY

Sample Output JNTU University

25

Describe the various methods used for character replacements in a string?

26

Explain the various methods used for comparison of strings?

27

Explain the following methods of stringBuffer class examples

a) capacity()

b) insert()

28

Write a java program to find all possible combinations for a given string

Sample Input: abc

Sample output: abc bac cab acb bca cba

29

Write a java program to find the number of characters, words in a given string

Sample Input: JNTU Hyderabad

Sample output:No of characters:13 No of words:2

30

Write a program the reads a string and rewrite it in alphabetical order

Sample Input: STRING Sample Output: GINEST

UNIT III

1

Write a program to explain how variables are inherited in a class?

2

Write a program and explain the concept of hiding a variable?

3

With the help of a java program explain the use of the super keyword?

4

Write a java program to illustrate the inheritance of methods?

5

What are the various types of inheritance, Explain with examples?

6

Write a java program to explain the concept of method overriding?

7

Explain how super keyword is used in overriding the methods?

8

Explain the use of super() method in invoking a constructor?

9

What is an Abstract classes, Explain with examples?

10

Write a java program to illustrate the use of Abstract methods?

11

Write a java program to illustrate the impact of final modifier?

12

Define the concept of base class and derived class with a sample java program?

13

When does a base class variable get hidden, Give reasons?

14

Explain with an example how we can access a hidden base class variable?

15

Describe the syntax of single inheritance in java?

16

Compare and contrast overriding and overloading methods?

17

Explain with example when do we declare a method or class final?

18

Explain with example when do we declare a method or class abstract?

19

What is inheritance how does it help us in creating new classes quickly?

20

How do we pass the arguments in the constructor of a base class Explain with example?

21

Write a program to find the area of a rectangle using the concept of method overriding?

22

Explain the member access rules in detail?

23

How do we implement dynamic method dispatch, Explain with a sample java program?

24

Explain the concept of object class in detail?

25

Write a sample java program to explain about defining and using static members?

26

Explain the Nesting of methods in detail with an example?

27

What is multilevel inheritance, Explain?

28

Explain Hierarchal Inheritance with an example?

29

Explain in detail about finalizer methods()?

30

Write a java program to find the area of a circle using the concept of super keyword and super method?

UNIT IV

1

What is an Interface? Explain the structure of interface with an example?

2

With an example explain how interfaces are implemented?

3

With a sample program explain the concept of Inference Inheritance?

4

Define package and show how the packages are implemented?

5

With the help of a java program illustrate the concept of import statement?

6

Write a java program to illustrate the package access control Identifiers?

7

Write a java program to illustrate the public access control modifier?

8

Explain how is the concept of interface used to indirectly represent the multiple inheritances?

9

What do you mean by multiple inheritance of an interface Explain?

10

With a java program explain about extending interfaces concept?

11

Write a java program to show how the interface variables are accessed?

12

What are the major differences and similarities between interface and a class explain?

13

Discuss the various levels of access protections available for the packages and their implementations?

14

Name and explain about any 5 built in packages?

15

Explain about the naming conventions used for a package?

16

With a sample java program explain how a class is added to a package?

17

With a sample program explain concepts used for designing a package?

18

How do we add a class or an interface to a package?

19

Explain with an example to show how the methods in a package are accessed?

20

Explain the concept of Understanding there CLASS PATH?

UNIT V
1 What is an exception? Give an example.
2 List the two distinct advantages of user define exceptions handling mechanisms?
3 How does “try… catch” mechanism handle an exception?
4 At which point in the program will the execution resume after the error is handled?
5 What the use is of Finally block, explain with example?
6 Explain the usage of throws using an example?
7 Differentiate between throws and throw keywords?
8 Why do we need custom exceptions, give reasons?
9 Briefly describe the method of defining and using a custom exception?
10 Write a java program to read 20 marks and store them in an array, Define your own exception named wrongmarkexception. Throw and catch this type of exception when a mark is <0>100.
11 The value of the correlation coefficient always lies between -1 and +1.Write a java program to define correlation exception in such a way that a wrong correlation coefficient will be reported. Enter the set of correlation coefficients and report wrong correlation coefficients.
12 List some of the most common exceptions that occur in java explain with examples?
13 Is it essential to catch all types of exceptions, Give reasons to your answer?
14 How many catch blocks can we use with one try block, Give reasons to your answer?
15 Create a try block that is likely to create 3 types of exceptions and then incorporate necessary catch blocks to catch and handle them appropriately?
16 Explain how exception handling mechanism can be used for debugging a program?
17 Write a java program to define nomatch exception that is thrown when the string of input is not “India”
18 Define thread? Name and explain different states in the lifecycle of threads?
19 Differentiate multiprocessing and multithreading? What is to be done to implement these in a program?
20 What java interface must be implemented by all threads, Explain with examples?
21 Explain the methods used for starting and stopping the threads?
22 How do we set priorities to threads, explain with example?
23 Describe the complete life cycle of threads?
24 What is synchronization, when do we use it in multithreading?
25 Write a java program for producer consumer problem to illustrate the concept of multithreading?
26 What is a deadlock? What harmful effect does it have?
27 Which methods are useful in effecting inter thread communication?
28 Explain about notify(), notifyall() and join() in threads?
29 Write a java program to generate square roots of the first 30 natural numbers using runnable interface?
30 Write a java code to define the thread in the thread class to find the factorials of first 20 natural numbers. Create an instance for the thread and activate it?
UNIT VI
1 What is an Event? Explain the role of Event handler in AWT?
2 What is a listener? What useful role does the listener play in AWT?
3 List and explain the different situations in which the Action Event is generated? Write the event handler for the Action Event?
4 List and explain the different situations in which the item Event is generated? Write the event handler for the item Event?
5 Define the purpose of the following Events
a) Focus Event
b) Text Event
c) Container Event
d) Window Event
e) Key Event
6 Mention and explain any five event handling methods for Mouse Event?
7 Mention and explain any five event handling methods for Window Event?
8 Mention and explain the event handling methods for Key Event?
9 List and explain about any five event listeners in AWT?
10 Describe briefly about delegation event model?
11 Explain about adapter classes in detail?
12 Mention and explain any five event handling methods for Component Event?
13 Mention and explain any five event handling methods for Container Event?
14 Explain any five methods used in container class?
15 What is a panel? How it is used for organizing the things in a controlled way?
16 Write a java code to explain frames in an AWT?
17 Are the classes frame and dialogs are subclasses of the window class? Explain.
18 List and explain about the various methods used in the font class?
19 List and explain about the various methods used in the colour class?
20 List and explain about the various drawing methods used in graphics class?
21 Write a java code to draw horizontal, vertical and diagonal lines by making use of graphics methods?
22 Write a java code to Rectangle, Square and Rhombus by making use of graphics methods?
23 Write a java code to draw Ellipses and Circles by making use of graphics methods?
24 Write a java code to draw Arcs and Sector, Semicircle by making use of graphics methods?
25 Write a java code to draw polygon of sides 5, 6, 7 and 8 by making use of graphics methods?
26 Write a java code to display the text “JNTUH” in various Colors?
27 Write a java code to display the text “JNTUH” in various Fonts?
28 Write a java code to explain the text alignment?
29 Write a java code to draw cone , cube and cylinder?
30 Write a java code to draw circle inside a square and a square inside a circle?
UNIT VII
1 Write a java code to explain the concept of Label control in AWT?
2 Write a java code to explain the concept of Buttons control in AWT?
3 Write a java code to explain the concept of Text fields control in AWT?
4 Write a java code to explain the concept of Text Area control in AWT?
5 Write a java code to explain the concept of Checkbox in AWT?
6 Write a java code to explain the concept of Checkbox group in AWT?
7 Write a java code to explain the concept of List control in AWT?
8 Write a java code to explain the concept of Choice control in AWT?
9 Write a java code to explain the concept of Scrollbars control in AWT?
10 Briefly explain the roles played by Menubar, Menu and Menuitem classes?
11 Write a java code to explain the concept of Flow Layout in AWT?
12 Write a java code to explain the concept of Border Layout in AWT?
13 Write a java code to explain the concept of Grid Layout in AWT?
14 Write a java code to explain the concept of Card Layout in AWT?
15 Write a java code to explain the concept of GridBag Layout in AWT?
16 What are the unique features of border layout?
How does the grid layout differ from the border layout? Explain.
17 Distinguish between the functionalities of choice and List controls?
18 Write a java code to explain about icons and Jlabel control in JApplet class of Swings?
19 Write a java code to explain JText field control in Swings?
20 Write a java code to explain JButton control in Swings?
21 Write a java code to explain JCheckBox control in Swings?
22 Write a java code to explain JRadioButton control in Swings?
23 Write a java code to explain JComboBox control in Swings?
24 Write a java code to explain JTabbedPane control in Swings?
25 Write a java code to explain JScrollPane control in Swings?
26 Write a java code to explain JTable control in Swings?
27 What is an Applet? Explain how does an Applet differ from the application?
28 Briefly Explain the Life cycle of an Applet?
29 With a sample java code explain the method of creating and executing an Applet?
30 Write an Applet to receive the value of the parameter message from the html file and display it on the webpage?
UNIT VIII
1 Briefly explain the utility of gethost(), getProtocol() and getPort() methods of the URL class?
2 What is socket how it is used in the networking?
3 Briefly explain the situations in which bindexception, connectedexception and NoroutetoHost exception are thrown?
4 What is an InetAddress? Write a java program to create an Inetaddress?
5 Explain briefly about the concept of TCP?
6 Describe briefly about the concept of UDP?
7 Write a server side program to send the sales figures for the six working days in a week to a client. Write the corresponding client program?
8 Suppose the sales data is available in the file named sales.dat. Write a java program to read the data from the file,extract the tokens and send them one by one over the net from a server to a client?
9 Write a server side program to send the name of a medical specialist. Write a client side applet to receive it and retrieve his phone number, return it to the server.
10 Write the client side applet to send the sales figure to the server. Write the server program to compute and send the commission
11 Write the server side program to send the message : send 83 lakhs immediately” to a client. Write the corresponding client program.
12 Write a server side program that receives the filename, retrieve it and send the contents of the file to the client. Write the corresponding client program?
13 Write a server side program that receives the filename from the client, retrieve its content and send the contents of the file to the client. Write the corresponding client program?
14 Develop a UDP based server side program to send the multiple lines of message to a client. Write the corresponding UDP based client side program.
15 Develop a UDP based client side program to send the sales data, one by one, to the server. Write the corresponding UDP based server side program
16 Write the UDP based client side program to send the radius of a circle to the server. Write the server side applet such that it receives the radius, computes the area and finally return it to the client.
17 Define and explain some of the methods in Collection interface in java.util package?
18 Define and explain some of the methods in List interface in java.util package?
19 Write a sample java code to demonstrate ArrayList class methods?
20 Write a sample java code to demonstrate LinkedList class methods?
21 Write a sample java code to demonstrate HashSet class methods?
22 Write a sample java code to explain any 5 methods of MAP interface in java.util package?
23 Write a sample java code to explain any 5 methods of Enumerated interface in java.util package?
24 Write a sample java code to demonstrate Vector class?
25 Write a sample java code to demonstrate Stack class?
26 Write a sample java code to demonstrate Dictionary and Hash table classes?
27 Write a sample java code to demonstrate Sting Tokenizer class?
28 Write a sample java code to demonstrate Date class methods?
29 Mention any 5 classes and its methods in java.io package?
30 Mention any 5 classes and its methods in java.net package?

0 comments:

Post a Comment