rss
twitter
    Find out what I'm doing, Follow Me :)
Showing posts with label Microsoft Interview. Show all posts
Showing posts with label Microsoft Interview. Show all posts

Sunday, March 7, 2010

Microsoft Interview Questions

Hi all,
       Here is my first useful post in this blog.I will be posting about my experience with Microsoft interview. Team from Microsoft visited my college this December (for placement) and I had been fortunate enough to attend the test in which I learnt a lot. Here I give the questions asked for me in both written and subsequent rounds.
Written Test:
      The test had 4 questions and time given was about 1 hour. Questions were
  1. A program was given and we were asked to debug the code so that it works as desired. The program's aim was "finding the meeting point of two linked lists".  It was quite simple and some of errors were like in allocating memory, some logical errors. But its doable.
  2. Given a Circuit (with resistors), we need to calculate the total resistance. Input will be like AB-5ohm, BC-6ohm, BC-10ohm, BC-20 ohm, CD-5 ohm. BC has been repeated twice implying they are in series. "Write a program  by implementing efficient data structure for storing and calculating the total resistance". I used stack using linked list and implemented which works for almost all combinations of circuits (but didnt work for some :D).
  3. "Write test cases for reversing words of string ". For eg. "This is nice" is input string and output is "nice is This". We need to write test cases for this program,(not the program for it). Writing some 5 to 10 will do. Start from some of the very simple cases like for eg. "Check whether the program in accepting input".
  4. You have been asked to write features of an "Universal Remote Controller".  Eg. "It will support TV,System, DTH etc". 
  The interviews in MS will be a loop process where a person has to attend interviews in a loop(every interviewer will interview us once). We need to satisfy all the four to get into MS. These are the questions asked for me in the three iterations of the loop I attended.(Totally 4, I was thrown out after 3. :D) .

Round 1: 

It lasted for about 1 hour and 15 mins, with the questions mostly from what is written in your resume.Some of the questions asked were,
  • What were your challenging projects? I named one and I was asked to write test cases for that. Interviewer was not satisfied until I gave around 10 test cases.
  • Deletion of a node in linked list.. seems pretty simple , he was expecting a code with good coding standards. From there discussion went upto locks and mutexes in OS. 
  • Print a Random word from a file. Input is "path to a file", constraints- No extra memory like hashing etc. All the words in the file should have equal probability.
  • Rectangles overlapping questions, write test cases.(I had seen this already). This is a popular MS question. I started writing immediately after he gave the question(without asking much details). Seeing that he asked whether I had known the question earlier, I said yes.(Reason I am saying is, at the end while he was telling the points he noted in this laptop during the course of interview, one was the points was honesty. It counts in interview :D). I have seen here.
Within 5 mins I was called for second round and questions were,

Round 2:
This time I was asked just one question and interview lasted for 1 hour 15 mins.
"Given a large number with many digits, propose a method or data structure to efficiently store them. Addition, subtraction, mult, division should be supported by your design."  He asked for a valid(working) C++ code .

Immediately after that round I was called for the next and this round lasted for just 20 mins.

Round 3:
Given a matrix, we need to transform it in such a way that  if an element is zero, we need to zero out the contents of corresponding row and column(of that element). Only minimal extra space allowed, test cases was also asked. I gave some solutions,but he didnt get satisfied as the I used more space than what he asked.
eg. if the matrix is
1 1 1
1 1 1
1 1 0
the output matrix is
1 1 0
1 1 0
0 0 0.

These were the questions asked for me.For all the rounds we need to write the code in paper and he ll be monitoring us from the other side of desk.Some may be asked to write the code in board also. Please feel free to discuss the solutions here and ask any doubts if u have.

Things I learnt from MS interview :
  • Thinking aloud, interviewers need to know what you think abt when they ask questions. 
  • Coding with standards.
  •  How to answer questions if we dont know the solution.
These were some I learnt.  There are many sites that give microsoft questions and if u want to prepare just google "microsoft interview questions" and u ll get numerous sites. All the best for your job interviews. :)

For microsoft internship questions, see this post by my friend.
http://blog.ceglug.org/sanath/?p=54