2013年微软智在未来暑期实习生招聘部分考题

来源:互联网 发布:星际皆知我爱你百度云 编辑:程序博客网 时间:2024/05/18 21:05

今天有幸参加了微软实习生的招聘笔试,和往年相比,题型大多相似,不过今年貌似加重了智力题的分量,下面是其中一些题目。时间有点紧,没来得及全部Copy下来,希望能对你有点帮助。


(微软应该不会在意我把这题目给公布了吧!这么宽宏大量的微软怎么会呢,呵呵。。。)

注意:20道不定项选择题,采取选错扣分计分法,考试时间为75分钟

原题:

1.Which of the following calling convension(s) support(s) avariable_length parameter(e.g printf)

A cdecl               B.stdcall             C.pascal              D.fastcall


4.About Thread and Process in windows, which description  are correct

A. One application in Os must have one Process, but not a necessary to have one Thread

B. The Process could have its own Stack but the Thread only only could share the stack of its parent Process

C. Thread must belongs to a Process

D. Thread could change its belonging Process


9. 1 of bottles of water is poisoned which will kill a rat in a week if the rat drink any amout of the water.Given thebottles of water have no visual difference, how many rats are needed at least to find the poisoned one in only 1 week.

A.9 B.10 C.32 D.999 E.none of the above.


11. If you computed 32 bit signed integers F and G from 32 bit signed integer X using F = X/2 and G = (X>>1), and you found F!=G, this implies that

A. There is a compiler error

B. X is odd.

C. X is negative

D. F-G=1

E. G-F=1


14. which of the following algorithm is(are) stable sorting

A. bubble sort.     

B. quick sort

C.heap sort     

D.merge sort

E. selection sort


20. Give a set of N balls and one of the which is defective( weighs less than others ), you are allowed to weigh with a balance 3 times to find the defective one ,which of the  following are possible N.

A.12      B.6     C.20      D.24.     E.28.

第九题个人解答:


        设想我们有n只白鼠,每一只白鼠喝药后非死即生,所以,对于n只白鼠,它们总共的死亡情况会有2^n种。也就是说,n只白鼠,我们可以得到2^n中不同的结果。然后考虑如何让每一种情况都发生,而且对于每一种情况,我们就一定能知道是哪瓶药水有毒呢?

        假设现在我们有4只白鼠,编号为a1,a2,a3,总共有8瓶药水,其中一瓶有毒,分别编号为b1,b2...b8.我们取出第一瓶药水b1给a1喝,然后取出第二瓶药水b2给a2喝,再取出第三瓶药水b3给a3喝。对于第四瓶药水b4,给a1和a2喝,第五瓶b5给a1,a3喝,第六瓶b6给a2和a3喝,第七瓶给a1、a2和a3喝。第8瓶b8谁都不给喝。一周后,我们观察白鼠的死亡情况,就可以知道到底是那瓶有毒了。比如就就a1死了,那肯定是b1有毒;如果就a1和a2死了,那么肯定是b4有毒;如果a1、a2和a3都死了,那么肯定是b7有毒;如果都没死,那么肯定是b8有毒(因为没有白鼠喝了它)。

         从数学逻辑可以这样验证:假设有n只白鼠,有m(m>n)瓶药水,前面的n瓶让n只白鼠一只一瓶,对于后面的Cn2(从n个白鼠中选两个)瓶毒药都给两只白鼠喝,再后面的Cn3(从n个白鼠中选三个)瓶毒药给其中的三只白鼠喝,以此类推,最后会得出Cn1+Cn2+...+Cnn = 2^n(排列组合公式),也就是说 ,只要m<=2^n,n只白鼠就能精确测出是m瓶药水中是哪瓶有毒。

        (第九题目答案应为10,选B)


热烈欢迎各位大神不吝赐教,对于上面的题也好,以前的题也好,真心期待你的精彩回复。。。。

(转载请注明出处,谢谢!!!)