This action might not be possible to undo. Are you sure you want to continue?

MICROSOFT

PLACEMENT PAPERS

NISHNA 3/14/2011

Microsoft Placement papers 2005 -’11

**MICROSOFT PLACEMENT PAPERS
**

2011 Microsoft Placement Paper

1. C++ ( what is virtual function ? what happens if an error occurs in constructor or destructor. Discussion on error handling, templates, unique features of C++. What is different in C++, ( compare with unix). 2. Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list). 3. Given 3 lines of assembly code : find it is doing. IT was to find absolute value. 4. If you are on a boat and you throw out a suitcase, Will the level of water increase. 5. Print an integer using only putchar. Try doing it without using extra storage. 6. Write C code for (a) deleting an element from a linked list (b) traversing a linked list 7. Compute the number of ones in an unsigned integer. ANS. #define count_ones(x) \ (x=(0xaaaaaaaa&x)>>1+(0x55555555&x), \ x=(0xcccccccc&x)>>2+(0x33333333&x), \ x=(0xf0f0f0f0&x)>>4+(0x0f0f0f0f&x), \ x=(0xff00ff00&x)>>8+(0x00ff00ff&x), \ x=x>>16+(0x0000ffff&x)) 8. Compute the discrete log of an unsigned integer. ANS. #define discrete_log(h) \ (h=(h>>1)|(h>>2), \ h|=(h>>2), \ h|=(h>>4), \ h|=(h>>8), \ h|=(h>>16), \ h=(0xaaaaaaaa&h)>>1+(0x55555555&h), \ h=(0xcccccccc&h)>>2+(0x33333333&h), \ h=(0xf0f0f0f0&h)>>4+(0x0f0f0f0f&h), \ h=(0xff00ff00&h)>>8+(0x00ff00ff&h), \ h=(h>>16)+(0x0000ffff&h))

9. Let f(k) = y where k is the y-th number in the increasing sequence of non-negative integers with the same number of ones in its binary representation as y, e.g. f(0) = 1, f(1) = 1, f(2) = 2, f(3) = 1, f(4) = 3, f(5) = 2, f(6) = 3 and so on. Given k >= 0, compute f(k). 10. A character set has 1 and 2 byte characters. One byte characters have 0 as the first bit. You just keep accumulating the characters in a buffer. Suppose at some point the user types a backspace, how can you remove the character efficiently. (Note: You cant store the last character typed because the user can type in arbitrarily many backspaces) 11. Write a function to find the depth of a binary tree. 12. Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted. 13. Assuming that locks are the only reason due to which deadlocks can occur in a system. What would be a foolproof method of avoiding deadlocks in the system.

15. To compute a uniformly random integer between 1 and k (k < n). For a total of <= 3n/2 strcmp() calls. Generate a random permutation of the array.'a']). } 19. why is disk interleaving adopted Category SubCategory Location Company IT Placement Papers Bangalore Microsoft India About Microsoft India:Microsoft entered India in 1990 and has since worked closely with the Indian government. Try both O(n) and O(nsquare). That's also the lower bound. eg. To compute a random permutation. New Delhi. Since its advent. How would you reverse it. given a function rand_n() that returns an integer between 1 and n. Return the duplicated value. use the standard algorithm of scanning array from n downto 1. ? How would you reverse it without using indexing in the array. Kochi. What is the expected time of your algorithm? ANS. Microsoft has been supporting and fueling the growth of the local IT industry through its partner enablement programs. "Expected time" should ring a bell. Microsoft has focused on three things. Compare the larger of the two strings in the current pair with largest-so-far to update it.14. tr reads an input file. Microsoft is becoming a key IT partner to the Indian government and the industry.. ANS. Since its entry into India. An array of integers of size n. what is disk interleaving 20. We make the benefits fit you instead of just offering a standard set of benefits. Bangalore. An array of pointers to (very long) strings. Kolkata. Find pointers to the (lexicographically) smallest and largest strings. Given an array of characters. put 'x' in array element corr to 'a' put 'y' in array element corr to 'b' put 'z' in array element corr to 'c' put 'd' in array element corr to 'd' put 'e' in array element corr to 'e' and so on. 18. Chandigarh. 16. Chennai. Microsoft currently has offices in 13 cities . swapping i-th element with a uniformly random element <= i-th. 17. Flexible benefits puts the control in your hands to choose the mix of benefits that best suit you and your family. call rand_n() repeatedly until it returns a value in the desired range. with equal probability. both inclusive. 'b's by 'y's and so on. Hyderabad.99. Scan array in pairs. And the smaller of the current pair with the smallest-so-far to update it. putc(array[c . Coimbatore. ANS. Remember largest-so-far and smallest-so-far. 'tr' has two command line arguments. Mumbai. academia and local developer community for ushering in some of the early successes in the realm of IT. and Pune. namely: Why Microsoft India. Here’s a . IT industry. Increasingly. a) have an array of length 26. 'tr abc xyz' replaces all 'a's by 'x's. Given an array t[100] which contains numbers between 1. Indore.Ahmedabad.Why should i join Microsoft India?:Microsoft India understand that each employee has unique benefit needs and to meet that we offer flexible benefits. Write an efficient C code for 'tr' program. replaces each character in the first string with the corresponding character in the second string. They both are strings of same length. the code while (!eof) { c = getc(). Jaipur.

11. An array of pointers to (very long) strings. If numbers are in 2's complement. with equal probability. or you can cross borders—in person.i< n. Ways of optimizing symbol table storage in compilers. ANS. Write a routine that prints out a 2-D array in spiral order! 3. both inclusive. lookup() implementation etc. Compute the sum. swapping i-th element with a uniformly random element <= i-th. Will the level of water increase. an ordinary looking loop like for(i=total=0. An array of size k contains integers between 1 and n. Write C code for (a) deleting an element from a linked list (b) traversing a linked list 14. without initializing the auxiliary array! 7. If you are on a boat and you throw out a suitcase. You are given an additional scratch array of size n.total+=array[i++]). (from Denis Zabavchik) Set the highest significant bit of an unsigned integer to zero .using semaphores/ada . 13. given a function rand_n() that returns an integer between 1 and n. ANS. No need to check for overflows! 8. How can you optimize the communication? (ans : communicate through shared memory on same machine. 10. Declare a void pointer ANS. An array of integers of size n. ANS.e. or country. or virtually. To compute a random permutation. Compress the original array by removing duplicates in it. you’ll have an amazing range of opportunities. An array of characters. And the smaller of the current pair with the smallest-so-far to update it. Because we have so many kinds of jobs in so many different places. You might be an individual contributor or become a manager.The interviewer was on the Microsoft C team. void *ptr. call rand_n() repeatedly until it returns a value in the desired range. thesis) 2. of Wash. Print an integer using only putchar. Set the highest significant bit of an unsigned integer to zero. Can be done in O(k) time i. bypassing the kernel _ A Univ. Try doing it without using extra storage. How is the readers-writers problem solved? . An array of integers. 4. use the standard algorithm of scanning array from n downto 1. 2009 Microsoft Placement Paper II 1. 16. Reverse the order of words in it. you can stay in one building. What if we know that integers are in 2's complement form? ANS. etc. Compare the larger of the two strings in the current pair with largest-so-far to update it. excessive buffer copying). The sum of the array is known not to overflow an integer. That's also the lower bound. 5. what is the other source of inefficiency in RPC? (answer : context switches. What is the expected time of your algorithm? ANS. . will do. 12.bird’s-eye view. At Microsoft. What are various problems unique to distributed databases 15. Generate a random permutation of the array. Remember largest-so-far and smallest-so-far. Besides communication cost. Write a routine to reverse a character array. Now call it for the given array and for each word in it. You might become an expert in a particular field or build proficiencies across many areas. A walk-through through the symbol table functions. "Expected time" should ring a bell. 6.. To compute a uniformly random integer between 1 and k (k < n). For a total of <= 3n/2 strcmp() calls. What if k << n? ANS. 9. city. Scan array in pairs. Find pointers to the (lexicographically) smallest and largest strings.

Try doing it without using extra storage. this one was a feedback process until we came up with one with no extra storage. Suppose at some point the user types a backspace. f(5) = 2. You just keep accumulating the characters in a buffer. 10. Let f(k) = y where k is the y-th number in the increasing sequence of non-negative integers with the same number of ones in its binary representation as y. A character set has 1 and 2 byte characters. Reverse the bits of an unsigned integer. One byte characters have 0 as the first bit. f(6) = 3 and so on. one of which always lies". C++ ( what is virtual function ? what happens if an error occurs in constructor or destructor. compute f(k). What is different in C++. \ h|=(h>>2). #define reverse(x) \ (x=x>>16|(0x0000ffff&x)<<16. Given 3 lines of assembly code : find it is doing. The if (x == 0) y = 0 etc. (Note: You cant store the last character typed because the user can type in arbitrarily many backspaces) 19. \ h|=(h>>4). templates. 4.g. 11.. 8. #define count_ones(x) \ (x=(0xaaaaaaaa&x)>>1+(0x55555555&x). 9. There are 3 ants at 3 corners of a triangle. f(6) = 3 and so on.. IT was to find absolute value. compute f(k). f(5) = 2. 3. f(4) = 3. \ x=(0xcccccccc&x)>>2|(0x33333333&x)<<2. e. 18. \ h|=(h>>8). \ x=(0xf0f0f0f0&x)>>4+(0x0f0f0f0f&x). Print an integer using only putchar. f(2) = 2. they randomly start moving towards another corner.. what is the probability that they don't collide. \ x=(0xff00ff00&x)>>8+(0x00ff00ff&x). ( compare with unix). Given k >= 0. \ x=(0xff00ff00&x)>>8|(0x00ff00ff&x)<<8. f(1) = 1. 7. Given k >= 0. \ x=(0xf0f0f0f0&x)>>4|(0x0f0f0f0f&x)<<4. . \ h|=(h>>16)) 17. how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list). ANS. f(3) = 1. Will the level of water increase. \ x=(0xcccccccc&x)>>2+(0x33333333&x). \ x=(0xaaaaaaaa&x)>>1|(0x55555555&x)<<1) 20. ANS.g. f(0) = 1... Write an efficient algorithm and C code to shuffle a pack of cards. Compute the number of ones in an unsigned integer. Let f(k) = y where k is the y-th number in the increasing sequence of non-negative integers with the same number of ones in its binary representation as y. 2. f(1) = 1. e. f(0) = 1. f(2) = 2. how can you remove the character efficiently.#define zero_most_significant(h) \ (h&=(h>>1)|(h>>2). unique features of C++. Given a list of numbers ( fixed list) Now given any other list. f(4) = 3. Some more bit wise optimization at assembly level 6. If you are on a boat and you throw out a suitcase. 5. A version of the "There are three persons X Y Z. f(3) = 1. etc. \ x=x>>16+(0x0000ffff&x)) 2010 Microsoft Placement Paper 1. Discussion on error handling.

What is the simples way to check if the sum of two unsigned integers has resulted in an overflow. Write. 19. 9) -> (1. Give a very good method to count the number of ones in a "n" (e. A character set has 1 and 2 byte characters.write test cases for that. while (n) begin count += n & 0x1 .. n &= (n-1). You are allowed to destroy the array if you like. Suppose at some point the user types a backspace. 5. 9.12. ->How would you safeguard your system where you hav lot of confidential data in it. efficient code for extracting unique elements from a sorted list of array. Write code for reversing a linked list. How do you represent an n-ary tree? Write a program to print the nodes of such a tree in breadth first order. 14. while (n) begin count++.)Written Test -90 mins 2. You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). [ I ended up giving about 4 or 5 different solutions for this. ANS. 5.g. Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation). end 16. (Note: You cant store the last character typed because the user can type in arbitrarily many backspaces) 13. (1.. 15. ->what would be your long term and short term solution for flights which run out of fuel in air due to lack of clearance to land durring foggy winter mornings. how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ? 17. find a solution that does it in log (n) steps. 1. 9).) 2-3 Rounds of Interview Written round was approx 60 marks. 3 coding questions . You just keep accumulating the characters in a buffer. end return count .g. Coimbatore on 24th January 2011 1. 3. 3. 32) bit number. Microsoft IT campus placement test at Amrita School of Engineering. end return count. each supposedly better than the others ]. how can you remove the character efficiently. a 10 marker was about conversion from decimal to binary and third was a simple string manipulation question. ->How would you handle a situation where your tv goes blank while watching a match. One byte characters have 0 as the first bit. end Sparse Count function sparsecount (unsigned int n) begin int count=0. Lot of situation based questions. . ->How would you test a remote controlled car. 3. 20. 5. 9. Given below are simple solutions. 9. Write a routine in C for the above. determine if there are any duplicates in it. Iterative function iterativecount (unsigned int n) begin int count=0. n >>= 1. Given an array of size N in which every number is between 1 and N.one was a simple recursion based . 3. 18. e. 5.

2 code snippets in c/c++ 2 MCQ questions .concepts of DB .

[10] Explain 3 high priority test cases for the performance of MSN search engine.. printf("%s". void deleteListTest(struct node* headRef) { struct node* myList=Listonetwothree()."FIRBE"}. [10] Write a function Compute(int x) such that it prints the values of x. printf("%s ". char** cp[]={c+3. 4x. printf("%s".cpp[-1][-1]+1)..8x.*--*++cpp+3). till the value doesn't exceed 20000.*cpp[-2]+3).**++cpp). [5] Write a function delete(struct node** Head) to delete the linked list node by node by deallocating them from the memory and at the end assign the head pointer to NULL. 2x. } //write your code here Question 3. 2x. So Don't loose ur hopes if u have not got recruited still. For all who r trying for Microsoft or any other company. If u r perfect in basics u can crack any interview. Badkundri. } ////////////////////////////////////////////////////////////////////////////////////////////////////////// Hi Friends I m Kirti.. } Question 2. c}. c+1. c+2. After reaching 20000.. It had . My one suggestion is that be perfect in basics. Question 4. 4x."AMAZI".while) or any GOTO statement. Question 5. void main() { printf("%s".OLD MICROSOFT QUESTIONS Question 1. K. Answers: Two of the trickiest questions and the easiest ones: (1) AMAZING BEST (3)void Compute (int x) { cout<<<"N". [10] Find the output of the following program segment #include char *c[]={"ENTNG". [5] Share 2 high complexity and 2 low complexity test cases for a coke vending (ATM) machine. it again comes back from . [10] List all data structures you would use for a memory management module. if(x<20000) { Compute(x*2). char ***cpp= cp. "NOTHING IS IMPOSSIBLE IN THIS WORLD. Question 6. BECAUSE IMPOSSIBLE ALSO SAYS THAT I M POSSIBLE" Ok coming to the Microsoft Test conducted on 24th May 2008 in Thakur Polytechnic College in Mumbai. delete(headRef). "NST". Note: (1) You can't use any local variables in the function (2) You can't use any loops (for or while or do. 8x . x and stops there. } cout<<<"N".

OS 6. He will test ur work for all possible set of inputs.Some Questions on Probability. find if each of the two arrays have the same set of integers ? Suggest an algo which can run faster than NlogN ? 6. Package was 8. Written test was for 2 hours. Ans is 55=Sq(5)+Sq(4)+Sq(3)+Sq(2)+Sq(1) 3. Validate a Binary search tree? (as in the left.Aptitude 2.In Data Structure they asked to write o/p of very big programs.Algorithms 7. Some ops 6. Which was time consuming.C++ 4.. 5. .Net Questions they asked was all basics I think around 450-500 students appeared for test. then he asked me to solve for that too. 9. Given a string. 3.They gave a square (5*5 square table).There was question on Analytical Reasoning. So Work hard. some questions were on normal forms. What are your interests? (as in academics/topics) 2. Strings.9 Lacks Only.In Os one question was on LRU Algorithms. Given two arrays of numbers. Reverse a linked list? 4. And all Basics 8. Be perfect in Basics ////////////////////////////////////////////////////////////////////////////////////////////////////////// Hi Friends These are some of the Microsoft Interview Questions Round 1: 1. which had 5 questions 2..Net I don't remember questions. What data structure would you use to store those 1000 strings and get the results fastest? Answer: I answered hash tables but he said suggest a better one and then gave me one Tree sort of DS and then asked me to compare the two. Many Question were on pointers.In RDBMS. 7. How much I remember I m writing here.right child follow the property) Well I gave some weird eg where the struct was not a Binary tree but if passed through the test will give positive results.C 3. Find if there is a loop in a linked List? 5. I remember only few question 1.RDBMS 8. and only 50 students were short listed for GD round.1] Written test 2] Group Discussion 3] Followed by Multiple Technical Rounds. as I had written test a month before.In C++ questions were on Inheritance.Datastructure 5. Many Basic questions were asked. But it was some what difficult. And told to find total number of squares. Round 2: The interviewer gets a bit serious with each stage.C paper was some what easy. search it in a set of strings (say among 1000s of string). 1. 4.

bVisited. Given 2 set of arrays of size N (sorted +ve integers) find the median of the resultant array of size 2N. Given a NxN matrix with 0s and 1s. (dont even think of sorting the two arrays in a third array. 1. Assume that the node definition contains a boolean flag. Then.. though u can sort them.Prologue: Well in my case he started with how they require not only a programmer but a designer and coder who writes perfect code. } . 1. at what node the cycle starts? There are a number of approaches. bool bVisited. Some Questions on the projects listed on your resume? For me some Qs on DB Lock Manager? 2. word and PowerPoint) used? I mean is the code copied 2 times for each of the processes in the main memory. Spot the spoiled bottle in minimum sips? 4. one of them contains poison and tastes bitter. now whenever you encounter a 0 make the corresponding row and column elements 0. Given 1000 bottles of juice. How could you determine if a linked list contains a cycle in it. }. How does a spell checker routine (common to both. while (pCurrent) { pCurrent->bVisited = false. you could first set this flag to false for all of the nodes: // Detect cycle // Note: pHead points to the head of the list (assume already exists) Node *pCurrent = pHead.. The approach I shared is in time N (where N is the number of nodes in your linked list). In the same Question (q1) why will u o/p "abc" for the i/p "abc" instead of "a1b1c1" ? 3. and. Try something better than order N. Write a routine that takes input as a string such as "aabbccdef" and o/p "a2b2c2def" or "a4bd2g4" for "aaaabddgggg" write it perfectly as if it should ready to be shipped after you code it. to determine whether a node has a loop. order LogN ) 3. Whats the difference b/w a thread and a process? are Word and PowerPoint different processes or threads of a single process? 5. struct Node { . Flip 1 to 0 and 0 remains as they are. pCurrent = pCurrent->pNext.. 2. for example 10110 01110 11111 10111 11111 results in 00000 00000 00110 00000 00110 Round 3: 1. if they are different processes or how is it used if they are threads.

write a function that will take a sorted array. it would be rearranged to form aelst (use some mechanism to know that the particular instance of aelst maps to slate). 3. Now. Your task. pCurrent-gt. swap the values of pNext and pPrev. Next. Node * pCurrent = pHead. That is. } while (p1 != p2). At each node. } ////////////////////////////////////////////////////////////////////////////////////////////////////////// Hi Friends Selection procedure and interview questions of Microsoft at Dhirubhai Ambani Institute of Information and Communication Technology (DA-IICT) . int size). pCurrent-gt. mapping the sorted letters (aelst) back to the word (slate or tales). for example. If the list is circular. 8. } else current++. (i. if p points to an array containing: 1. pHead = pCurrent. you slate and tales would be identical: aelst. 2. Use two pointers. A single loop will accomplish this.next. possibly with duplicates. How would you reverse a doubly-linked list? This problem isn't too hard..next->next. if one element of your array was slate. while (pCurrent) { pTemp = pCurrent-gt. and compact the array. all of the anagrams are grouped together. current++) if (p[current] != p[insert-1]) { p[insert] = p[current]. and iterate to the end. 8. p2 is moving through the list twice as fast as p1. with a length of 5 returned.e. 9. p1. 7. insert++. int size) { int current. insert = 1. } 3. p2 = p2-gt. At this point. 10. int compact(int * p. which is in time O(N) and space O(1). sort the entire array of these modified dictionary words. 9. Each string is a word from the dictionary. 7.) Begin by sorting each element in the array in alphabetical order. Finally. *pTemp. You just need to start at the head of the list. a Microsoft interviewer/employee. set pHead to the last node in the list. tales and slate are anagrams. He recommended using the following technique. 9. Given the following prototype: int compact(int * p. is to devise a way to determine and display all of the anagrams within the array (two words are anagrams if they contain the same characters. // error checking and checking for NULL at end of list omitted p1 = p2 = head. pCurrent = temp. a cycle exists) it will eventually get around to that sluggard. 3.pNext = pCurrent->pPrev. current < size. described in high-level terms.pNext. 4. Finally. for (current=1. Assume you have an array that contains a number of strings (perhaps char * a[100]). do { p1 = p1-gt. 9. returning the new length of the array. 7. the contents of p should be: 1. So. step through the array and display duplicate terms. 10.pPrev = temp. current++.A much better approach was submitted by 4Guys visitor George R. when the function returns.

Time limit was between 15 to 20 minutes. Add those 2 numbers. But still some of the questions which I can . Definition: You are given 2 integer numbers in linked list form. then delete substring of length 2 and so on. Develop a function to remove duplicate characters from that string. Output must be BANS.. Once that representative was convinced with our logic then we had to write code for that problem on paper. First remove all repeated consecutive substring with length 1. Only 8 students were able to go for 3rd round of technical interview. (means there are n1*n2*n3 number of possible triplets are possible.y. n2 and n3 respectively. Use this property to develop program) Problem 3: You have 2 sorted lists and a function that merge that 2 lists such that output is again sorted and duplicates are removed.Give only distance. Round 4: Second Technical Interview All those who had cleared first technical interview were called for second interview.among all triplets which triplet has minimum distance. Example: Given string is BANANAS. Interviewer was not giving any examples. group interview. but not triplet elements).z or z . you are provided with 2 linked lists 2->3->4 and 3->5.. This example was given in paper.. Your algorithm must be in space.. Example: First number is 234 and second number is 35. B and C of length n1.e. First round was a written test. i. Example: string is "abcabeccced" After removing repeated substring of length 1: "abcababceccced" --> "abcababceced" (2 'c' are removed) After removing repeated substring of length 2: "abcababceced" --> "abcabceced" (substring "ab" is removed) and so on. Here we were given 3 problems one by one. second round was group interview and 3rd and 4th rounds were technical interview. Problem 2: You have a tree and address of its root. All arrays are sorted. They were taking minimum 2 hours for first interview.. They took 1½ to 2 hours for this second interview.x. Following is the detail about each round.. ie. Problem 1: You are given a string. Develop test cases to test given function such that your test cases ensures that given function works for every situation. Your answer must be 2->6->9. Hardly 2 .. Round 1: Written test Paper style: 3 subjective questions Time limit: 1½ hour Question 1: Finding output.There were 4 rounds for selection procedure. Write an efficient program to test whether a given tree is Binary search Tree or not. We define triplet of these 3 arrays as (x. Question 2: Writing a program..y. y from B and z from C. Once they gave problem definition we were supposed to think on it and discuss our ideas and logic about solving that problem with one of the representatives from Microsoft. That means output is union of those 2 lists in sorted form. This was last round of interview. Question 3: Writing program. Some of us also faced interview for 3 or more hours. Definition: You are given 3 integer arrays A. I don't remember all the questions which were asked to me in both interviews.z) where x is any integer from A. Note: All examples which I will give here are just for your understanding. y . Round 3: First Technical Interview All those who had cleared group interview were called for first technical interview. Only 1 student got an offer finally from Microsoft. (Make sure to take care of carry number). Write a program to find minimum triplet distance. Your algorithm must be of complexity of O(n). Maximum of x .. Your program must be as much efficient as possible. Round 2: Group Interview All candidates who had cleared the written test were called for group interview. We define distance of triplet as maximum difference among triplet elements. Total 143 students were eligible for written test and 16 students were selected for the next round. Each round had eliminations. In 3rd round 4 more students were eliminated and remaining 4 students went for final round of technical interview. That is if inputs are valid then it gives proper output in any case or otherwise it shows error message. (Hint: In-order traversal of binary search tree is sorted in increasing order. If you wish you can use constant size extra space which is not dependent any how on string size. Example: First list is 2->3->5->6->8 and second list is 4->5->6->7 and output of function is 2->3->4->5->6->7->8.3 time interviewer gave examples. String could be of any length. So. It was string cruncher program.. All repeated characters are removed.

Questions related to mutex. What is parser? What is input to the parser and what is output of parser? Difference between top down and bottom up parser. Microprocessors and compiler constructions. Questions on Java. Exception handling 20. Questions on IPC 11. then 6 to 10 elements.. For example you are given linked list of 1000 nodes and block size is 5 then instead of reversing whole list. 9.. Data structure and algorithms. F(2n) = F (n) and F(2n+1) = F(n) + F(n+1). Give your view as you are OS designer. (In short they are asking me to develop general program for all test cases. In both interview they ask questions from C/C++. 22. 4. Types of Interrupts. 12. By running that program all tests can be performed. Difference between system call and API call 13. 8. Develop a program that tests whether given function works properly or not. OS. Some questions from microprocessor. You are given a linked list and block size k. nodes form the list. Some of the interview questions are as follows: 1. How to ensure that each process lock the critical region before they enter in it. Develop recursive program. that is no extra space is allowed. Develop as much efficient program as you can.. You are given a tree and any 2 nodes of that tree. Your job is to find all types of errors from it.) 19. reverse first 5 elements.remember (almost 80 to 90% questions) are listed below. Some questions about race condition (OS) 5. Find common parent of both nodes. How system call works? What happens when system call is invoked? 14. Write correct program for the same. You are given a linked list and a number n. 6th. How to implement mutex in OS? 7. You can develop all programs in 5 to 7 minutes. You also have a function to delete all nodes from that list which are at position which multiple of n in the list. Example: if number is 3 then delete 3rd. Implement that command in C. You are given a hard copy of a program which contains some errors. With this. Need of catch and finally block in Java exception handling. Different types of system calls? 15. 9th . And discuss why is it an error. 6. Java. In unix there is a command called "tail". and so on. 21. Reverse block of size k from list. Applications of mutex. About Interrupts 16. In this way it took almost 15 to 20 min for each program. Questions on Shared memory and Message passing mechanism. 18.. 2.. . F(1) = 1..You have singly linked list and your algorithm which you will implement must be in space.. Explain with example. Some took less than 15 minutes also. As OS designer How will you force the process to do this? 10. then 11 to 15 elements. 23. How to ensure that race condition doesn't occur. But after writing program they asked to find its complexity and try to reduce the complexity and write the program again. What happened when interrupt is called? 17. they also asked me to develop more than 6 to 8 programs. Questions about Critical region (OS). Questions related to semaphores. 3. Some questions on compiler construction. How will you create your own exception.

in which one question was purely program writting (it was quick sort actually but frm question it was hard to strike). Assume that your friend is writing a book. 31. You are not allowed to create new resulting string. Which is your favorite software tool? If you are allowed to add any feature in it which feature you will add? 34. ////////////////////////////////////////////////////////////////////////////////////////////////////////// Hi Friends There were basically two rounds. Cq). 26. 28.. In written test they asked 5 questions and time for completing those questions was 90 mins. Aptitude general questions practice r. Your job is to develop an algorithm for indexing of that book. They asked me to explain each project and then how to do some modification? That modification will be suggested by interviewer himself. Which is your favorite subject? Some questions from that subject. Allocate memory exactly what you need not more not less. Interviewer knew this. You need to justify why you have used that data structure and also need to justify your logic. They had my written test answer sheet.. 29... strengths and weakness. Question from my B..written test ----------it consists of 2 parts 1.24. Question from everything written on my resume. One question was writing algorithm and last one was suggesting some technique or somthing useful for a swithcing system type railway track (in which rails r travelling and task is to develop efficint track system).. little abt Java) ... Your job is to write a program to replace each special characters in given string by pattern string.and also no. and there are '3n' lines horizontal to AB.. interests.. In every book there is one index at end which contains some words which are not there in normal vocabulary dictionary. You are given other string (call it as pattern string). BC and CD. One question was writing output of a program. During group interview. She asked me to develop that program during interview. 33. They opened it and asked me to explain why I gave that output or why I implement that logic... In written test. How did I arrive to that solution which I had written in answer sheet.. You can use any data structure you want. My experience in Teaching assistantship.Bj) to (Bp.n line parallel to each side and all cutting other two side.. On the basis of the performance few ppl got selected directly for final interview and some other was given second chance to prove in 2nd group test. Something about yourself. You need to allocate some new memory to given existing string but constraint is you can only allocate memory one time... Technical (basically includes C. During interview they ask me to optimize my program. 1...s agrawal each section will have its own cut-off 2. final semester project. I hope this will help you in your preparation for Microsoft. NO CGPA criteria matters in whole process (thats d best thing... in second problem I was only able to discuss logic I was unable to develop program in given time limit. Question from my every project I did. C++.. 27.. He gives you a file that contains that book. 32. It also contains page number for reference... One question was puzzle type question (in which there was a triangle ABC.) So guys go get for it. 25.D as usual they will give u a topic . for second question I had implement a program which was not much efficient. of possible path). 35. 30.. You are given a string which contains some special characters. One written test and one Technical Interview. your hobbies.G.. I was unable to clear 4th round that is second technical interview.E. Asked me to explain whole project.. The lvl of difficulty was on an average 8 out of ten (mean real tough paper). You also have set of special characters.if u r good in oops u can 2.task was to find out formula for two intersection point (Ai. They also gave hint to optimize it.

"My name is Chris" becomes "Chris is name My. 13) Compare two strings using O(n) time with constant space. dx . i. 23) Given that you are receiving samples from an instrument at a constant rate. 19) Write routines to manage a heap using an existing array. Now optimize for size. Describe an algorithm to find the repeated number. Assume that you can access each element of the array only once. 4) Describe advantages and disadvantages of the various stock sorting algorithms. 16) Multiple by 8 without using multiplication or addition. 12) Find a substring. 16. favors -2 when asking this question). Now do the same with 7. 10) Reverse a string.the grp may be around 8 or 6 depending on the croud say best points when ur turn comes (say some thing which is new there at that time) then u can def go thr it Algorithms : Microsoft Examination Papers 1) What's the difference between a linked list and an array? 2) Implement a linked list. 21) Implement an algorithm that takes two strings as input. can you find an algorithm that does not require it? 15) Count the number of set bits in a number. Now do it without recursion.I hear that Charles Simonyi. 7) Implement an algorithm to sort an array. with each letter represented at most once. 8 or 2 . no matter when I looked at it? In other words. 6) Implement an algorithm to insert a node into a circular linked list without traversing it. how would you design a storage algorithm that would allow me to get a representative readout of data. 14) Suppose you have an array of 1001 integers." Optimize for speed. 26) The following asm block performs a common math function. 20) Implement an algorithm to take an array and return one with only unique elements in it. the inventor of Hungarian Notation. Optimize for space. what is it? cwd xor ax. Optimize for speed. 22) Implement an algorithm to print out all files below a given root node. 9) Implement strstr() (or some other string library function). each number appears only once in the array. Now optimize for speed. Why did you pick the method you did? 3) Implement an algorithm to sort a linked list. If you used auxiliary storage in your algorithm. Now test it. Optimize for space. 11) Reverse the words in a sentence. In ddition. Why did you pick the method you did? Now do it in O(n) time. 17) Add numbers in base n (not any of the popular ones like 10. except for one number. representative of the behavior of the system to date. which occurs twice. and returns the intersection of the two. given that the cards are stored in an array of ints. but you know each of the integers is between 1 and 1000 (inclusive). and you have constant storage space. Optimize for speed. The integers are in random order. Optimize for space. 5) Implement an algorithm to reverse a linked list. Now speed it up. 18) Write routines to read and write a bounded buffer. 24) How would you find a cycle in a linked list? 25) Give me an algorithm to shuffle a deck of cards. Why did you pick the method you did? 8) Implement an algorithm to do wild card string matching.e.

sockets. I cast C to A and call foo(). The last few bytes of string A overlap the first few bytes of string B. or any other I/O. level by level. Remember to take into account multi-processor machines. Upon error or completion. and if it is then return the integer value. 30) Write a function to print all of the permutations of a string. 32) Write a function to print the Fibonacci numbers. and can process an unlimited number of simultaneous requests. Operand. "private".sub ax. "protected". they cache the data (if necessary). Statement in 'C'? What is polymorphism? . When a Read or Write is submitted to them. and attempt to take the request to completion. starting at the top? Java Questions & Answers What is the difference between an Applet and an Application? What are java beans? What is RMI? What gives java it's "write once and run anywhere" nature? What are native methods? How do you use them? (How does Java inheritance wor?k How many different types of JDBC drivers are present? What does the "static" keyword mean in front of a variable? A method? A class? Curly braces {}? Class A subclass B subclass C. What happens? Can C call A->foo()? Access specifiers: "public". nothing? What does the "final" keyword mean in front of a variable? A method? A class? Does Java have "goto"? Why "bytecode"? Can you reverse-engineer the code from bytecode? How does exception handling work in Java? Does Java have destructors? C++ Questions : Microsoft Examination Papers What is Operator. All override foo(). 31) Implement malloc. they call a user-supplied function to let the users application know that that particular request has completed. A and B. 34) How would you write qsort? 35) How would you print out the data in a binary tree. 33) Write a function to copy two strings. dx 27) Imagine this scenario: I/O completion ports are communictaions ports which take handles to files. 29) Write a function that takes in a string parameter and checks to see whether or not it is an integer. 28) Design the implementation and thread models for I/O completion ports. Expression. They work asynchronously.

and a destructor that frees the 100 bytes. int y = 7. What does the following C statement do? while(*c++ = *d++). What is wrong with this? main(){ int *ptr. will the level of water increase? . x=3. b) n = (j . C have default constructor. a++. All have foo(). C h e ta n a S Compare and contrast C++ and Java.i) && (x < y++). Why does C/C++ give better run-time performance then Java? Does C++ come with in-built threading support. how would you measure exactly 4 quarts? 2) If you could remove any of the 50 states. i=10. and then destroy it. and the other grows from the last position. What's the problem? Did all the memory get freed? What if I create C. ////////////////////////////////////////////////////////////////////////////////////////////////////////// Analytical : Microsoft Examination Papers 1) If you had an infinite supply of water and a 5 quart and 3 quart pail. foo() that calls parent foo() and allocates 100 bytes to their own private local variable. Declare a function pointer which takes a pointer to char as an argument and returns a void pointer. How do you call a C module within a C++ module. Type-define a function pointer which takes a int and float as parameter and returns a float *. assuming c and d are pointers to characters. if one grows from position one of the array. What is the difference between run time binding and compile time binding? Discuss. cast to A. *ptr=10. Class A derives B derives C. y = 100. What is the value of x and y after the expression y+=x++. B. int x = 5.What is operator overloading? What are templates? Declare a void pointer. I create a C object and then destroy it. which state would it be and why? 3) If you are on a boat and you throw out a suitcase. What's the difference between C and C++? (What does Public and Private mean in C++ Is it possible to keep 2 stacks in a single array. What is the value of n and y at the end of each of the following expressions? a) n = (i > j) && (x < ++y). Write a procedure PUSH(x. s) that pushes element x onto stack S. } Given int n. What happens? All classes A. Include all necessary error checks. How would I make sure memory is freed? (destructor must be virtual" and each destructor must call parent destructor) What errors are caught at compile time vs link time? What is the value of "a" after this? int (*a) [10]. where S is one or the other of these two stacks. I cast C to A and call foo(). j=20. c) n = (i < j) || (y+=i).

no light floods the room. enter your house/apartment. which can be embedded in a document and duplicated readily via the Internet? 3) Define a user interface for indenting selected text in a Word document. the hot water comes pouring out almost instantaneously? 11) Why do you want to work at Microsoft? 12) Suppose you go home. Consider selections not currently visible or only partially visible. What kind of software would you write to do this? 7) What is the difference between an Ethernet Address and an IP address? 8) How would you design a coffee-machine for an automobile? . how would you go about reassembling the clock? 3) If you had to learn a new computer language. 4) Consider selections ranging from a single sentence up through selections of several pages. you took it apart piece by piece without keeping track of the method of how it was disassembled.4) There are 3 ants at 3 corners of a triangle. What is the probability that they don't collide? 5) Three men were renting a motel figuring the room cost 30 dollars they would pitch in ten a piece. hit the light switch. What was the hardest question asked of you so far today? 5) If MS told you we were willing to invest $5 million in a start up of your choice. what would it be? 7) Explain a scenario for testing a saltshaker. in order. they randomly start moving towards another corner. What exactly. What happened to the other dollar? ////////////////////////////////////////////////////////////////////////////////////////////////////////// Thinkers : Microsoft Examination Papers 1) How are M&Ms made? 2) If you had a clock with lots of moving mechanical parts. then you put it back together and discovered that 3 important parts were not included. what is it for and who is the audience? 9) How would you explain how to use Microsoft Excel to your grandma? 10) Why is it that when you turn on the hot water in any hotel. The room was only 25 so they each gave the bell boy ten. how would you go about doing it? 4) You have been assigned to design Bill Gates bathroom.(tip)the bellboy didn't think that would be fair so he gave them each back 1 dollar and kept 2 for himself. are the steps you would take in determining what the problem was? 13) Interviewer hands you a black pen and says nothing but "This pen is red. what business would you start? Why? 6) If you could gather all of the computer manufacturers in the world together into one room and then tell them one thing that they would be compelled to do. and nothing happens . cost is not a consideration. 8) If you are going to receive an award in 5 years. What are the states of the new UI controls? How will the user know what the controls are for and when to use them? 5) How would you redesign an ATM? 6) Suppose we wanted to run a microwave oven from the computer. You may not speak to Bill. Naturally. for example." ////////////////////////////////////////////////////////////////////////////////////////////////////////// Applications : Microsoft Examination Papers 1) How can computer technology be integrated in an elevator system for a hundred story office building? How do you optimize for availability? How would variation of traffic over a typical workweek or floor or time of day affect this? 2) How would you implement copy protection on a control.

a scale). If I want any amount of money from 0 to n dollars. How can you tell which of the ten employees is cheating you by using this scale and only taking one measurement? 4) How many points are there on the globe where by walking one mile south. "The two questions were" What are the restrictions on b and n. What is the minimum number of weighs you could perform to find the heaviest of the eight balls? Remember it's a scale not a balance. you must be able to hand me 0 to b boxes so that I get exactly what I request. (i. Some are red. But when you tilt your head up. 5) How would go about finding out where to look for a book in a library? (You do not know how the books are organized beforehand) 6) Imagine you are standing in front of a mirror.9) If you could add any feature to Microsoft Word. Raise your left hand. How many do you have to grab to be sure you have 2 of the same? 8) You are given a scale which you are to use to measure eight balls. and does not appear to tilt his/her head down. One of your employees is cheating you by only putting nine pieces of gold in each of his ten bags of gold. pick out 2 of a like color. and you can only take one measurement from the scale. John asked the rest of the party-attainders how many times he has shaken hands. each one of your ten employees gives you ten bags of gold. You have ten employees. It can just tell you if one side is heavier than the other it can't give you the exact weight). Each month. Look at your reflection. but not up and down? 7) You have a bucket of jelly beans. and how is money distributed among the boxes? 2) What is the sum of the numbers from 1 to 1000? 3) You are an employer. Each one shakes hands with the persons he doesn't know. With your eyes closed. only one (1) reading. Each bag of gold has ten pieces of gold in it. How many times does Mary shake hands? ////////////////////////////////////////////////////////////////////////////////////////////////////////// Databases : Microsoft Examination Papers 1) What are two methods of retrieving SQL? 2) What cursor type do you use to retrieve multiple record sets? 3) What action do you have to perform before retrieving data from the next result set of a stored procedure? 4) What is the basic form of a SQL statement to read data out of a table? 5) What structure can you have the database make to speed up table reads? 6) What is a "join"? 7) What is a "constraint"? . Raise your right hand. Seven of these balls have the same weight: the eighth ball is heavier than the rest. one mile east and one mile north you reach the place where you started. facing it. When you raise your left hand your reflection raises what appears to be his right hand. Each one gives a unique answer.e. your reflection does too. what would it be? 10) How would you go about building a keyboard for 1-handed users? 11) How would you build an alarm clock for deaf people? ////////////////////////////////////////////////////////////////////////////////////////////////////////// Algorithms & Coding : Microsoft Examination Papers 1) You have b boxes and n dollars. some are blue. and some green. You have a scale (not a balance. (Assuming each person knows his/her partner) Mary and John are a couple. Why is it that the mirror appears to reverse left and right. 9) How would you design a toaster? 10) How would you design an universal remote control? 11) How would you design a clock for a blind person? 12) How many miles of road are there in the US 13) There are n couples attending a party. Each piece of gold weighs one pound.

8) What is a "primary key"? 9) What is a "functional dependency"? How does it relate to database table design? 10) What is a "trigger"? 11) What is "index covering" of a query? 12) What is a SQL view? .

- 2010 Microsoft Placement Paper
- About 2011 Microsoft Placement Paper
- Photo
- 27253270 Computer Project for ISC
- GE2155_-lab_manual_2011-2012_(modi)
- Google Interview Questions
- July First
- C++ STL 1
- ms_que
- PrinciplesofDataStructuresUsingCandC_WeLearnFree
- Cheat Sheet for Ruby · Watir_watir Wiki
- C_lecture_7
- algorithms made easy
- Suffix Array Tutorial
- c- strings 11
- A _ Topic _ Divide and Conquer _ GeeksforGeeks
- Introduction 1
- arrays
- TopicWise 2.3 Question
- Hash Tables
- QP Kakinada Set 1 (Jan 2012)
- Software Developer Interview Questions
- BCA0
- BCA-302.pdf
- question1x
- Lecture_4.ppt
- kmg09
- Data Structures Succinctly Part 2
- 03
- STL-Trees
- 2011 Microsoft Placement Paper

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd