Microsoft Interview Question
InternsCountry: India
1) An empty string.
2) String with only one space. Ex: " ".
3) String with multiple spaces in between words.
4) String with spaces at the starting. Single and multiple.
5) String with spaces at the end. Single and multiple.
6) Combinations of step 3 with 4 and 5.
7) String with alphanumeric.
8) Include special characters in step 7.
9) Strings which are palindromes.
10) String with only one character.
11) String with more than 255 characters.
12) String with combinations of uppercase and lowercase letters.
13) String with only special characters.
14) String with only uppercase and only lowercase letters.
15) String with only spaces. more than 2 spaces.
16) String with ASCII characters and with Unicode characters.
17) String with exactly single spaces in between letters.
18) String containing even number of letters in some words and odd number of letters in others.
-1
"11) String with more than 255 characters." <- This is not a correct test case.
We are talking about reversing words of sentence but not characters of a word !
@Saurabh, I added that because internally the characters of the words would be reversed.
Actually I should have been specific about the number; for ASCII: 255 and for Unicode: 2,147,483,647
That test case was mainly for load/crash/performance testing. Correct me if I am wrong.
two more test cases are needed
1) string with even no. of word counts,
2) String with odd no. of word count
I think he was expecting this : (Probably a unit test).
1) Take "This is nice"
2) Put in the program = get the output "nice is This"
3) Take output "nice is This" put in program back , you should get original string. "This is nice". (If the program is right :))
To the above program automated with single word , >1 words , null , empty string , and one manual test would be good.
I am not QA BTW. Just a programmer.
Test Cases: Check for
- jayram singh June 19, 2013- NULL string
- "" empty string
- "a" string that consists only one word
- More than one space between words