Home Company Questions Microsoft Interview Questions Microsoft Interview Questions - 3

Login Form




Microsoft Interview Questions - 3 Print E-mail

1. Suppose you are passing a string to a Formatter function. Get the formatted news feed output string such that


-There should be one sentence per line.
-There shouldn't be any spaces i.e. the line shouldn't be blank.

For example:

Input String :

". ....West Indies reached the final of DLF series. .Lalu was invited
to IIM-A once again. . .. .. . Microsoft unveils Zune, an ipod killer. .
. . . "

Output String :

"West Indies reached the final of DLF series.
Lalu was invited to IIM-A once again.
Microsoft unveils Zune, an ipod killer."

Design and write solid secure code for the Formatter Function.

 

2. Reverse a linked list?

 

3. There is a temple, whose premises have a garden and a pond. It has 4 idols, each of Ram, Shiv, Vishnu and Durga. The priest plucks x flowers from the garden and places them in the pond. The number of flowers doubles up, and he picks y flowers out of them and goes to offer it to Lord Ram. By the time he reaches to the pond, he finds the remaining flowers also have doubled up in the meantime, so he again picks up y from the pond and goes to Lord Shiv.This process is repeated till all the Gods have y flowers offered to them, such that in the end no flower is left in the pond. Find x and y.

 

4. Given 2 set of arrays of size N(sorted +ve integers ) find the median of the resultent array of size 2N. (dont even think of sorting the two arrays in a third array , though u can sort them). Try smthng better than order N ..order LogN >:) .

 

5. How does a spell cheaker routine (common to both, word and Powerpoint) used.. I mean is the code copied 2 times for each of the processes in teh main memory, if they are diffent processes or how is it used if they are threads.

 

6. Implement atof function. Write solid secure code only.

 

7. You are given a Linked List and a function declaration as node* KReverse(node* head, int k);

KReverse is a function that reverses the nodes of a Linked List k at a time and then returns the modified Linked List.

For Example

Linked List : 1->2->3->4->5->6->7->8->9->10->11

For k = 2
Return Value: 2->1->4->3->6->5->8->7->10->9->11

For k = 3
Return value: 3->2->1->6->5->4->9->8->7->10->11

Write a solid secure definition for the function KReverse.

Constraints :
-If the no. of nodes in a link list is not a multiple of k then left-out nodes in the end should remain as it is.
-You have to retain the memory address of the nodes without modifying it i.e. you can't just interchange the values in the nodes.
-No extra memory allowed.

 

8. Find if there is a loop in a linked List?

 

9. Given a string search it in a set of strings (say among 1000s of string). What datastructure would you use to store those 1000 strings and get the results fastest?

 

10. Given 1000 bottles of juice, one of them contains poison and tastes bitter. Spot the spoiled bottle in minimum sips? (hint: try to mix them)