# Microsoft Interview | Set 5

Hi everyone, I would like to share my experience with MicroSoft, as i have been the lucky hire.

**Date: **27th August 2012

**No. of Rounds: **2 Written(online) + 4 rounds of PI( all Algo/Technical )

**Type of Interview:** Campus Interview for freshers

**Written (online)**

Objective(60 minutes) + Subjective(60 minutes)

Objective: Aptitude + Reasoning( 30 questions ) and technical( 20 questions, C/C++ programs, flow chart, identify correct function )

Subjective: 3 coding question( No in-build compiler in Web-Browser, simply you have to write your working code as a function/functions )

- A number is given say n, find the minimum number which is greater than n and has same no. of set bits in it.
- Binary search tree to Doubly linked list conversion( prefer in-place conversion )
- Find the second maximum no. in an array

**Personal Interviews (4 rounds)**

**Round 1: ( 40-50 mins )**

- Details about the project that i have listed in my resume, asked various question related to those projects.
- details about q1 and q2 which is asked in the Subjective round, how you solve the problem and ask to write the same code I have written in Test and explain it.
- question from OS:

….**i)**You have 10 GB of RAM, and you load multiples instances of a program of size 1 GB( let’s say more than 10 instances), then what will happen, how the OS handle this situation and up to what extends?

….**ii)**producer – consumer problem

**Round 2: ( 20-30 mins )**

- You have given a number N, print all balanced parenthesis expression which can be generate using N pairs of open and close braces. For ex. for N=3, ((())),()()(),()(()),(())()

First i gave him a brute force solution(generate all possible combination and check for valid expression),then he ask me for optimized code and I was able to do it after little mess-up.also ask for complexity of my code. - You have given a adjacency matrix of a graph, find the number of connected component set of the graph.

**Round 3: ( 35-45 mins )**

- A string str and two character a and b are given to a function, find out the minimum distance between these two given characters in the str. first I gave him a brute force solution( O(n^2) ) then he ask to optimize it ( O(n) ) and finally somehow i was able to do it.
- You have n processes and m available resources, explain each step of OS in the execution of those process along with which data structure will be suitable at a condition, which scheduling algorithm will suit best, also in case of preemptive scheduling, waiting queue etc.. its take a long time to explain him. but finally he is satisfied with my answers.
- Write a modified strcmp function which ignores cases and returns -1 if s1 < s2, 0 if s1 = s2, else returns 1.
- iterative inorder traversal.

**Round 4: ( 40-45 mins )**

- Give a schema for college student database management( tables, attributes and relationships ), ask me to normalize it up to 3NF.
- Some queries based upon schema:

Find the maximum score of each student in his/her last semester’s math subject.(it also be possible that some student got year back and not promoted, handle all the cases).

I tried it hard, gave him 2-3 wrong answers, but not able to do it(as i’m not very good in DBMS).. but he was satisfied with given schema. - He ask me about favorite programming language, and why I like that language..
- You have given a range in Integer(a to b), find all the prime number between a and b.

…..**i)**first i gave him the simple solution(check every no. whether it is prime or not).

…..**ii)**then he asked about Sieve and to implement it, and which on is better( first approach or sieve) - what is most challenging moment in your B.Tech life. ?
- Why do you want to join MicroSoft.?
- Some question on my hobbies.
- do you have any question for me.?

i asked 2-3 questions related to job profile(SDE/SDET) that they are offering,current projects and areas.

Finally…end of PIs and After 10-15 minutes, To my great relief, this time I was hired…

Many Many congratulations to **Ajeet Kumar**. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

## Please

Loginto comment...