2013年微软校园实习生招聘笔试(2013.4.6@北大)

来源:互联网 发布:微商城系统源码 编辑:程序博客网 时间:2024/05/16 18:39

20道选择题,按难度成分L,M,H三个等级,评分规则如下:


1、Which of the followingcalling convension(s) support(s) supportvariable-length parameter(e.g. printf)?(3')

A. cdecl  

B.stdcall

C.pascal

D.fastcall

2、what's the output of the following code?(3')

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')

A.  Search complexity when both sorted

B. Dynamicly add/move

C. Random accessefficiency

D. Data storage type

4、About the Thread and Process in windows, which description(s) is(are) correct: (3’)

A.      Oneapplication in OS must have one process, but not a necessary to have one Thread

B.       Theprocess could have its own stack but the thread only could share the stack ofits parent process

C.       Threadmust belongs to a process

D.      Threadcould change its belong process

5,What is the output of the following code?

{

       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’)

int[][] myArray3 = newint[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’)

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’)

class A{public:long a;};class B:public A{public:long b;};void seta(A* data, int idx){data[idx].a=2;}int main(int argc, char *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){cout<<data[i].a<<data[i].b;}return 0;}

Whatis the correct result?

A.      11111111

B.       12121212

C.       11112222

D.      21212121

 解析:好像这结果和编译器有关,我在DEVC++上跑出来的结果是A,但有同学跑出来的结果是22221111,

9.1 of 1000 bottles of water is poison which will kill a rat in 1week, if the ratdrunk any amout of the water. Given the bottles of water have no visualdifference, how many rats are needed at least to find the poisoned one in 1 week?

A.      9

B.       10

C.       32

D.      999

E.       Noneof the above

解析:http://www.matrix67.com/blog/archives/4361

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

A.      thereturn value of main function if program ends normally

B.       return(7&1)

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

D.      return"microsoft"=="microsoft"

E.       Noneof the above

11.If you computed 32 bit signed integers F and G from 32 bit signed X using F = X/ 2 and G = (X>>1), 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 = 1

12.How many rectangles you can find from 3*4 grid?(5 Points)

A.      18

B.       20

C.       40

D.      60

E.       Noneof 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, howmany parts can 100 line split?(5 Points)

    A. 5051

   B. 5053

   C. 5510

   D. 5511

解析:画一画就知道,原始平面为一个整体1,

           第一条线增加了一个面,为2个部分,

           再第二条线则增加了两个面,为4个部分

           再画第三条线则增加了3个面,为7个部分

           以此类推,第I条线增加了I个部分,

        顾sum(n)=1+1+2+3+4+,,,+n 

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 inweb applications. Which of the following statement(s) is(are) correct:(5Points)

   A. Models often represent data and the business logics needed tomanipulate the data in the application

   B. A view is a (visual) representation of its model. It renders themodel into a form suitable for interaction, typically a user interface element

   C. A controller is the link between a user and the system. Itaccepts input from the user and instructs the model and a view to performactions based on that input

   D. The common practice of MVC in web applications is, the model receivesGET or POST input from user and decides what to do with it, handing over tocontroller 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 fromeach 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!

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

    update books set NumberofCopies =  NumberofCopies+1 

    in

   select AuthorID from Books

   group by AuthorID

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

   

   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 ofthe following are possible N?(13 Points)

   A. 12

   B. 16

   C. 20

   D. 24

   E. 28

 





原创粉丝点击