1、微软暑期实习生笔试题答案仅供参考-更改了部分个人认为不严谨的答案,以及一点点注释1. Which of the following calling convention(s) support(s) supportvariable-length parameter(e.g. printf)?(3 Points) A. cdecl B. stdcall C. pascal D. fastcall注:可变参数函数需要由调用者清栈,因为当前函数并不知道要有多少参数被传入,所以必须用cdcel2. Whats the output of the following code?(3 Points)1. c
2、lassA2. 3. public:4. virtualvoidf()5. 6. coutA:f()endl;7. 8. voidf()const9. 10. coutA:f()constendl;11. 12. ;13. 14. classB:publicA15. 16. public:17. voidf()18. 19. coutB:f()endl;20. 21. voidf()const22. 23. coutB:f()constf();30. 31. 32. intmain()33. 34. A*a=newB();35. a-f();36. g(a);37. deletea;38. A
3、. B:f()B:f()const B. B:f()A:f()const C. A:f()B:f()const D.A:f()A:f()const注:const类指针只可以调用const类方法3. What is the difference between a linked list and an array?(3 Points) A. Search complexity when both are sorted B. Dynamically add/remove C. Random access efficiency D. Data storage type4. About the Thr
4、ead and Process in Windows, which description(s) is(are) correct:(3 Points) 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 could share the Stack of its parent Process C. Thread must belongs to a Proce
5、ss D. Thread could change its belonging Process5. What is the output of the following code?(3 Points)1. 2. intx=10;3. inty=10;4. x=x+;5. y=+y;6. printf(%d,%dn,x,y);7. A. 10, 10 B. 10, 11 C. 11, 10D. 11, 11注:这是道错题。根据ANSI/ISO C标准描述:“在上一个和下一个序列点之间,一个对象所保存的值至多只能被表达式的求值修改一次,而且只有在确定将要保存的值的时候才能访问前一个值。”像x=x
6、+,y=+y这样两次修改同一个变量的表达式是绝不允许的(或者,无论如何都无需明确定义,也就是说,无需知道它们到底做什么,编译器也不必支持它们。)引用至你必须知道的495个C语言问题,人民邮电出版社,37页这种题多见于谭浩强老爷爷出的C教程书。可想而知微软程序员也是看这本书长大的。6. For the following Java or C# code(3 Points)1. intmyArray3=2. newint33. newint35,6,2,4. newint56,9,7,8,3,5. newint23,2; What will myArray322 returns? A. 9 B.
7、2 C. 6 D. overflow7. Please choose the right statement about const usage:(3 Points) A. const int a; /const integer B. int const a; /const integer C. int const *a; /a pointer which point to const integer D. const int *a; /a const pointer which point to integer E. int const *a; / a const pointer which
8、 point to integer8. Given the following code:(3 Points)1. #include2. 3. classA4. public:5. longa;6. ;7. 8. classB:publicA9. 10. public:11. longb;12. ;13. 14. voidseta(A*data,intidx)15. 16. dataidx.a=2;17. 18. 19. int_tmain(intargc,_TCHAR*argv)20. 21. Bdata4;22. 23. for(inti=0;i4;+i)24. 25. datai.a=1
9、;26. datai.b=1;27. seta(data,i);28. 29. 30. for(inti=0;i4;+i)31. 32. std:coutdatai.a1), and you found F!=G, this implies that(5 Points) A. There is a compiler error B. X is odd C. X is negative D. F - G = 1 E. G - F = 112. How many rectangles you can find from 3*4 grid?(5 Points) A. 18 B. 20 C. 40 D
10、. 60 E. None of above is correct13. One line can split a surface to 2 part, 2 line can split a surface to 4 part. Given 100 lines, no two parallel lines, no tree lines join at same point, how many parts can 100 line split?(5 Points) A. 5051 B. 5053 C. 5510D. 5511注:高二找规律题。n(n+1)/2+114. Which of the f
11、ollowing sorting algorithm(s) is(are) stable sorting?(5 Points) A. bubble sort B. quick sort C. heap sort D. merge sortE. Selection sort注:稳定是指(任意)两个相等的元素,排序前后其相对前后位置不变。选择排序、快速排序、希尔排序、堆排序不是稳定的排序算法,而冒泡排序、插入排序、归并排序和基数排序是稳定的排序算法。15. Model-View-Controller(MVC) is an architectural pattern that frequently
12、used in web applications. Which of the following statement(s) is(are) correct:(5 Points) A. Models often represent data and the business logics needed to manipulate the data in the application B. A view is a (visual) representation of its model. It renders the model into a form suitable for interact
13、ion, typically a user interface element C. A controller is the link between a user and the system. It accepts input from the user and instructs the model and a view to perform actions based on that input D. The common practice of MVC in web applications is, the model receives GET or POST input from
14、user and decides what to do with it, handing over to controller and which hand control to views(HTML-generating components) E. None of the above16. we can recover the binary tree if given the output of(5 Points) A. Preorder traversal and inorder traversal B. Preorder traversal and postorder traversa
15、l C. Inorder traversal and postorder traversal D. Postorder traversal17. Given a string with n characters, suppose all the characters are different from each other, how many different substrings do we have?(5 Points) A. n+1 B. n2 C. n(n+1)/2 D. 2n-1 E. n!18. Given the following database table, how m
16、any rows will the following SQL statement update?(5 Points) A. 1 B. 2 C. 3 D. 4 E. 519. What is the shortest path between node S and node T, given the graph below? Note: the numbers represent the lengths of the connected nodes.(13 Points) A. 17 B. 18 C. 19 D. 20E. 21注:从T开始往前倒退,非常简单20. Given a set of N balls and one of which is defective (weighs less than others), you are allowed to weigh with a balance 3 times to find the defective. Which of the following are possible N?(13 Points) A. 12 B. 16 C. 20 D. 24 E. 28注:27以下都可以。实际上,如果允许m次比较,那么N=3m都可以。关键是要想到比如3个球,我们可以比较其中两个,不平衡当然知道哪个轻,平衡就是第三个轻。
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2