Microsoft Interview | Set 6
I am a guy from CSE dept, IIT-BHU and currently in 4th year. I am placed in microsoft now and all the credit goes to geeksforgeeks for sharpening and improving my coding skills. Thanks a lot guys for such a wonderful site. Below is my interview experience, if its of any help to my fellow job seekers.
Written Round 1 :
50 multiple choice questions in 60 mins time. Had 2 sections – Aptitude and Programming Ability.
Written Round 2 : 3 coding questions in 1 hour.
- Swap every consecutive odd and even positioned bit in a number.
Ex:- 10101011010101 = 01010111101010
- Given a binary search tree . Convert it into a doubly linked list in place (no extra space) such that prev points to left child and next points to right child.
- Given a linked list that contains 0,1 and 2 . Sort this linked such that it contains 0s first, then 1s and then 2s in O(n) time.
Ex:- 2->2->1->0->0->2->1->1->0 = 0->0->0->1->1->1-2->2->2
PI round 1 (Technical):
- About urself, most challenging project of all you have done and about ur internship.
- Remove from string s1, all the characters that are present in string s2.
S1=”abcde” s2=”xyazbx” Ans. S1= ”cde”
- Reverse alternate k nodes in an linked list.
Ex:- 1->2->3->4->5->6->7->8 if k=2; then return 2->1->3->4->6->5->7->8
Always ask some questions to the interviewer at the end. That’s a good gesture.
Write test cases for the programs above and see if ur program covers all the test cases or not.
PI round 2 (Program manager)
- Design a tic-tac-toe game for multiplayer on a smartphone.
- Design a vending machine for blind and deaf.
PI round 3 (Technical)
- Add numbers from 1 to n^2 into a n X n matrix spirally.
1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
- Remove duplicates from a string in place. Ex-microsoft -> microsft
- Some question on recursive functions using memoization technique for optimization.
PI round 4 (Testing)
- 1. Given a func :: int *strcmp(char *s1,char *s2);
Write test cases to check functionality and security issues and even automate the
generation of test cases.
- 2. Given a func :: int typeOfTriangle(int side1,int side2,int side3); (func gives a number for the type of triangle)
Write test cases to check functionality and security issues and even automate the generation of test cases.
- 3. WAP to reverse words in a sentence.
I am a good boy -> boy good a am i
- 4. WAP to get the next higher palindrome of a given number.
123 -> 131 1232 -> 1331
PS – Functional issues are test cases that check the functionality of the program and Security issues are the ones where the program may crash.
PI round 5 (Technical)
- WAP to check if a binary tree is a BST or not.
- WAP to find Least Common Ancestor of two nodes in a BST.
- Reverse every two nodes in a linked iteratively and recursively.
PS- Whenever u write a program be sure to cover all the corner cases and write it in a proper indented way. As interviewers ask to write testcases for the program u have written and then check if ur program covers all the test cases.
All the best fellas !!!
Many Many congratulations to Pritam Kumar Das. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
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 , E-Litmus and Microsoft Test Serieses.