Sei sulla pagina 1di 4

SET-1

1. Write a java Program that reads file and display number of vowels,
consonants, special symbols, number of words and number of lines [Take
filename as command line argument].

2. Write a program that performs string concatenation letter (1
st
String) by
letter (2
nd
String) and checks if the two strings contain any digits or special
symbols raise user defined exception.
[Ex: i/p: RGUKT NUZVID -> o/p : RNGUUZKVTID
i/p: RG12T NUZVID -> raise user defined exception and display a
message]

SET-2

3. Write a java Program to capitalize the contents (only alphabets) of one file
and put that in another file. Both files should be passed as command line
arguments by the user.

4. Write a java program to generate 25 random numbers and put them in a 5x5
matrix and perform transpose for the generated matrix and multiply two
matrices.
SET-3
5. Write a java program to write at least 5 employees (employee name, phone
number, age, and salary) details in file and then read employees details from
file, increase salary of each employee by 10% write those details in a new
file.

6. Write a java program that performs sorting on given strings (array of strings)
and perform linear search for a given string.









SET-4
7. Write a java program to print which string is big (with respect to sum of
ASCII values of the characters in the string) from 3 strings. Use ternary
operator to compare three sums.

8. Write a java program to reverse the content of the file (take file name as
command line argument). That means, the last line of the file should come at
the beginning and first line of the file should come at end of the file.
[Ex: file contains 1. You are software engineers
2. CSE always rocks
New file contains1.CSE always rocks
2. You are software engineers]

SET-5
9. Write a java program to arise user defined exception while we are entering a
negative number into an array. If there is no negative number entered, sort it
and find mean.
10. Write a java program that performs serialization on employee class
(employee name, phone number, age, and salary) and perform
deserialization and then display highest paid employee details.
[Note: store at least 5 employee objects in file]

SET-6

11. Write a java program to create two files each with 5 employee records
(sorted based on employee name) and write a java program that merges
records alternately from two files (based on employee name) and writes the
results in to a new file. If one file has less number of records than the other,
the remaining records from the larger file should be simply copied into the
target file.

12. Write a program that convert the given date with suffix.
(EX: IF 12-04-2012 IS I/P, THE O/P WILL BE 1
2th
, APRIL 2012.)






SET-7
13. Implement an interface which has methods like:
1. int addition(int ,int)
2. int subtraction(int, int)
3. int division(int ,int)
4. int multiplication(int,int)
5. int power(int, int) handle exception if any.
With another class.

14. Write a java program to reverse the content of each line in the file (take file
name as command line argument). Note that, we are just reversing the line
content but not the lines in the file.
[Ex: file contains 1. You are software engineers
2. CSE always rocks
New file contains 1. sreenigne erawtfos era uoY
2. skcor syawla ESC]

SET-8
15. Write a java program write at least 5 employees (employee name, phone
number, age, and salary) details in file and then read employees details from
file, increase salary of each employee by 10% write those details in a new
file.

16. Write a java program that removes the specified digit in the given number
(numeric format).
(EX: IF 54321 IS I/P AND SPECIFIED DIGIT IS 3, O/P WILL BE 5421)











SET-9
17. Write a java program to search for a given string in a given file. If the string
is found print: Found and print its frequency, else print: Not Found.

18. Write a java program to take N numbers as input array, sort it and do the
addition of first two elements, append it to the end of the array and again
sort the array. Follow the same step for the next pairs of elements also until
there is no pair.
E.g.: Input: 1 2 4 3
1 2 3 4 (sort)
1 2 3 4 3 (add 1, 2)
1 2 3 3 4 (sort)
1 2 3 3 4 6 (add 3, 3) and sort
1 2 3 3 4 6 10 (add 4, 6) and sort
* No pair for 10 so print the result, 1 2 3 3 4 6 10
SET-10
19. Write a java program to accept 8 digit numbers and replace first with eight
one, second with 7
th
, 3
rd
with 6
th
, 4
th
with 5
th
. So what is the 2
nd
digit from
the right end in the newly formed number?

20. Write a java program that reads data from file and write into another file
while writing into new file, replace all vowels by the next letter in English
alphabet series and consonants with the previous letter.

Potrebbero piacerti anche