Since 2008, I’ve made three interviews with Microsoft. This interview was special one because it was full of technical instead of previous interviews. In this post I’ll give a brief about questions that I’ve been asked in the interview.
You can read this document to know more about tips of Microsoft interviews: Tips about MS Phone Interviews
- Why you’d like to work in Microsoft?
- Why you’d like to work in Artificial Intelligence? (They know that I was interested in this field)
- Rank yourself out of 10 in C++
- What’s the difference between Structs and Classes?
- When writing a public member function in a class, does every object has it’s own copy of it?
- When an object calls a member function that operates on it’s member data, how does this function determines that it’s using this object’s data?
- What’s the difference between creating an object using new keyword and without?
- In which memory storage the compiler put the object created by new and created without it?
- What’s the size of this union
union DATA
{
char a;
byte b;
int d;
}var
My answer was 4 bytes (assuming that int is 4 bytes) - So, what’s the special feature in union’s that differentiates it from structs?
- Develop a function that’s similar to atoi function. Below was my code:
int* Atoi(char* c)
{
int x = 0;
while(c)
{
if(*c < 48 || *c > 48+9) return NULL;
x *= 10;
x += *c – 48;
c++;
}
return &x;
} // NB: this function has a bug, discover it yourself! 😀 - Suggest a sorting algorithm to sort two arrays.
My answer was Selection Sort. - What’s the complexity of that algorithm?
O(n^2) - So, if the two arrays was ordered before sorting them, does this will change the complexity of that algorithm
O(n) - Can you suggest a better sorting algorithm?
My answer was Quick Sort and Radix Sort. - Tell me how quick sort work?
- What’s the complexity of it?
O(n lg n) - Do you’ve any questions?
I’ve asked him:
1) What are challenges facing you working in CLR?
2) I’ve asked him about merging AI in CLR (especially in Garbage Collection and Thread Sync.)