Microsoft Interview Question for Interns


Country: India




Comment hidden because of low score. Click to expand.
11
of 13 vote

Test Cases: Check for

- NULL string
- "" empty string
- "a" string that consists only one word
- More than one space between words

- jayram singh June 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Add a comment when someone vote it down

- jayram singh June 19, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@jayram

Good test cases. Your suggestion to add a comment while voting down can be made a feature on careercup's website.

- Murali Mohan June 19, 2013 | Flag
Comment hidden because of low score. Click to expand.
5
of 7 vote

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.

- SRRK June 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

thanks

- g June 20, 2013 | Flag
Comment hidden because of low score. Click to expand.
6
of 6 votes

-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 Kr Vats June 20, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@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.

- SRRK June 20, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Can you explain why >255 characters will be a problem ?

- SK June 28, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 2 vote

two more test cases are needed
1) string with even no. of word counts,
2) String with odd no. of word count

- Ravi June 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

why we need this ?

- niraj.nijju June 20, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Due to the fact that in many implementations of reverse algorithm these cases are actually different, we need these tests just to cover all execution paths.

- JacVlD June 27, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

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.

- Chaitanya Kannali June 20, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

when you find '\n' or ' '(space) just insert the word into the stack ...
if you have found '\n' , now pop your words ...
it will be in d reverse order ...

- Rajesh June 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

when you find '\n' or ' '(space) just insert the word into the stack ...
if you have found '\n' , now pop your words ...
it will be in d reverse order ...

- Rajesh June 22, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More