Test Paper :3
Paper Type : Whole Testpaper
Test Date : 22 December 2010
Test Location : AIT Pune
Posted By : Barun
My experience Microsoft conducted on 22nd December, 2010.
First round was a written test of an hour. There were 6 questions (4 programming and 2 test cases) 10 marks each.
1) Find output of following code?
void main()
{
void *ptr;
char *a='A';
char *b="TAN";
int i=50;
ptr=a;
ptr=(*char)malloc(sizeof(a));
printf("%c",*ptr);
ptr=i;
ptr=(*int)malloc(sizeof(i));
printf("%d",++(*ptr));
ptr=b;
ptr=(*char)malloc(sizeof(b));
printf("%c",++(*ptr));
}
Ans: A51AN
2) Write a program that takes a no. from user and prints the no. subtracting 5 each time from the no. till the no. doesn’t crosses/reaches 0.And again prints the nos. Now increasing 5 each time till the no. doesn’t reaches/crosses original no. Don't use any loops or goto stmnt. And don't declare any local variables.
Ans: use recursion.
3) Convert a no. from string to integer.
Eg: str:"1234"
convert to int a=1234;
Ans: while(*ptr!=NULL)
{
a=(a*10)+(*ptr-48);
}
4) Find the subarray of an array that has the greatest sum? Array contains both +ve as well as -ve nos.
Ans: I did it using 3 loops but when I went for the 2nd technical round the interviewer told me a very simple and optimal program for the same.
sumtillnow=0;
sum=0;
for(i=0;i< p=""> <>
{
sumtillnow+=a[i];
if(sumtillnow>sum)
sum=sumtillnow;
if(sumtillnow<=0)
sumtillnow=0;
}
5) Write test cases for a student regestration form.
6) Write test cases for a web search engine.
20 students were shortlisted after the written test.
1st technical round.
First he saw my resume and asked me few questions about my BE Project and the TE Project. Then I was asked many questions from OOP concepts. Mainly about virtual functions, pure virtual functions (application based) and v-table etc.
Then he asked me some ques from OS.
1) Critical section
2) Semaphores
3) Processes
4) Threads
5) Reader Writers problem
Then there were a few questions from Logic Gates
1) Half adder....circuit and functionality
2) Full adder....circuit and functionality
Then he asked me 2 puzzles.
1) There are 3 buckets full of oranges, apples and mixture of both. Buckets are labeled with orange, apple and mixture. And it is known that all labels are false. Now just pick up 1 fruit from any 1 of the buckets and label all of them correctly.
Ans: Hint: pick the fruit from mixed labeled basket.
2) There are 5 bags containing marbles. All are identical. 4 of them weight 9g one of them is 10g. You have a weighing balance. In one go can u tell which is the bag with 10g.
Ans: I was blank. Min I could produce was in 3 chances.
In 1st round other students were also asked question from DBMS (Normalization, few queries and ER diagrams). And question from TOC (Finite automata machine). Draw a finite automata to accept a binary no. that is divisible by 5.
2nd Round
He asked me some test cases.
Then the interviewer asked me to optimize certain codes.
1) 4th question of the written exam. (Subarry sum)
2) An array of n elements contains elements 1-(n-1) in random order and 1 entry is duplicated. Find the duplicate entry?
Ans: I told him to take one more array. Now pick the elements from 1st array and put them into respective index of the 2nd array. If duplicate occur then report and end the loop.
He asked me to optimize the code. Then I suggested a BST. He asked me to optimize more and more and more and more this question.
But somehow I was advanced for the 3rd round. I was very excited.
3rd Round: HR
Some test cases and Why should I take you in Microsoft.
But unfortunately I wasn’t able to make it: (But may be these questions will help you for your placements)
Best of Luck to All.
You are Here: Home > Microsoft - Placement Paper A.I.T Pune
1 comments:
Thanks for giving microsoft placement paper.
Placement Papers
Post a Comment