Thursday 15 October 2015

puzzles and Use Case





1)-  puzzle- 3 heads 5 hats 2 black and 3 white
    They all stand in line like 3 can see both 2 can see 1 and 1 can see wall, 3rd one is saying that he know what color of hat he have , You need to figure out he is true or bluff,
They can't touch them self or talk

2)- Write a program to list all files which have name started with ‘a’ and ends with ‘txt’
i. There should be a flag to on/off recursive search.
ii. There should be specific timeout in seconds and program should stop searching            after timeout.
iii. Write junit test cases for testing the program.


3)- String s = “helloasgjhshellohjhsd9helloghsaghhello”;
    calculate how many times “hello” is present in s?

Write a program for finding largest palindrome from a string pattern.

4)- A puzzle was asked “we have a car which had 5 tyres(4 in use and 1 spare). The car had traveled 20,000 miles and all of its tyres has covered equal amount of distance and all the tyres has reached their maximum limit and thus all are busted. What is the maximum limit of each tyre ”.


5)- Write a code for stack using linked list(when writing any code keep the boundary conditions in mind)


6)- Write a high performance file search utility program . You are required to write a program that takes command line arguments and searches the required file in the current folder and the sub folders . Search could be for files or folders or both . Below are the four parameters that would be passed . You are also required to so proper exception handling and you code must be optimized as much as possible .

1) A top folder name : Folder from where search would begin. (Ex : C:/MyFolder )

2) Search Option (File /Folder /Both )

3) Search Pattern : A regular expression : (*my*.txt )

4) Timeout in seconds : once the operation reaches this timeout search should be stopped saying " Could not complete operation " and results obtained till then must be returned .

7)-  Write a program to verify that any given  String having perfect open and close bracket

like String temp = “{fgfgfgfgfg(ffgfg)fgfgfg(fgfgfg}fgfgfg)fgfgfgfg[fgfgfgf]fgfgfggfgfg]gfgfg”;

8)- Remove number at odd position in an array of 10 numbers.



9)- Implement Binary Tree with using any class like node.


10)- how to remove duplicate words from a large file?


11)-
Write code for : two strings are given ,find out if first string is subsequence of other string
like : frstString ="AXY",secString="ADXCPY"
output wil be :true frstString is subsequence of other String

No comments:

Post a Comment