Microsoft 2013校园招聘笔试题及解答

题目是自己做的,求讨论、吐槽、拍砖

1.      Which of the following callingconvension(s) support(s) support variable length parameter(e.g. printf)? (3Points)

A.     cdecl            B. stdcall           C.pascal          D.     fastcall

分析:<来自百科>

__cdecl 是C Declaration的缩写(declaration,声明),表示C语言默认的函数调用方法:所有参数从右到左依次入栈,这些参数由调用者清除,称为 手动清栈。被调用函数不会要求调用者传递多少参数,调用者传递过多或者过少的参数,甚至完全不同的参数都不会产生编译阶段的错误。
_stdcall 是StandardCall的缩写,是C++的标准调用方式:所有参数从右到左依次入栈,如果是调用类成员的话,最后一个入栈的是this指针。这些堆栈 中的参数由被调用的函数在返回后清除,使用的指令是 retnX,X表示参数占用的字节数,CPU在ret之后自动弹出X个字节的堆栈空间。称为自动清栈。函数在编译的时候就必须确定参数个数,并且调用者必 须严格的控制参数的生成,不能多,不能少,否则返回后会出错。
PASCAL 是Pascal语言的函数调用方式,也可以在C/C++中使用,参数压栈顺序与前两者相反。返回时的清栈方式与_stdcall相同。
_fastcall 是编译器指定的快速调用方式。由于大多数的函数参数个数很少,使用堆栈传递比较费时。因此_fastcall通常规定将前两个(或若干个)参数由寄存器传 递,其余参数还是通过堆栈传递。不同编译器编译的程序规定的寄存器不同。返回方式和_stdcall相当。
_thiscall 是为了解决类成员调用中this指针传递而规定的。_thiscall要求把this指针放在特定寄存器中,该寄存器由编译器决定。VC使用ecx,Borland的C++编译器使用eax。返回方式和_stdcall相当。
_fastcall 和 _thiscall涉及的寄存器由编译器决定,因此不能用作跨编译器的接口。所以Windows上的COM对象接口都定义为_stdcall调用方式。

2.      What’s the output of thefollowing code?(3 Points)

  1. class A
  2. {
  3. public:
  4. virtual void f()
  5. {
  6. cout<<”A::f()”<<endl;
  7. }
  8. void f()const
  9. {
  10. cout<<”A::f()const”<<endl;
  11. }
  12. };
  13.  
  14. class B : public A
  15. {
  16. public:
  17. void f()
  18. {
  19. cout<<”B::f()”<<endl;
  20. }
  21. void f() const
  22. {
  23. cout<<”B::f()const”<<endl;
  24. }
  25. };
  26.  
  27. void g(const A* a)
  28. {
  29. a->f();
  30. }
  31.  
  32. int main()
  33. {
  34. A* a = newB();
  35. a->f();
  36. g(a);
  37. delete a;
  38. }

A:  B::f() B::f() const               B:     B::f()  A::f() const              C:   A::f()  B::f() const         D: A::f()  A::f() const

3. What is the different between a linked list and an array?

A. Search complexity when both are sorted

B. Dynamically add/remove

C. Random access effficiency

D. Data storage type

4. About the Thread and Process in Windows, which description(s) is (are) correct:

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

B. The Process cound have its own Stack but the thread only could share the Stack of its parent Process.

C. Thread must belongs to a Process

D. Thread could change its belongiing Process

5. What is the output of the following code?

  1. {
  2. int x = 10;
  3. int y = 10;
  4. x = x++;
  5. y = ++y;
  6. printf("%d,%d\n", x, y);
  7. }

A. 10, 10            B. 10, 11          C. 11, 10            D. 11. 11

分析:该代码为定义,但是结果是D。

6. For the following Java or C# code

  1. int[][] myArray3 = new int[3][]{
  2. new int[3]{5,6,2},
  3. new int[5]{6,9,7,8,3},
  4. new int[2]{3,2}
  5. };

what will

  1. myArray3[2][2]

returns?

A. 9            B. 2            C. 6             D. overflow

7. Please choose the right statement about const usage:

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 point to integer

8. Given the following code:

  1. #include <iostream>
  2. class A
  3. {
  4. public:
  5. long a;
  6. };
  7. class B : public A
  8. {
  9. long b;
  10. };
  11. void seta(A* data, int idx)
  12. {
  13. data[idx].a = 2;
  14. }
  15.  
  16. int _tmain(int argc, _TCHAR* argv[])
  17. {
  18. B data[4];
  19.  
  20. for(int i = 0; i < 4; ++i)
  21. {
  22. data[i].a = 1;
  23. data[i].b = 1;
  24. seta(data, i);
  25. }
  26.  
  27. for(int i = 0; i < 4; ++i)
  28. {
  29. std::cout<<data[i].a<<data[i].b;
  30. }
  31.  
  32. return 0;
  33. }

which is the correct result?

A. 11111111       B. 12121212             C. 11112222         D.21212121

答案:22221111

9. 1 of 1000 bottles of water is poisoned which will kill a rat in 1 week if the rat drunk a mount of the water. Given the bottles of water have no visual difference, how many rats are needed at least to find the poisoned one in 1 week?

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

10. Which of following statement(s) equal(s) value 1 in C programming language?

A. the return value of main function if program ends normally.

B. return (7 & 1);

C. char *str = "microsoft"; return str == "microsoft";

D. return "microsoft" = "microsoft";

E. None of the above.

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

A. There is a complier error          B. X is odd          C. X is negative       D. F - G = 1        E. G - F = 1

12. How  many rectangles you can find from 3*4 grid?

A.   18               B. 20                C.40                 D 60                  E. None of above is correct

13. One line can split a surface to 2 part, 2 line can split a surface to 4 part. Give 100 lines, no tow parallel lines, no tree lines join at the same point, how many parts can 100 line split?

A. 5051            B. 5053               C. 5510                    D. 5511

分析:递推公式:x(n) - x(n-1) = n , x(0) = 1

14. Which of the following sorting algorithm(s) is (are) stable sorting?

A. bubble sort             B. quicksort             C. heap sort             D. merge sort           E. Selection sort

15. Model-View-Controller(MVC) is an architectural pattern that frequently used in web applications. Which of the following statement(s) is(are) correct:

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 interaction, 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 application is, the model receives GET or POST input from 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 above

16. We can reover the binary tree if given the ouput of

A. Preorder traversal and inorder traversal

B. Preorder traversal and postorder traversal

C. Inorder traversal and postorder traversal

D. Postorder traversal

17. Given a string with n characters, suppose all the characters are different  from each other, how many different substrings do we have?

A. n+1            B. n^2            C. n(n+1)/2           D. 2^n -1             E. n!

18. Given the following database table, how many rows will the following SQL statement update?

  1. update Books set NumberOfCopies=NumberOfCopies+1 Where AuthorID in
  2. Select AuthorID from Books
  3. group by AuthorID
  4. having sum(NumberOfCopies)<=8

A. 1            B. 2               C. 3                D. 4                E. 5

19. What is the shortest path between node S and node T, given the graph below? Note: the numbers represent the length of the connected nodes.

A. 17               B. 18                   C. 19               D. 20                                  E. 21

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?

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

作者:bigwangdi 
出处:http://www.cnblogs.com/bigwangdi/ 
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 
Stay Hungry, Stay Foolish!!

 
分类: C/C++笔试面试

Microsoft 2013校园招聘笔试题及解答的更多相关文章

  1. Microsoft2013校园招聘笔试题及解答

    继续求拍砖!!!! 1. You are managing the database of a book publichser, you currently store the book orders ...

  2. google2013校园招聘笔试题(全国)

    google2013校园招聘笔试题 1. 单项选择题1.1如果把传输速率定义为单位时间内传送的信息量(以字节计算)多少.关于一下几种典型的数据传输速率:1.使用USB2.0闪存盘,往USB闪存盘上拷贝 ...

  3. 2014 WAP校园招聘笔试题

    2014 WAP校园招聘笔试题 Problem's Link:   http://www.doc88.com/p-6751117015483.html WAP公司笔试题 We are planning ...

  4. Microsoft2013校园招聘笔试题

    Microsoft2013校园招聘笔试题 继续求拍砖!!!! 1. You are managing the database of a book publichser, you currently ...

  5. C# - 2017微软校园招聘笔试题 之 MS Recognition[待解决]

    MS Recognition 在线提交: hihoCoder 1402 http://hihocoder.com/problemset/problem/1402 类似: OpenJudge - I:P ...

  6. 九度OJ 1531 货币面值(网易游戏2013年校园招聘笔试题) -- 动态规划

    题目地址:http://ac.jobdu.com/problem.php?pid=1531 题目描述: 小虎是游戏中的一个国王,在他管理的国家中发行了很多不同面额的纸币,用这些纸币进行任意的组合可以在 ...

  7. 京东2017校园招聘笔试题 【第K个幸运数】

    题目描述 4和7是两个幸运数字,我们定义,十进制表示中,每一位只有4和7两个数的正整数都是幸运数字. 前几个幸运数字为:4,7,44,47,74,77,444,447... 现在输入一个数字K,输出第 ...

  8. PPS2013校园招聘笔试题

    转载请标明出处,原文地址:http://blog.csdn.net/hackbuteer1/article/details/11473405 一.简答题 (1)一位老师有2个推理能力很强的学生,他告诉 ...

  9. 2012Google校园招聘笔试题

    1.已知两个数字为1~30之间的数字,甲知道两数之和,乙知道两数之积,甲问乙:“你知道是哪两个数吗?”乙说:“不知道”.乙问甲:“你知道是哪两个数吗?”甲说:“也不知道”.于是,乙说:“那我知道了”, ...

随机推荐

  1. (c#2.0)serialPort串口通讯

    原文:(c#2.0)serialPort串口通讯 using System; using System.Collections.Generic; using System.ComponentModel ...

  2. DirectX11 学习笔记2 - 加入关键事件 实现视角转换 旋转

    上的程序的的基础上.在基类D3DBase添加摄像头功能 //录影机 void D3DBase::setCamera() { //关键事件 //假定A,S,D,W,Q,E,Z,X,C键被按下.动摄像机 ...

  3. Ubuntu自己主动搭建VPN Server - PPTP的Shell脚本

    #!/bin/bash if [ "$UID" != "0" ]; then echo "please use sudo to run $0" ...

  4. installshield制作的安装包卸载时提示重启动的原因以及解决办法

    原文:installshield制作的安装包卸载时提示重启动的原因以及解决办法 有时候卸载installshield制作的安装包程序,卸载完会提示是否重启电脑以完成所有卸载,产生这个提示的常见原因有如 ...

  5. 图文详解ReSharper 8.1功能变化

    ReSharper 8.1版本已经发布有段时间了,被广大开发者购买和试用,今天小编就ReSharper 8.1功能变化就行详细的解说. 支持TypeScript 突出了重构(重命名,引入变量).导航. ...

  6. js实现tooltip动态提示效果(文字版)

    页面中经常用到鼠标移动到一个元素上面显示提示的功能,最开始的做法是在下面创建一个div然后动态显示这个div,但是这样需要加很多div,比较麻烦. 针对上面个的需求,这边写了一个tooltip动态提示 ...

  7. How To: Use CLR Profiler

    (翻译)How To: Use CLR Profiler   第一次翻译对我而言比较长的E文,有很多不足之处,请见谅.(个人的习惯GC又做了名词又做了名词) 原文:http://msdn.micros ...

  8. iOS基础 - 触摸事件与手势识别

    一.iOS的输入事件 UIKit可识别三种类型的输入事件: 触摸事件 运动(加速计)事件 远程控制事件 二.UIEvent iOS中许多事件对象都是UIEvent类的实例,记录事件产生的时刻和类型 U ...

  9. SHELL编程笔记(二)之shell流程控制

    Shell控制流程结构 本章内容有:   退出状态   While.for和until loops循环   If then else语句   脚本中动作   菜单 条件控制语句 If then els ...

  10. [转]How WebKit Loads a Web Page

    ref:https://www.webkit.org/blog/1188/how-webkit-loads-a-web-page/ Before WebKit can render a web pag ...