Microsoft Placement Paper
Company: Microsoft India
There were 4 rounds for selection procedure. First round was a written test, second round was group interview and 3rd and 4th rounds were technical interview. Each round had eliminations. Total 143 students were eligible for written test and 16 students were selected for the next round, ie. group interview. Only 8 students were able to go for 3rd round of technical interview. In 3rd round 4 more students were eliminated and remaining 4 students went for final round of technical interview. Only 1 student got an offer finally from Microsoft.
Following is the detail about each round.
Note: All examples which I will give here are just for your understanding. Interviewer was not giving any examples. Hardly 2 – 3 time interviewer gave examples.
Round 1: Written test
Paper style: 3 subjective questions
Time limit: 1½ hour
Question 1: Finding output….
It was string cruncher program. First remove all repeated consecutive substring with length 1, then delete substring of length 2 and so on…
Example : string is “abcabeccced”
After removing repeated substring of length 1: “abcababceccced” –> “abcababceced” (2 ‘c’ are removed)
After removing repeated substring of length 2: “abcababceced” –> “abcabceced” (substring “ab” is removed)
and so on…
Question 2: Writing a program.
Definition: You are given 3 integer arrays A, B and C of length n1, n2 and n3 respectively. All arrays are sorted. We define triplet of these 3 arrays as (x,y,z) where x is any integer from A, y from B and z from C. We define distance of triplet as maximum difference among triplet elements, i.e. Maximum of x – y, y – z or z – x. Write a program to find minimum triplet distance. (means there are n1*n2*n3 number of possible triplets are possible…among all triplets which triplet has minimum distance…Give only distance, but not triplet elements). Your program must be as much efficient as possible.
Question 3: Writing program.
Definition: You are given 2 integer numbers in linked list form. Add those 2 numbers.
Example: First number is 234 and second number is 35. So, you are provided with 2 linked lists 2->3->4 and 3->5. Your answer must be 2->6->9. (Make sure to take care of carry number). This example was given in paper.
Round 2: Group Interview
All candidates who had cleared the written test were called for group interview. Here we were given 3 problems one by one. Time limit was between 15 to 20 minutes. Once they gave problem definition we were supposed to think on it and discuss our ideas and logic about solving that problem with one of the representatives from Microsoft. Once that representative was convinced with our logic then we had to write code for that problem on paper.
Problem 1: You are given a string. Develop a function to remove duplicate characters from that string. String could be of any length. Your algorithm must be in space. If you wish you can use constant size extra space which is not dependent any how on string size. Your algorithm must be of complexity of O(n). Example: Given string is BANANAS. Output must be BANS. All repeated characters are removed.
Problem 2: You have a tree and address of its root. Write an efficient program to test whether a given tree is Binary search Tree or not. (Hint: In-order traversal of binary search tree is sorted in increasing order. Use this property to develop program)
Problem 3: You have 2 sorted lists and a function that merge that 2 lists such that output is again sorted and duplicates are removed. That means output is union of those 2 lists in sorted form.
Example: First list is 2->3->5->6->8 and second list is 4->5->6->7 and output of function is 2->3->4->5->6->7->8.
Develop test cases to test given function such that your test cases ensures that given function works for every situation. That is if inputs are valid then it gives proper output in any case or otherwise it shows error message.
Round 3: First Technical Interview
All those who had cleared group interview were called for first technical interview. They were taking minimum 2 hours for first interview. Some of us also faced interview for 3 or more hours.
Round 4: Second Technical Interview
All those who had cleared first technical interview were called for second interview. This was last round of interview. They took 1½ to 2 hours for this second interview.
I don’t remember all the questions which were asked to me in both interviews. But still some of the questions which I can remember (almost 80 to 90% questions) are listed below.
In both interview they ask questions from C/C++, java, OS, Data structure and algorithms, Microprocessors and compiler constructions. With this, they also asked me to develop more than 6 to 8 programs. You can develop all programs in 5 to 7 minutes. But after writing program they asked to find its complexity and try to reduce the complexity and write the program again. In this way it took almost 15 to 20 min for each program. Some took less than 15 minutes also.
Some of the interview questions are as follows:
You are given a linked list and block size k. Reverse block of size k from list.
For example you are given linked list of 1000 nodes and block size is 5 then instead of reversing whole list, reverse first 5 elements, then 6 to 10 elements, then 11 to 15 elements, and so on…You have singly linked list and your algorithm which you will implement must be in space, that is no extra space is allowed.
You are given a tree and any 2 nodes of that tree. Find common parent of both nodes. Develop as much efficient program as you can.
In unix there is a command called “tail”. Implement that command in C.
Some questions about race condition (OS)
Questions related to semaphores.
Questions related to mutex. Applications of mutex. How to implement mutex in OS?
Questions about Critical region (OS).
How to ensure that race condition doesn’t occur. Give your view as you are OS designer.
How to ensure that each process lock the critical region before they enter in it. As OS designer How will you force the process to do this?
Questions on IPC
Questions on Shared memory and Message passing mechanism.
Difference between system call and API call
How system call works? What happens when system call is invoked?
Different types of system calls?
Some questions from microprocessor. About Interrupts
Types of Interrupts. What happened when interrupt is called?
You are given a hard copy of a program which contains some errors. Your job is to find all types of errors from it. And discuss why is it an error. Write correct program for the same.
You are given a linked list and a number n. You also have a function to delete all nodes from that list which are at position which multiple of n in the list.
Example: if number is 3 then delete 3rd, 6th, 9th ,…nodes form the list. Develop a program that tests whether given function works properly or not. (In short they are asking me to develop general program for all test cases. By running that program all tests can be performed.)
Questions on java. Exception handling
Need of catch and finally block in java exception handling..
How will you create your own exception.. Explain with example.
Some questions on compiler construction. What is parser? What is input to the parser and what is output of parser? Difference between top down and bottom up parser.
F(1) = 1.
F(2n) = F (n) and F(2n+1) = F(n) + F(n+1).
Develop recursive program.
You are given a string which contains some special characters. You also have set of special characters. You are given other string (call it as pattern string). Your job is to write a program to replace each special characters in given string by pattern string. You are not allowed to create new resulting string. You need to allocate some new memory to given existing string but constraint is you can only allocate memory one time. Allocate memory exactly what you need not more not less.
Assume that your friend is writing a book . He gives you a file that contains that book. Your job is to develop an algorithm for indexing of that book. In every book there is one index at end which contains some words which are not there in normal vocabulary dictionary. It also contains page number for reference. You can use any data structure you want. You need to justify why you have used that data structure and also need to justify your logic.
Question from my B.E. final semester project. Asked me to explain whole project.
Question from everything written on my resume.
Question from my every project I did. They asked me to explain each project and then how to do some modification? That modification will be suggested by interviewer himself.
My experience in Teaching assistantship.
They had my written test answer sheet. They opened it and asked me to explain why I gave that output or why I implement that logic. How did I arrive to that solution which I had written in answer sheet.
In written test, for second question I had implement a program which was not much efficient. During interview they ask me to optimize my program. They also gave hint to optimize it.
During group interview, in second problem I was only able to discuss logic I was unable to develop program in given time limit. Interviewer knew this. She asked me to develop that program during interview.
Which is your favorite software tool? If you are allowed to add any feature in it which feature you will add?
Which is your favorite subject? Some questions from that subject.
Something about yourself , your hobbies, interests, strengths and weakness.
I was unable to clear 4th round that is second technical interview. I hope this will help you in your preparation for Microsoft.
Thanks and regards,
Microsoft Placement Paper