This was my first onsite interview with Microsoft and I must say I had an awesome experience. For most part it went very good for me, I guess the reason for my rejection was somebody else performed better than me (and the team for which I was interviewed for mentioned that they have budget to select only 1 Engineer). Questions were relatively easier except for one, which made it to the title of this post.
Phone Screen:
Onsite Interviews
Round 1:
Given a function, what this function is trying to do, can you find some problem with this function, and how can you improve the performance of this function with whatever it is doing?
void copy(int n, unit8_t *input, unit8_t *output)
{
while(n--)
{
*output++ = *input++;
}
}Round 2: [Lunch]
What keeps you motivated, Why you want to join Microsoft, How you like working in your current company, Explain an interesting problem that you solved recently.
Most beautiful Interview Question I have ever come across
You are given an abstract machine that has a timer, which can be visualized as a 1 dimensional timeline gradually increasing. This machine has an abstract OS running on it, which can perform only 3 operations:
More explaination:
Analogy of CreateTask function can be explained with an Alarm clock. Suppose you have a hypothetical Victorian Alarm Clock that can schedule only one alarm (by spinning a spring). You set the alarm time based on the input relative to current time, which means if now time is 10:00pm and you are asked to set alarm 8hrs from now, then your alarm should ring at 6:00am.
More Explaination:
Taking the alarm clock analogy here, if an alam clock was set at 10:00pm for 8hrs from that time, then calling ElapseTask at 12:00am will return 2, calling ElapseTask at 5:00am will return 7, but calling ElapseTask anytime after 6:00am will return 0.
Problem statement: You have to use these 3 OS calls and design a API or a set of APIs that can schedule multiple task.
Round 3:
Round 4: [Non-technical]