You are on page 1of 6

1.Find the given dated/MM/yyyy is a leap year or not.

Concept divide by 4
2. Method contains (String[] and integer parameter)
If the input parameter size equals the length of the particular string in String[],
Then print the no of times..
String appears
String*+=cat,mat,monkey,dog,rat;
Integer =3
Output=4
3.Find the day of the last week of the date dd/MM/yyyy
4.String=COWARD
If integer input is 3 or greater than three. .. print first three characters of strings the no of times. The
integer is
And if input integer is less than 2 then print 1
st
two character of String, the no of times if input
integer is one then print only one character of String once.

String=COWARD
If integer input=4, o/p cow cow cow cow
If integer input=2, o/p coco
If integer input=1, o/p c
5. given an array of string return a string which contains only the last characters of the strings in the
string array
Eg:{arr,abc,cde}
o/p rce
6. given two arraylist as input return a arraylist which contains element which are not common to
both arraylist
Input1;{1,2,3,4}
Input2={3,4,5,6}
Output={1,2,5,6}
6.given two strings
Input1:hh:mm:ss
Input2 hh:mm:ss
Get the output string in terms of
Dd:hh:mm:ss
i.e Days:hours:minutes:seconds
7. given an array of integer, find the unique count of each no
Ex:{1,1,2}
Count=2
8.email validation in this format abc@gmail.com
Rule- there should be only one @
And one com
There should be only 5 characters between @ and .
9. input1: hello world, world is wonderful
Input2:world
Output-count the number of occurrence of input2 in the input1
Ex output:2
10. given a array of integer as input ex:{1,100,100}
Return true if 2 100s occur consecutively
11.check whether the input string with pattern __ix where __ cane be any of*a-z],[A-Z],[0-9]
Example:Mix Mania
Output:true
12.Given an input string, check whether the first word and the last word in the string match, if they
match return the number of characters in the word else return sum of the characters in both
Ex: hello world hello
Output:5
Ex hello this world op=10
13. input1:,a,bb,ca,b-;
Input2 : n=2
Find the string in array of strings having n number of characters
Output,bb,ca-
14. take input as date and return number of days in that month. Check if the year is leap year
Input date format:dd-MM-yyyy
15.take two input strings and find whether the second input string has all characters within the first
input string(it should also include duplicated)
Ip1:eat
Ip2:tea
o/p:true
16.a string ip is given and you have to search for x(small x) in the string and place all the x in the back of
the string (case sensitive)
Ex. Input:xAabxbX
output: AabbXxx
17. Take the input as joining date and experience of employee. If difference between joining date of
employee and current date of the system greater than the experience of the employee then return true
otherwise false.
18. A string is given as input
1. 1
st
character should be a-z or A-Z or 0-9
2. 2
nd
character should be 7
3.character should be M
Return type is Boolean
19. input is(27-2-2012)
It should print the no of days in that particular month and check for leap year also
Output:29
20. input(banana,orange,apple)
Input2:2
It should print the 2
nd
String
21.input:A={1,2,3,4}
Input B={4,5,6}
Find (AUB)-(AnB)
Use treeset to do this
22. input String[]={01,10101,011101,10,011}
Output:3
(no of string which have any other string as a prefix}
23. input 4 integer(1,2,3,4)
Find the answer using a given formula math.sqrt
24. you have to find the date and validate whether it is in the format of MM-dd-yyyy
25.input1:Hello
Input2:2(n)
Output=lolo
Print the last two(n) characters two(n) times
26.input:HashMap
{selva:75.6f, abi:89.5f,ram:40}
Output:hashmap
{selva:pass,abi:pass,ram:fail}
If the mark is >60 return the names and their status as pass in a output hashmap else fail
27.three integers are given as arguments . find the number of unique elements
Ex:input 24,30,21
Output:3
Ex2:input:1,1,2
Output:2
28. last character of each string
String array is passed as an argument. Take the last character of each string and append to a single new
string
Ex:input1{cat,make,cow,lion}
Output:tewn
29. sum of digits in string
String array is given as input string may contain digits and alphabets(3ab2d). extract digits from each
string and find the sum(if the string is ab312sd then take 3+1+2=6 and not as 312 as digit)
Input1:{ca21,la3df,21cd,8c}
Output:2+1+3+2+1+8=17
30. experience validity
Year of joining and no of years after experience is taken as input. Find the validity i.e. no of year of
experience should be less than or equal to the difference between year of joining and current year
Ex1:input:2000,10
Output:valid(true)
Ex2:Input:2008,7
Output:invalid(false)
31.String count
Two strings S1 and S2 are passed as arguments. Find the number of times S1 is repeated in S2. Ignore
the case of both S1 and S2
Ex1:input{catcowcatmat,cat}
Output:2
Ex2:input(makemymylow,abc}
Output:0