Microsoft Interview Experience (On-Campus for Internship)
Online Coding Round:
It was conducted on Cocubes. There were 3 questions to be solved in 75 mins. My questions were:
- Given a character array, find the average of ascii characters in the array. Ex:- i/p = ab12, o/p = 73.5 (2 marks)
- Evaluation of a given infix expression(as character array). Ex:- i/p = 4-5*14/7+2, o/p = -4 (3 marks)
- Find the lowest number possible by removing k digit from a given number. Ex:- i/p = 4312389, k=3, o/p = 1238 (5 marks)
Out of 200 students, approximately 60-65 where selected for pen & paper round. Gettting more than 5 marks was enough for clearing this round. Regarding cocubes, it is a simple ide where one can only test the code for compilation error and few basic test cases. We where not able to run the code for custom test-cases, but you can certainly modify the input string for checking.
Pen & paper round:
This round consisted of 7 short questions(based on C lang.) of 3 marks each and one coding question of 6 mark. The coding question was Detecting and Removing Loop from a Linked List. All the questions where compulsory. Around 24 students moved forward for face-to-face personal interviews.
Interviewer went through my cv and asked some question from OOPs, like what are virtual functions and destructors, and difference between new and malloc. Then how to deallocate memory and what happens for the combination of :- (new and free) and (malloc and delete). Then he asked me 2 coding questions:
- Given a Binary Search Tree, convert it into a Doubly Linked List. He asked me to write some test cases.
- Given a row-wise sorted n*n matrix, Print the elements of matrix in non-decreasing order. Space complexity of O(n) was allowed. I used min-heap to solve it.
For the questions try to 1st tell your approach and use test cases to dry run your approach. Then move to writing code, when asked.
I was asked :
- There are two parallel lines. One line has n points and other m points. Points are connected to each other in a zig-zag manner. Find the number crosses i.e, points of intersection of connections. Similar to this problem- https://www.geeksforgeeks.org/counting-cross-lines-array/
- A set on N rectangles, each having sides aligned to x-axis and y-axis, was given. Another rectangle was given and I had to check how many rectangles from the set completely lie inside the new rectangle. We can sort the set along x-axis and y-axis, and find the no of rectangles by using 4 binary searches.
- Exception handling in c++ and java.
One more round was there for selected students. Total 6 students was selected.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. Google and Microsoft Test Serieses.