java lab questions

8
Java & Internet Programing lab(Part – I&II) All the programs the input must be given by the user 1.Method overloading (input from console also) 1. To find the area of geometric objects 2. Addition Method overriding -using super -using dynamic method dispatch 2.Interfaces and packages(getting the input from console) 3. To sort the numbers in a given array 4. To sort the string in a given array. 5. To find the roots of an quadratic equation 6. To generate n prime numbers 7. To perform arithmetic operations using switch case 8. Sum, product and reverse of a given number 3.Exception handling 9. Predefined Exceptions handling Examples to illustrate ArrayIndexOutOf Bound Exeption NumberFormatException, NullPointerExeption

Upload: ramaguru

Post on 14-Nov-2014

287 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Java lab questions

Java & Internet Programing lab(Part –I&II)

All the programs the input must be given by the user

1.Method overloading (input from console also)

1. To find the area of geometric objects

2. Addition

Method overriding

-using super

-using dynamic method dispatch

2.Interfaces and packages(getting the input from console)

3. To sort the numbers in a given array

4. To sort the string in a given array.

5. To find the roots of an quadratic equation

6. To generate n prime numbers

7. To perform arithmetic operations using switch case

8. Sum, product and reverse of a given number

3.Exception handling

9. Predefined Exceptions handling

Examples to illustrate ArrayIndexOutOf Bound Exeption

NumberFormatException, NullPointerExeption

10. Custom Exception

CheckedException

UncheckedException

4.Streams

11. Prog for

Reading input from a file and displaying it in the console

Reading input from two files and storing it in a third file

Page 2: Java lab questions

Read the input from the program itself and write to the file

Getting input from user and storing it in an array and write into a file

Concatenation of files

Appending information to files

Word Count, Line count. Counting the occurrence of a particular string

Usage of File properties-exists,delete,available,etc

5. Threads

Producer Consumer problem

12. -Generating numbers

13. -Generating characters

Advanced Java Programming

6. Applets

14. -Event handling in buttons and checkbox.

7. TCP/IP Socket

15. -msg communication from server to client.

8. UDP communication

16. -msg communication from server to client.

17. -msg communication from client to server.

9. JDBC

10. Servlets

18. -processing a HTML form

11. RMI

19. interface programs(sub division 2 in core java programs)

Page 3: Java lab questions

Sample Questions1. a. Write a java program to perform the arithmetic operations using the concept of

method overloading

Get two inputs Integer and the output must be a float.

Get two inputs Float and the output must be an Integer.

Write a java program to perform the concept of method overriding for calculating

simple interest of 3 banks A,B,C. using dynamic method dispatch

Bank A’s rate of interest-10%, Bank’s B rate of interest-9%, Bank’C rate of

interest -7%

Design the HTML page for a job site which contains a form for filling a biodata

of a person and it should contain a menu of various train lists

2. Write a RMI program to perform arithmetic operations. Based upon the user

choice the operation must be performed

3. Write a java program to find the roots of a quadratic equation using interface and

packages.

Declare a interface in package Quad1

Declare another package Quad2 and implement the interface.

4. Develop a simple JDBC application to store the details of an employee in a table

and retrieve it and display it in the console

Design a Web page which contains information regarding your college which

contains tables, lists and hyperlinks. (Must use attributes)

Page 4: Java lab questions

5. Write a java program to throw a exception (checked) for an employee details

If an employee name is a number, a name exception must be thrown.

If an employee age is greater than 50, an age exception must be thrown.

Or else an object must be created for the entered employee details.

6. a. Write a TCP/IP Socket program to send the contents of a file from server to

client.

b. Design a HTML page for railways which contains link for a reservation and

viewing various train details.

7. Write a java program to perform the following operations based upon the choice

entered by the user.

1. Reading input from a file(f1) and displaying it in the console

2. Read the input from the program itself and write to the file(f2)

3. Concatenation of files(f1 and f2) f3

o Appending information to file f3

o Perform word count on f3.

8. a. Develop a applet which listens for events of buttons

b. Develop a Web page which contains information regarding a bookshop using

frames, tables, lists and basic HTML tags.

9. a. Write a UDP Socket program to send a message from server to client.

b. Design a HTML form for filling a biodata of a person and on submission of a

form a welcome message must be displayed.

Page 5: Java lab questions

10. a. Write a java program to solve producer consumer problem which generates

characters using threads.

b. Design a HTML page which contains information of a library using tables with

its attributes, a form for issuing a book to students and use various type of lists to

display the book details .

11. Develop a web page which contains information regarding job opportunities using

tables ,lists ,forms and basic HTML tags

Get the biodata of the user as an input using various form fields (the form must

have all the controls) and on submission of the form, a servlet is invoked to

display the data in tabular column

12. a. Write a java program to calculate the area of 3 geometric objects operations

using the concept of method overloading.

b. Write a java program to perform the concept of method overriding for

calculating simple interest of 3 banks A, B, C. using super mechanisms

Bank A’s rate of interest-10%, Bank’s B rate of interest-9%, Bank’C rate of

interest -7%

c. Design a HTML form for filling a biodata of a person and on submission of a

form a welcome message must be displayed.