微软2013年校园实习生招聘笔试题及答案

原文:

http://www.wangkaimin.com/2013/04/07/%e5%be%ae%e8%bd%af2013%e5%b9%b4%e6%a0%a1%e5%9b%ad%e5%ae%9e%e4%b9%a0%e7%94%9f%e6%8b%9b%e8%81%98%e7%ac%94%e8%af%95%e9%a2%98%e5%8f%8a%e7%ad%94%e6%a1%88/#more-195

1. Which of following calling convension(s) support(s) supportvariable-length parameter (e.g.printf)? (3 Points)

A. cdecl

B. stdcall

C. pascal

D. fastcall

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

class A
{public:virtual void f(){cout << “A::f()” << endl;}void f() const{cout << “A::f() const” << endl;}
};
class B:public A
{public:void f(){cout <<”B::f()” << endl;}void f() const{cout << “B::f() const” << endl;}
};void g(const A* a)
{a->f();
}int main()
{A* a = new B();a->f();g(a);delete a;
}

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 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 type

4. About the Thread 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 Process

D. Thread could change its belonging Process

5. What is the output of the following code? (3 Points)

{int x = 10 ;int y = 10 ;x = x++ ;y = ++y ;printf("%d, %d\n",x,y);
}

A. 10, 10

B. 10, 11

C. 11, 10

D. 11, 11

6. For the following Java or C# code(3 Points)

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

What will myArray3[2][2]

returns?

A. 9

B. 2

C. 6

D. overflow

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

8. Given the following code:(3 Points)

#includeclass A{public:long a;
};class B : public A
{public:long b;
};void seta(A* data, int idx)
{data[idx].a = 2;
}int _tmain(int argc, _TCHAR *argv[])
{B data[4];for(int i=0; i<4; ++i){data[i].a = 1;data[i].b = 1;seta(data, i);}for(int i=0; i<4; ++i){std::cout << data[i].a << data[i].b;}return 0;
}

What is the correct result?

A. 11111111

B. 12121212

C. 11112222

D. 21212121

E 22221111

B data[4];连开64个字节空间 传进函数后强转成A*也就是加法操作每次移动的是sizeof(A)也就是8个字节 而B本身是16个字节 就相当于四次把前两个B的32个字节的值全都赋成了2 于是22221111

9. 1 of 1000 bottles of water is poisoned which will kill a rat in 1 week if the rat drunk any amout 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?(5 Points)

A. 9

B. 10

C. 32

D. None of the above

海明码校验位的原理,2^r>=n+1即可

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

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 integer X using F = X/2 and G = (X >> 1), and you found F != G, this implies that (5 Points)

A. There is a comlier 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?(5 Points)

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. 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. 5510

D. 5511

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

A. bubble sort

B. quick sort

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:(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 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 applications 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 recover the binary tree if given the output of(5 Points)

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?(5 Points)

A. n+1

B. n^2

C. n(n+1)/2

D. 2^n-1

E. n!

看对substring怎么理解了。如果理解成subsequence就是D。不然是C

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

微软2013年校园实习生招聘笔试18题

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 lengths of the connected nodes.(13 Points)

微软2013年校园实习生招聘笔试19题

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?(13 Points)

A. 12

B. 16

C. 20

D. 24

E. 28

1 A
2 B
3 ABC
4 C
5 D
6 D
7 ABC
8 -//没答案,应该是22221111
9 B
10 B
11 C
12 D
13 A
14 AD
15 AC
16 AC
17 C
18 B
19 D
20 ABCD

tongji.gif

转载于:https://www.cnblogs.com/passby/p/3385230.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/274123.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Android 第七课 4种基本布局之FrameLayout和百分比布局

FrameLayout&#xff08;帧布局&#xff09;&#xff0c;她没有方便的定位方式&#xff0c;所有的控件都会默认摆放在布局的左上角。 修改activity_main.xml中的代码&#xff0c;如下&#xff1a; <?xml version"1.0" encoding"utf-8"?> <Frame…

mongodb 群集图_群集和重叠条形图

mongodb 群集图为什么和如何 (Why & How) 1.- Clustered Bar Charts1.- 集群条形图 AKA: grouped, side-by-side, multiset [bar charts, bar graphs, column charts]AKA &#xff1a;分组&#xff0c;并排&#xff0c;多组[条形图&#xff0c;条形图&#xff0c;柱形图] …

第一次写python

这是一个在BJDP上学习Coding Kata的时候用到的一个练习&#xff0c;原来打算用Java写的&#xff0c;但是一想正好是学习的好机会。 就用Python了。第一次&#xff0c;写的有些复杂。 这个题目是关于购买图书的打折信息的。 题目来源&#xff1a; http://codingdojo.org/cgi-bin…

Android 第八课 创建自定义控件

常用控件和布局的继承结构&#xff0c;如下图&#xff1a; &#xff08;待续。。。。&#xff09; 所有的控件都是直接或间接继承自View的&#xff0c;所用的所有布局都是直接或间接继承自ViewGroup的&#xff0c;View是Android中最基本的一种UI组件&#xff0c;它可以在屏幕上…

figma下载_搬到Figma对我意味着什么

figma下载A couple of years ago, amidst the boom of new design and prototyping software, I was pretty reluctant to fight on the Figma/Sketch cold war. I was working on a relatively small design team and, after years helping to design products, well sold on …

解决IE中img.onload失效的方法

解决IE中img.onload失效的方法 - CoffeeCats IT Blog - IT博客http://www.cnitblog.com/CoffeeCat/archive/2008/02/01/39533.htmlFirefox、Google Chrome不存在问题&#xff01;为什么onload没有被IE调用呢&#xff1f;因为IE会缓存图片&#xff0c;第2次加载的图片&#xff0…

Android 第九课 常用控件-------ListView

ListView允许用户通过手指上下滑动的方式将屏幕外的数据滚动到屏幕内&#xff0c;同时屏幕上原有数据将会滚动出屏幕。 1、ListView简单用法 如何将ListView将你要显示的大量内容关联起来呢&#xff1f;这是个很重要的问题。 1、首先我们必须先将数据提供好&#xff0c;因为你的…

Singleton patterns 单件(创建型模式)

1、模式分类 1.1 从目的来看&#xff1a; • – 创建型&#xff08;Creational&#xff09;模式&#xff1a;负责对象创建。 • – 结构型&#xff08;Structural&#xff09;模式&#xff1a;处理类与对象间的组合。 • – 行为型&#xff08;Behavioral&…

Android 第十一课 SQlite 数据库存储

Android 为了让我们能够更加方便的管理数据库&#xff0c;特意提供了一个SQLiteOpenHelper帮助类&#xff0c;通过借助这个类就可以非常简单的对数据库进行创建和升级。 SQLiteOpenHelper是一个抽象类&#xff0c;我们要创建一个自己的帮助类去继承它。SQLiteOpenHelper有两个抽…

浅析SQL Server 2005中的主动式通知机制

一、引言 在开发多人同时访问的Web应用程序&#xff08;其实不只这类程序&#xff09;时&#xff0c;开发人员往往会在缓存策略的设计上狠下功夫。这是因为&#xff0c;如果将这种环境下不常变更的数据临时存放在应用程序服务器或是用户机器上的话&#xff0c;可以避免频繁地往…

Android 第十二课 使用LitePal操作数据库(记得阅读最后面的注意事项哦)

一、LitePal简介 1、(新建项目LitePalTest)正式接触第一个开源库---LitePalLitePal是一款开源的Android 数据库框架&#xff0c;它采用了对象关系映射&#xff08;ORM&#xff09;的模式。2、配置LitePal&#xff0c;编辑app/build.gradle文件&#xff0c;在dependencies闭包中…

listview频繁刷新报错

在Android编程中使用Adapter时&#xff0c;偶尔会出现如下错误&#xff1a;The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI t…

Android 第十三课 SharedPreferences存储

SharedPreferences是使用键值对的方式来存储数据的。当保存一条数据时&#xff0c;需要给这条数据提供一个对应的键&#xff0c;这样在读取数据的时候就可以通过这个键把相应的值取出来。而且支SharedPreferences还支持多种不同的数据类型存储&#xff0c;例如&#xff1a;如果…

DSP的Gel作用

转自&#xff1a;http://blog.csdn.net/azhgul/article/details/6660960最近刚在研究Davinci系&#xff0c;特此MARK下&#xff0c;以资后续学习之用。 DSP的Gel作用 1 GEL文件基本作用 当CCSStudio启动时&#xff0c;GEL文件加载到PC机的内存中&#xff0c;如果定义了StartUp(…

解决关于登录校园网显示不在IP段的问题方案(要看注意事项哦!)

有时&#xff0c;登录校园网&#xff0c;账号和密码都显示正确&#xff0c;但是却显示出“账号只能在指定IP段登录”的问题。 那我们就提供了一个解决方案&#xff1a; 使用WinR,并在输入框&#xff0c;输入cmd命令&#xff1a;&#xff08;如下&#xff09;接着输入&#xff1…

jquery插件编写

jQuery为开发插件提拱了两个方法&#xff0c;分别是&#xff1a; jQuery.fn.extend(object); jQuery.extend(object); jQuery.extend(object); 为扩展jQuery类本身.为类添加新的方法。可以理解为添加静态方法。是全局的&#xff08;位于jQuery命名空间内部的函数&#xff09;…

gtk/Glade编程 编译命令不成功 解决方法

摘自&#xff1a;http://blog.chinaunix.net/uid-26746982-id-3433656.html 当我们编写gtk/glade程序&#xff0c;gcc编译时&#xff0c;用如下命令&#xff1a; #gcc -o server server.c pkg-config --cflags --libs gtk-2.0 报错&#xff1a;/tmp/ccoXadAd.o: In function …

Android 第十五课 如何使用LitePal从SQLite数据库中删除数据(十四课用来保留讲解如何向SQLite数据库中存入数据)

使用LitePal删除数据的方式主要有两种&#xff0c;第一种就是直接调用已存对象的delete()方法&#xff0c;所谓已存储对象就是调用过save()方法的对象&#xff0c;或者说是通过LitePal提供的查询API查出来的对象&#xff0c;都是可以直接使用delete方法来删除对象的。这是比较简…

页面返回顶部(方法比较)

下面就说下简单的返回顶部效果的代码实现&#xff0c;附注释说明。 1. 最简单的静态返回顶部&#xff0c;点击直接跳转页面顶部&#xff0c;常见于固定放置在页面底部返回顶部功能 方法一&#xff1a;用命名锚点击返回到顶部预设的id为top的元素 html代码 <a href"#top…

Android 第十六课 使用LitePal查询数据

LitePal在查询API方面做了非常多的优化&#xff0c;基本上可以满足绝大多数场景的查询需求&#xff0c;并且代码也十分整洁。 例如我们需要查询表中的所有数据&#xff1a; List<books> DataSupport.findAll(Book.class); 没有冗长的参数列表&#xff0c;只需要调用一下…