Você está na página 1de 25

Written Test : Written test will be mostly of coding, puzzles and questions from Data Structures.

Interview will be fully from coding and algorithms. Lots of rounds of interview will be there. As you clear a round, difficulty level of the questions will increase. Profile Offered : Software Engineer Pay Scale : CTC- 10.49 LPA Eligibility Criteria : >7.0 Have a thorough knowledge about algorithms and data structures. Be good in coding.
Microsoft Placement Paper Februry 2011:1.In a class composed of x girls and y boys what part of the class is composed of

girls A. y/(x + y) B. x/xy C. x/(x + y) D. y/xy Ans. C


2.What is the maximum number of half-pint bottles of cream that can be filled with

a 4-gallon can of cream(2 pt.=1 qt. and 4 qt.=1 gal) A.16 B.24 C.30
Ans.D

D.64

3.If the operation,^ is defined by the equation x ^ y = 2x + y,what is the value of a

in 2 ^ a = a ^ 3 A.0
Ans.B

B.1

C.-1

D.4

4.A coffee shop blends 2 kinds of coffee, putting in 2 parts of a 33p. a gm. grade to

1 part of a 24p. a gm.If the mixture is changed to 1 part of the 33p. a gm. to 2 parts of the less expensive grade,how much will the shop save in blending 100 gms. A.Rs.90
Ans. C

B.Rs.1.00`C.Rs.3.00

D.Rs.8.00

5.There are 200 questions on a 3 hr examination.Among these questions are 50

mathematics problems.It is suggested that twice as much time be spent on each maths problem as for each other question.How many minutes should be spent on mathematics problems A.36
Ans. B

B.72

C.60

D.100

6.In a group of 15,7 have studied Latin, 8 have studied Greek, and 3 have not

studied either.How many of these studied both Latin and Greek A.0 B.3 C.4 D.5

Ans. B

7.If 13 = 13w/(1-w) ,then (2w)2 =

A.1/4
Ans. C

B.1/2

C.1

D.2

8. If a and b are positive integers and (a-b)/3.5 = 4/7, then

(A) b < a
Ans. A

(B) b > a

(C) b = a

(D) b >= a

9. In June a baseball team that played 60 games had won 30% of its game played.

After a phenomenal winning streak this team raised its average to 50% .How many games must the team have won in a row to attain this average? A. 12
Ans. C

B. 20

C. 24

D. 30

10. M men agree to purchase a gift for Rs. D. If three men drop out how much more

will each have to contribute towards the purchase of the gift/ A. D/(M-3)
Ans. D 11.which of de following is connectionless protocol Ans: UDP

B. MD/3

C. M/(D-3)

D. 3D/(M2-3M)

12. #define clrscr() 100

ain() { clrscr(); printf("%d",clrscr()); }


13. which of the followin is used for avoidin network congestion

bufferin cachin sourcequench all of de above


14.main()

{ int a; printf("%d",scanf(%d,&a)); } what's o/p of this program. what will b printed Ans :0
15. main()

{ printf("as"); printf("\bhi"); printf("is\n"); } what will b printed.


16.main()

{ unsigned short a=-1; unsigned char b=a; printf("%d %d ",a,b); } what is o/p of the program a. 65535 -1 b. 65535 65535 c. -1 -1
17.arrays base address is 1000....array is a[5][4]..then what is The correct address

of a[4][3]...
Ans:1056

18.one packet is 64bytes..no of pkts send is 16000..then total no of bytes send is Ans: 1024000 19.#define maxval 5

int main (void) { int i=1; if(i-maxval) { printf("inside"); } else { printf("out"); } find o/p???
20. #define a 3+3

#define b 11-3 main() { printf("%d",a*b); } what is o/p?????


21. In a X's and 0's game (i.e. TIC TAC TOE) if you write a program for this give a

fast way to generate the moves by the computer. I mean this should be the fastest way possible. ANS:- The answer is that you need to store all possible configurations of the board and the move that is associated with that. Then it boils down to just accessing the right element and getting the corresponding move for it. Do some analysis and do some more optimization in storage since otherwise it becomes infeasible to get the required storage in a DOS machine.
22. I was given two lines of assembly code which found the absolute value of a

number stored in two's complement form. I had to recognize what the code was doing. Pretty simple if you know some assembly and some fundas on number representation.
23. Give a fast way to multiply a number by 7. 24. How would go about finding out where to find a book in a library. (You don't

know how exactly the books are organized beforehand).


25. Linked list manipulation.

Microsoft Placement paper 2011 Nov 2011


Microsoft (1st November) right ans +3 wrong answer -1

Section I 1) count = 0; deftrib(n, back); count += 1; sum = 0; if(n <=0) return 1; if(n == 1) return 1; for i in the range 1, 2, 3,...back sum += trib(n-i, back + 1) printcount 1) 13 2) 7 3) 19 4) 17 2) design a flag of 5 strips using the colours red, blue, white, green. In how many ways scan you do it?(two strips of same colous should not be placed side by side a)124 b)125 c) d) 3) sum of all 3digit numbers that can be formed by 3, 5, 8(without repitition) a)3553 b)3332 c)5335 d) 4)(x & (x - 1)) == 0 checks a)x is a true power of 2. 5)#!python st = "abrakadabra" mydict = dict(); t 1, ... strlen(st) - 3 mydict[string[t:t+3]] = 1 printlen(mydict) 6) Your friend has designed a program to merge two arrays of same size. You want to test and validate it. which of the following are true?

I) it can be done in O(N) in best case II) it can be done in O(N*logN) III) IV) You generate a random array of size 2N and then again randomly pick up elements two form two arrays of equal size and give them as input two the program some options were given Section 2 1) Two strings s1 and s2 in [a-zA-Z]. do s1 - s2; i.e. - if s1 abcdB and s2 b then s1 - s2 = acdB and this should be stored in s1. 2) There are 20 students in a class who are asked to write programs for reversing singly linked list. You are asked to design test cases to check the programs so that you don't have to read the code. 3) Windows system, every window has z position which is unique. z position determines where the window is, i.e a window with z position 2 is above a window with z position 1. if we click a window it gets (1 + max_z position). a) Hit testing. Given a point (x, y) in which window it is included, if there are multiple windows that satisfy the criteria then return the on ewith the max z value. This operation is frequent so performance should be good b) Remove a window. Infrequent c) Add a window. d) Raise a window. Frequent, so performance should be good e) Resize window. Infrequent. What data structure will u use. find out the complexities. give algo for (a) and (b)

About 2011 Microsoft Placement Paper - I


Here are the details of 2011 Microsoft Placement Paper - I job in Microsoft India

Add to ShortList

Welcome to Microsoft Placement Paper 2011. Here you will find Microsoft Placement Paper Pattern and Download questions of Microsoft Placement Paper 2011 with Answers & Solutions. 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. 14. Given an array t[100] which contains numbers between 1..99. Return the duplicated value. Try both O(n) and O(n-square). 15. Given an array of characters. How would you reverse it. ? How would you reverse it without using indexing in the array. 16. An array of integers of size n. Generate a random permutation of the array, given a function rand_n() that returns an integer between 1 and n, both inclusive, with equal probability. What is the expected time of your algorithm? ANS. "Expected time" should ring a bell. To compute a random permutation, use the standard algorithm of scanning array from n downto 1, swapping i-th element with a uniformly random element <= i-th. To compute a uniformly random integer between 1 and k (k < n), call rand_n() repeatedly until it returns a value in the desired range. 17. An array of pointers to (very long) strings. Find pointers to the (lexicographically) smallest and largest strings. ANS. Scan array in pairs. Remember largest-so-far and smallest-so-far. Compare the larger of the two strings in the current pair with largest-so-far to update it. And the smaller of the current pair with the smallest-so-far to update it. For a total of <= 3n/2 strcmp() calls. That's also the lower bound. 18. Write an efficient C code for 'tr' program. 'tr' has two command line arguments. They both are strings of same length. tr reads an input file, replaces each character in the first string with the corresponding character in the second string. eg. 'tr abc xyz' replaces all 'a's by 'x's, 'b's by 'y's and so on. ANS. a) have an array of length 26. 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. the code while (!eof) { c = getc(); putc(array[c - 'a']); } 19. what is disk interleaving 20. why is disk interleaving adopted

About 2011 Microsoft Placement Paper - II


Here are the details of 2011 Microsoft Placement Paper - II job in Microsoft India

Add to ShortList

Welcome to Microsoft Placement Paper 2009. Here you will find Microsoft Placement Paper Pattern and Download questions of Microsoft Placement Paper 2009 with Answers & Solutions. 2009 Microsoft Placement Paper:-

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

h|=(h>>16)) 17. 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). 18. 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) 19. Reverse the bits of an unsigned integer. ANS. #define reverse(x) \ (x=x>>16|(0x0000ffff&x)<<16, \ x=(0xff00ff00&x)>>8|(0x00ff00ff&x)<<8, \ x=(0xf0f0f0f0&x)>>4|(0x0f0f0f0f&x)<<4, \ x=(0xcccccccc&x)>>2|(0x33333333&x)<<2, \ x=(0xaaaaaaaa&x)>>1|(0x55555555&x)<<1) 20. 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))

13 Sept 2011 at JNTU Hyderabad

Hi, I have attended the microsoft exam..They gave 10 questions..for 50 marks questions (1-4): 2 marks each, (5):4 marks,(6-7):5 marks,(8):8 marks,(9-10):10 marks the exam paper is 1.int i=~0; uint j=(uint)i; j++;

printf("%d",j); The o/p is (a)2^31 (b)0 (c)1 (d)2^32 2.num&(num-1)==0,indicates I.num is a power of 2 II.num and (num-1) no 1's in common III.n=1 (a)only I (b)I and II (c)I,II and III (d)none 3.which of the following tests is not a functional testing (a)black box testing (b)Usability testing (c)volume testing (d)data validation testing 4."silly window syndrome" occurs in which of the following layer (a)Internet layer (b)Application layer (c)Network layer (d)Transport layer 5.Mr.X has a hotel with 50 floors.You are assigned as design engineer for elevator system.All the guests should not go by the stairs also they should not wait for the elevator.Suggest a design solution which is cost effective and fulfills his requirements. 6.Write a method to fill all the spaces in a string with '%20' 7.Write a function to print all the combinations of a string both uppercase and lowercase without altering the position of each letter. (example "THE",the o/p should be THE,tHE,ThE,THe,thE,etc.) 8.The DELHI airport during winter season is congested with the flights due to foggy environment.The flights that are going to arrive has to wait(keep flying) for the clearance .During this the fuel may be completed.You suggest a solution for the flights and also propose a long term solution for the problem. 9.Two 32-bit integers n and m are given and positions i,j,k,l are given.Write a method to copy the contents of m from position k to l into n from position i to j. (example n=1010000000,m=10101010,i=3,j=5,k=5,l=7..output=10'101'00000) 10.Give all possible test cases to test the basic features of a mobile. OCTOBER 30 GITAM University Vishakhapatnam

Microsoft paper 2011 Written pattern for the s/w developers and testing: Duration: 1hr30 mins

Each section 45 mins. After 45mins omr sheet will be taken for the section-A. Rough work space given so you can write over there but don't use back pages as it is meant for section-B . Mertitrac conducted this test, they are the assement trainees for microsoft written test. 2 sections Section-A: MCQ's : 15 questions, +3marks correct answer, -1 mark for wrong answer Mostly basics relating to datastructures and os. 1. lru concept one question 2. one aptitude question How many 4 digit numbers even have no repeted digits? 3. Tree concept question based on, traversal inorder and preorder given have to find out root node . 4. Prime number finding function with 4 assumptions given with values underlined. Have to choose best possible replacement to make it efficient function. 5. Swap function based question 6. Program given and have to find the expected output 7. A program related to binary trees based sorting given, have to find out its time complexity. Section -B: This section has 4 questions and each one has 10 marks. and its purely coding section. 1. Write the code for the series eg: If a3b2c4 ..is taken then output should be aaabbcccc 2. Wite a program to find out the sum of the values of the left subtree when the corresponding root node is entered. 3. Write a test case for the chat messenger application 4. Write a program if given a series of alphabets followed by a numbers then output should be in the alternate order of alphbet followed by number. Eg: abcd1234defgh8965 then output should be a1b2c3d4 d8e9f6g5 .

Microsoft Interview Questions Question Papers Upload Question Papers

1. Explain what is DMA? 2. What is pipelining? 3. What are superscalar machines and vliw machines? 4. What is cache? 5. What is cache coherency and how is it eliminated? 6. What is write back and write through caches? 7. What are different pipelining hazards and how are they eliminated. 8. What are different stages of a pipe?

Microsoft Placement Papers and Sample Papers


Next Page Following papers are for year 2004,2005,2006,2007. Click Here for placement papers 2008,2009,2010.
Algorithms & Coding : Microsoft Examination Papers

(Avg. of 25 ) : You have b boxes and n dollars. If I want any amount of money from 0 to n dollars, you must be able to hand me 0 to b boxes so that I get exactly what I request. The two questions were What are the restrictions on b and n, and how is money distributed among the boxes? (Avg. of 49 ) : What is the sum of the numbers from 1 to 1000? (Avg. of 39 ) : You are an employer. You have ten employees. Each month, each one of your ten employees gives you ten bags of gold. Each bag of gold has ten pieces of gold in it. Each piece of gold weighs one pound. One of your employees is cheating you by only putting nine pieces of gold in each of his ten bags of gold. You have a scale (not a balance, a scale), and you can only take one measurement from the scale, only one (1) reading. How can you tell which of the ten employees is cheating you by using this scale and only taking one measurement? (Avg. of 38 ) : How many points are there on the globe where by walking one mile south, one mile east and one mile north you reach the place where you started. (Avg. of 23 ) : 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) (Avg. of 25 ) : Imagine you are standing in front of a mirror, facing it. Raise your left hand. Raise your right hand. Look at your reflection. When you raise your left hand your reflection raises what appears to be his right hand. But when you tilt your head up, your reflection does too, and does not appear to tilt his/her head down. Why is it that the mirror appears to reverse left and right, but not up and down? (Avg. of 21 ) : You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same?

(Avg. of 18 ) : You are given a scale which you are to use to measure eight balls. Seven of these balls have the same weight: the eigth ball is heavier than the rest. What is the minimum number of weighs you could perform to find the heaviest of the eight balls?. Remmber its a scale not a balance. (i.e. It can just tell you if one side is heavier than the other it cant give you the exact weight). (Avg. of 13 ) : How would you design a toaster? (Avg. of 10 ) : How would you design an universal remote control? (Avg. of 22 ) : How would you design a clock for a blind person? (Avg. of 30 ) : How many miles of road are there in the US (Avg. of 64 ) : There are n couples attending a party. Each one shakes hands with the persons he doesnt know. (Assuming each person knows his/her partner) Mary and John are a couple. John asked the rest of the party-attenders how many times he has shaken hands. Each one gives a unique answer. How many times does Mary shake hands?

Databases : Microsoft Examination Papers

What are two methods of retrieving SQL? (Avg. of 588 ) : What cursor type do you use to retrieve multiple recordsets? (Avg. of 35 ) : What action do you have to perform before retrieving data from the next result set of a stored procedure? (Avg. of 36 ) : What is the basic form of a SQL statement to read data out of a table? (Avg. of 29 ) : What structure can you have the database make to speed up table reads? (Avg. of 16 ) : What is a join"? (Avg. of 17 ) : What is a constraint"? (Avg. of 11 ) : What is a primary key"? (Avg. of 11 ) : What is a functional dependency"? How does it relate to database table design? (Avg. of 15 ) : What is a trigger"? (Avg. of 7 ) : What is index covering of a query? (Avg. of 42 ) : What is a SQL view? Previous Page Next Page

icrosoft Placement Papers and Sample Papers


Following papers are for year 2004,2005,2006,2007. Click Here for placement papers 2008,2009,2010.

Java Questions & Answers

(Avg. of 487 ) : What is the difference between an Applet and an Application?

Rate it: | View Answers (Avg. of 133 ) : What are java beans? Rate it: | View Answers (Avg. of 57 ) : What is RMI? Rate it: | View Answers (Avg. of 28 ) : What gives java its write once and run anywhere nature? Rate it: | View Answers (Avg. of 33 ) : What are native methods? How do you use them? Rate it: | View Answers (Avg. of 26 ) : How does Java inheritance wor?k Rate it: | View Answers (Avg. of 58 ) : How many different types of JDBC drivers are present? Discuss them. Rate it: | View Answers (Avg. of 36 ) : What does the static keyword mean in front of a variable? A method? A class? Curly braces {}? Rate it: | View Answers (Avg. of 34 ) : Class A subclass B subclass C. All override foo(). I cast C to A and call foo(). What happens? Can C call A->foo()? Rate it: | View Answers (Avg. of 19 ) : Access specifiers: public", protected", private", nothing? Rate it: | View Answers (Avg. of 18 ) : What does the final keyword mean in front of a variable? A method? A class? Rate it: | View Answers (Avg. of 28 ) : Does Java have goto"? Rate it: | View Answers (Avg. of 34 ) : Why bytecode"? Can you reverse-engineer the code from bytecode? Rate it: | View Answers (Avg. of 31 ) : How does exception handling work in Java? Rate it: | View Answers (Avg. of 64 ) : Does Java have destructors?

C++ Questions : Microsoft Examination Papers

(Avg. of 1423 ) : What is Operator, Operand, Expression, Statement in C? Rate it: | View Answers (Avg. of 364 ) : What is polymorphism? Rate it: | View Answers (Avg. of 84 ) : What is operator overloading? Rate it: | View Answers (Avg. of 55 ) : What are templates? Rate it: | View Answers

(Avg. of 72 ) : Declare a void pointer. Rate it: | View Answers (Avg. of 50 ) : Declare a function pointer which takes a pointer to char as an argument and returns a void pointer. Rate it: | View Answers (Avg. of 31 ) : Type-define a function pointer which takes a int and float as parameter and returns a float *. Rate it: | View Answers (Avg. of 94 ) : What does the following C statement do? while(*c++ = *d++); assuming c and d are pointers to characters. Rate it: | View Answers (Avg. of 52 ) : How do you call a C module within a C++ module. Rate it: | View Answers (Avg. of 54 ) : What is the difference between run time binding and compile time binding? Discuss. Rate it: | View Answers (Avg. of 20 ) : Compare and contrast C++ and Java. Rate it: | View Answers (Avg. of 23 ) : Why does C/C++ give better run-time performance then Java? Rate it: | View Answers (Avg. of 14 ) : Does C++ come with in-built threading support. Rate it: | View Answers (Avg. of 19 ) : Class A derives B derives C. All have foo(). I cast C to A and call foo(). What happens? Rate it: | View Answers (Avg. of 27 ) : All classes A, B, C have default constructor, foo() that calls parent foo() and allocates 100 bytes to their own private local variable, and a destructor that frees the 100 bytes. I create a C object and then destroy it. Whats the problem? Did all the memory get freed? What if I create C, cast to A, and then destroy it. How would I make sure memory is freed? (destructor must be virtual and each destructor must call parent destructor) Rate it: | View Answers (Avg. of 26 ) : What errors are caught at compile time vs link time? Rate it: | View Answers (Avg. of 30 ) : What is the value of a after this? int (*a) [10]; a++; Rate it: | View Answers (Avg. of 45 ) : What is wrong with this? main(){ int *ptr; *ptr=10; } Rate it: | View Answers (Avg. of 39 ) : Given int n, i=10, j=20, x=3, y = 100; What is the value of n and y at the end of each of the following expressions? a) n = (i > j) && (x < ++y);

b) n = (j - i) && (x < y++); c) n = (i < j) || (y+=i); Rate it: | View Answers (Avg. of 34 ) : int x = 5; int y = 7; What is the value of x and y after the expression y+=x++; Rate it: | View Answers (Avg. of 58 ) : Whats the difference between C and C++? Rate it: | View Answers (Avg. of 21 ) : What does Public and Private mean in C++ Rate it: | View Answers (Avg. of 59 ) : Is it possible to keep 2 stacks in a single array, if one grows from position one of the array, and the other grows from the last position. Write a procedure PUSH(x,s) that pushes element x onto stack S, where S is one or the other of these two stacks. Include all necessary error checks.

Analytical : Microsoft Examination Papers

(Avg. of 343 ) : If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts? Rate it: | View Answers (Avg. of 122 ) : If you could remove any of the 50 states, which state would it be and why? Rate it: | View Answers (Avg. of 78 ) : If you are on a boat and you throw out a suitcase, will the level of water increase? Rate it: | View Answers (Avg. of 87 ) : There are 3 ants at 3 corners of a triangle, they randomly start moving towards another corner. What is the probability that they dont collide? Rate it: | View Answers (Avg. of 50 ) : Three men were renting a motel figuring the room cost 30 dollars they would pitch in ten a piece.The room was only 25 so they each gave the bell boy ten,(tip)the bellboy didn"t think that would be fair so he gave them each back 1 dollar and kept 2 for himself.What happened to the other dollar?

Thinkers : Microsoft Examination Papers

How are M&Ms made? If you had a clock with lots of moving mechanical parts, you took it apart piece by piece without keeping track of the method of how it was disassembled, then you put it back together and discovered that 3 important parts were not included; how would you go about reassembling the clock? If you had to learn a new computer language, how would you go about doing it?

You have been assigned to design Bill Gates bathroom. Naturally, cost is not a consideration. You may not speak to Bill. What was the hardest question asked of you so far today? If MS told you we were willing to invest $5 million in a start up of your choice, what business would you start? Why? 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, what would it be? Explain a scenario for testing a salt shaker. If you are going to receive an award in 5 years, what is it for and who is the audience? How would you explain how to use Microsoft Excel to your grandma? Why is it that when you turn on the hot water in any hotel, for example, the hot water comes pouring out almost instantaneously? Why do you want to work at Microsoft? Suppose you go home, enter your house/apartment, hit the light switch, and nothing happens - no light floods the room. What exactly, in order, are the steps you would take in determining what the problem was? Interviewer hands you a black pen and says nothing but This pen is red.
Applications : Microsoft Examination Papers

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 work week or floor or time of day affect this?

How would you implement copy-protection on a control which can be embedded in a document and duplicated readily via the Internet? Define a user interface for indenting selected text in a Word document. Consider selections ranging from a single sentence up through selections of several pages. Consider selections not currently visible or only partially visible. What are the states of the new UI controls? How will the user know what the controls are for and when to use them? How would you redesign an ATM?

Suppose we wanted to run a microwave oven from the computer. What kind of software would you write to do this? What is the difference between an Ethernet Address and an IP address? How would you design a coffee-machine for an automobile. If you could add any feature to Microsoft Word, what would it be? How would you go about building a keyboard for 1-handed users? How would you build an alarm clock for deaf people?

Algorithms : Microsoft Examination Papers

Whats the difference between a linked list and an array? Implement a linked list. Why did you pick the method you did? Implement an algorithm to sort a linked list. Why did you pick the method you did? Now do it in O(n) time. Describe advantages and disadvantages of the various stock sorting algorithms. Implement an algorithm to reverse a linked list. Now do it without recursion. Implement an algorithm to insert a node into a circular linked list without traversing it. Implement an algorithm to sort an array. Why did you pick the method you did? Implement an algorithm to do wild card string matching. Implement strstr() (or some other string library function). Reverse a string. Optimize for speed. Optimize for space. Reverse the words in a sentence, i.e. My name is Chris becomes Chris is name My. Optimize for speed. Optimize for space. Find a substring. Optimize for speed. Optimize for space. Compare two strings using O(n) time with constant space. Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of the array only once. Describe an algorithm to find the repeated

number. If you used auxiliary storage in your algorithm, can you find an algorithm that does not require it? Count the number of set bits in a number. Now optimize for speed. Now optimize for size. Multiple by 8 without using multiplication or addition. Now do the same with 7. Add numbers in base n (not any of the popular ones like 10, 16, 8 or 2 I hear that Charles Simonyi, the inventor of Hungarian Notation, favors -2 when asking this question). Write routines to read and write a bounded buffer. Write routines to manage a heap using an existing array. Implement an algorithm to take an array and return one with only unique elements in it. Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. Now speed it up. Now test it. Implement an algorithm to print out all files below a given root node. Given that you are receiving samples from an instrument at a constant rate, and you have constant storage space, how would you design a storage algorithm that would allow me to get a representative readout of data, no matter when I looked at it? In other words, representative of the behavior of the system to date. How would you find a cycle in a linked list? Give me an algorithm to shuffle a deck of cards, given that the cards are stored in an array of ints. The following asm block performs a common math function, what is it? cwd xor ax, dx sub ax, dx Imagine this scenario: I/O completion ports are communictaions ports which take handles to files, sockets, or any other I/O. When a Read or Write is submitted to them, they cache the data (if necessary), and attempt to take the request to completion. Upon error or completion, they call a user-supplied function to let the users application know that that particular request has completed. They work asynchronously, and can process an unlimited number of simultaneous requests. Design the implementation and thread models for I/O completion ports.

Remember to take into account multi-processor machines. Write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value. Write a function to print all of the permutations of a string. Implement malloc. Write a function to print the Fibonacci numbers. Write a function to copy two strings, A and B. The last few bytes of string A overlap the first few bytes of string B. How would you write qsort? How would you print out the data in a binary tree, level by level, starting at the top?
Microsoft Interview Questions

The following are actual questions from actual interviews conducted by Microsoft employees on the main campus. Microsoft Consultants are sometimes allowed to have a life, so questions asked of them during interviews dont really count and arent listed.
The questions tend to follow some basic themes:

Riddles Algorithms Applications Thinkers


Riddles

Why is a manhole cover round? How many cars are there in the USA? (A popular variant is How many gas stations are there in the USA?") How many manhole covers are there in the USA? Youve got someone working for you for seven days and a gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker? One train leaves Los Angeles at 15mph heading for New York. Another train leaves from New York at 20mph heading for Los Angeles on the same track. If a bird, flying at 25mph, leaves from Los Angeles at the same time as the train and flies back and forth between the two trains until they collide, how far will the bird have traveled? Imagine a disk spinning like a record player turn table. Half of the disk is black and the other is white. Assume you have an unlimited number of color sensors. How many sensors would you have to place around the disk to determine the direction the disk is spinning? Where would they be placed?

Imagine an analog clock set to 12 oclock. Note that the hour and minute hands overlap. How many times each day do both the hour and minute hands overlap? How would you determine the exact times of the day that this occurs? You have two jars, 50 red marbles and 50 blue marbles. A jar will be picked at random, and then a marble will be picked from the jar. Placing all of the marbles in the jars, how can you maximize the chances of a red marble being picked? What are the exact odds of getting a red marble using your scheme? Pairs of primes separated by a single number are called prime pairs. Examples are 17 and 19. Prove that the number between a prime pair is always divisible by 6 (assuming both numbers in the pair are greater than 6). Now prove that there are no prime triples. There is a room with a door (closed) and three light bulbs. Outside the room there are three switches, connected to the bulbs. You may manipulate the switches as you wish, but once you open the door you cant change them. Identify each switch with its bulb. Suppose you had 8 billiard balls, and one of them was slightly heavier, but the only way to tell was by putting it on a scale against another. Whats the fewest number of times youd have to use the scale to find the heavier ball? Imagine you are standing in front of a mirror, facing it. Raise your left hand. Raise your right hand. Look at your reflection. When you raise your left hand your reflection raises what appears to be his right hand. But when you tilt your head up, your reflection does too, and does not appear to tilt his/her head down. Why is it that the mirror appears to reverse left and right, but not up and down? You have 4 jars of pills. Each pill is a certain weight, except for contaminated pills contained in one jar, where each pill is weight + 1. How could you tell which jar had the contaminated pills in just one measurement? The SF Chronicle has a word game where all the letters are scrambled up and you have to figure out what the word is. Imagine that a scrambled word is 5 characters long: How many possible solutions are there? What if we know which 5 letters are being used? Develop an algorithm to solve the word. There are 4 women who want to cross a bridge. They all begin on the same side. You have 17 minutes to get all of them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown, etc. Each woman walks at a different speed. A pair must walk together at the rate of the slower womans pace. Woman 1: 1 minute to cross Woman 2: 2 minutes to cross Woman 3: 5 minutes to cross

Woman 4: 10 minutes to cross For example if Woman 1 and Woman 4 walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If Woman 4 then returns with the flashlight, a total of 20 minutes have passed and you have failed the mission. What is the order required to get all women across in 17 minutes? Now, whats the other way? If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts? You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same? If you have two buckets, one with red paint and the other with blue paint, and you take one cup from the blue bucket and poor it into the red bucket. Then you take one cup from the red bucket and poor it into the blue bucket. Which bucket has the highest ratio between red and blue? Prove it mathematically.

http://www.m4maths.com/placement-puzzles.php?SOURCE=Microsoft

very important for puzzles

Microsoft Placement Paper 2011 | Microsoft Placement Questions | Microsoft Placement Papers Pattern
By Harini on August 6th, 2011

Welcome Googler! If you find this page useful, why not subscribe to the RSS feed for more interesting posts in the future? 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+(055555555&x), \ x=(0xcccccccc&x)>>2+(033333333&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+(055555555&h), \ h=(0xcccccccc&h)>>2+(033333333&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.

14. Given an array t[100] which contains numbers between 1..99. Return the duplicated value. Try both O(n) and O(n-square). 15. Given an array of characters. How would you reverse it. ? How would you reverse it without using indexing in the array. 16. An array of integers of size n. Generate a random permutation of the array, given a function rand_n() that returns an integer between 1 and n, both inclusive, with equal probability. What is the expected time of your algorithm? ANS. Expected time should ring a bell. To compute a random permutation, use the standard algorithm of scanning array from n downto 1, swapping i-th element with a uniformly random element <= i-th. To compute a uniformly random integer between 1 and k (k < n), call rand_n() repeatedly until it returns a value in the desired range. 17. An array of pointers to (very long) strings. Find pointers to the (lexicographically) smallest and largest strings. ANS. Scan array in pairs. Remember largest-so-far and smallest-so-far. Compare the larger of the two strings in the current pair with largest-so-far to update it. And the smaller of the current pair with the smallest-so-far to update it. For a total of <= 3n/2 strcmp() calls. Thats also the lower bound. 18. Write an efficient C code for tr program. tr has two command line arguments. They both are strings of same length. tr reads an input file, replaces each character in the first string with the corresponding character in the second string. eg. tr abc xyz replaces all as by xs, bs by ys and so on. ANS. a) have an array of length 26. 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. the code while (!eof) { c = getc(); putc(array[c - 'a']); } 19. what is disk interleaving 20. why is disk interleaving adopted

Você também pode gostar