Microsoft Interview Questions
- -1of 1 vote
AnswersGiven a doubly linked list with a data item, a previous and a next ptr along with another pointer "child" that may point to the head of another doubly linked list of same type(it will lead to a general tree type of structure) or it may be null. Flatten the tree into a linked list... minimum space and time complexity(order n). The doubly linked lists's head and tail are given.
- dev August 20, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersDesign Chess Game. asked me this in testing interview.
- Andy2000 August 16, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 1of 1 vote
AnswersYou have a circular Linked List:
- Andy2000 August 16, 2012 in United States
a->b->c->d->e->c
Find where the cycle is starting| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 1of 1 vote
AnswersYou have 2 sorted Arrays. A and B. A is shorter than B. B has few elements in sorted order and has space for all elements of A. Now Merge these both array so that All elements are sorted. You cant use extra Array. Use Only Array B.
- Andy2000 August 16, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Arrays - 0of 0 votes
Answersfind degree of connection of two users in social networking site, like linkedin shows us upto 3rd level degree of distance.
- sb August 09, 2012 in India
so the aim is to find minimum degree of connection between two users.
by degree of connection i mean, say user1 is friend with user2 and user2 is also friend with user3
now user1 and user3 are 1st degree of connection with user2
and user3 is 2nd degree of connection with user1| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersFind lowest common ancestor of two nodes in a binary tree iteratively.
- Aashish August 05, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswersWe are given a list of numbers A= {5,9,12,16,25,30,45} and their fixed probability of occurance P={0.22,0.18,0.20,0.05,0.25,0.02,0.08} where sum(p) =1. The problem is to arrange the numbers in a binary search tree in a way that minimizes the expected total access time. Note: In a binary search tree, number of comparisions needed to access element at depth d is (1+d)
- samant.bit August 02, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Dynamic Programming - 0of 0 votes
AnswersImplement user defined malloc().
- lokesh.cse.nitt August 01, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 0 votes
AnswersRemove whitespace characters in a string, in place and with out shifting
- irraju July 29, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer - 0of 0 votes
AnswersThe two nodes in BST are swapped.Correct the BST.
- amnesiac July 28, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Coding - 0of 0 votes
AnswersConvert a binary search tree into doubly linked list in sorted order in place.
- bond July 27, 2012 in India for hyd| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Trees and Graphs - 1of 1 vote
AnswersThis is one of the interesting questions asked to my friend who had a telephonic with Microsoft recently:
- Jeanclaude July 25, 2012 in United States
Question: Imagine you have a device that is used to count the number of leaves in a tree. And it has an output screen which displays how many leaves are present in a tree, plus a start/stop button. Write as many test cases as possible and sort them under as different test buckets as possible.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 0of 0 votes
AnswersGive the output of the following code:
- akash1600 July 24, 2012 in United States#include<iostream> using namespace std; int main() { int a=10,b=2; b=a+++a; cout<<b<<" "<<a"\n"; return 0; }
| Report Duplicate | Flag | PURGE
Microsoft Intern C - 0of 0 votes
AnswersA table composed of N*M cells,each having a certain quantity of apples, is given. you start from the upper-left corner. At each step you can go down or right one cell.Design an algorithm to find the maximum number of apples you can collect ,if you are moving from upper-left corner to bottom-right corner.
- john.matheus July 23, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a pointer to the root of a binary tree , check whether the tree is
- cobra July 19, 2012 in India
balanced or not.| Report Duplicate | Flag | PURGE
Microsoft Data Structures - 0of 0 votes
Answerswrite a function/procedure, it should detect and report all UN-USED FUNCTIONS (i.e functions are defined but not called) in a C++ class(i.e suppose you are developing a c++ editor for code compilation) -- MS bing
- sse July 15, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 0of 0 votes
Answersfind the balance index of an array where balanced index i is defined as the one whose left sum is equal to the right sum of the index .
- softy July 15, 2012 in India for bing
i.e
summation (1 to i-1) = summation (i+1 to length of an array) firdt I gave o(n2) solution , but then before i could give O(n) solution it was time up for me,
O(n) solution will be we have to loop through i = 1 to N and find if ( sum of array - sum of array (1 to i-1 ) = ( sum of array - sum of array (1 to i+1 ) the return i.
Your thoughts?| Report Duplicate | Flag | PURGE
Microsoft Algorithm Arrays Coding Data Structures - -1of 1 vote
Answersthere are N people in a room one of them is a celebrity .At least one person knows other but all knows celebrity.Celebrity doesnt know any one.There is an api isKnown(a,b) which returns true if a knows b.y.
- softy July 15, 2012 in United States for bing
I gave the O(n2) answer.
But I think this can be done in O(n) .We have to compare call isKnown(a[i],a[i+1]) && iskNown(a[i+1],a[i]) returns true remove both frmo the array else remove that a[i] which return true, this will reduce the array to the celebrity. order will be O(n) then.Your thoughts ??| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 0of 0 votes
AnswersHow to find the path to a node of a non-binary tree? It's easy if it's a binary but here it's non-binary.
- Anonymous July 13, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Algorithm - -2of 2 votes
Answersc
- arun July 13, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer - 0of 0 votes
Answerswrite test cases for digital pen?
- Sudha July 11, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Quality Assurance Engineer - 0of 0 votes
Answerswrite test cases for reverse string for ABC?
- Sudha July 11, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Quality Assurance Engineer - 0of 0 votes
Answerwrite test case for iphone weather app?
- Sudha July 11, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Quality Assurance Engineer - 0of 0 votes
AnswersWrite a code in C for the following:
- jeanclaude July 09, 2012 in United States
Starting from 1, assign an alphabet to each integer, for e.g. if input is 1 then A should be the output), 2 = B ....... 26 = Z. Similarly, 27 = AA, 28 = AB..........52 = AZ. 702 = ZZ, 703 = AAA and so on. The function takes only one integer argument . for e.g ConvertToAphabet(int x). One additional consideration here is, the user is free to provide any length of integer (bigint long int etc), no restriction there.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test C - 0of 0 votes
AnswersDo the post order traversal of a binary search tree in iterative manner. You cannot use recursion. (Hint: You can use stack)
- samant.bit July 09, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Algorithm - -1of 1 vote
AnswersWhat would be the output of this program.
- kishore July 06, 2012 in India
#define colums 4
#define rows 3
main()
{
int i,j,k;
int a[rows][colums]={4,5,6,7,8,9,10,11,12};
i=j=k=99;
for(i=0;i<rows;i++)
for(j=0;j<colums;j++)
if(a[k][j]<k)
k=a[i][j];
printf("%d\n",k);
}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
Answerswrite a pseudo code to calculate
- akash1600 July 06, 2012 in India
func(n) = 2*(func(n-1)+func(n-2)) in log(n) complexity.
Given:.func(1) = 1;func(2) = 3| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer Algorithm