您当前所在位置:
88好学网范文常识招聘应聘笔试微软校园招聘笔试题» 正文

微软校园招聘笔试题

[10-20 23:53:58]   来源:http://www.88haoxue.com  笔试   阅读:680

概要:[cpp] view plaincopyprint?class Test{public:____ int a;____ int b;public:Test::Test(int _a , int _b) : a( _a ){b = _b;}};int Test::b;int main(void){Test t1(0 , 0) , t2(1 , 1);t1.b = 10;t2.b = 20;printf("%u %u %u %u",t1.a , t1.b , t2.a , t2.b);return 0;}class Test{public:____ int a;____ int b;public:Test::Test(int _a , int _b) : a( _a ){b = _b;}};int Test::b;int main(void){Test t1(0 , 0) , t2(1 , 1);t1.b = 10;t2.b = 20;printf("%u %u %u %u",t1.a , t1.b , t2.a , t2.b);

微软校园招聘笔试题,标签:笔试大全,http://www.88haoxue.com

  [cpp] view plaincopyprint?class Test

  {

  public:

  ____ int a;

  ____ int b;

  public:

  Test::Test(int _a , int _b) : a( _a )

  {

  b = _b;

  }

  };

  int Test::b;

  int main(void)

  {

  Test t1(0 , 0) , t2(1 , 1);

  t1.b = 10;

  t2.b = 20;

  printf("%u %u %u %u",t1.a , t1.b , t2.a , t2.b);

  return 0;

  }

  class Test

  {

  public:

  ____ int a;

  ____ int b;

  public:

  Test::Test(int _a , int _b) : a( _a )

  {

  b = _b;

  }

  };

  int Test::b;

  int main(void)

  {

  Test t1(0 , 0) , t2(1 , 1);

  t1.b = 10;

  t2.b = 20;

  printf("%u %u %u %u",t1.a , t1.b , t2.a , t2.b);

  return 0;

  } Running result : 0 20 1 20

  A、static/const

  B、const/static

  C、--/static

  D、conststatic/static

  E、None of above

  13、A 3-order B-tree has 2047 key words,what is the maximum height of the tree?

  A、11 B、12 C、13 D、14

  解析:m阶B-树的根节点至少有两棵子树,其他除根之外的所有非终端节点至少含有m/2(向上取整)棵子树,即至少含有m/2-1个关键字。根据题意,3阶的B-树若想要达到最大的高度,那么每个节点含有一个关键字,即每个节点含有2棵子树,也就是所谓的完全二叉树了,这样达到的高度是最大的。即含有2047个关键字的完全二叉树的高度是多少,这也是为什么这种题只出3阶的原因吧,就是为了转化成求完全二叉树的深度。很明显求得高度是11,但是由于B-树还有一层所谓的叶子节点,可以看作是外部结点或查找失败的结点,实际上这些结点不存在的,指向这些结点的指针为空。所以不考虑叶子节点信息的时候,最大高度是11,考虑叶子节点信息的时候,最大高度就是12了。

  14、In C++,which of the following keyword(s)can be used on both a variable and a function?

  A、static B、virtual C、extern D、inline E、const

  15、What is the result of the following program?

  [cpp] view plaincopyprint?char *f(char *str , char ch)

  {

  char *it1 = str;

  char *it2 = str;

  while(*it2 != '\0')

  {

  while(*it2 == ch)

  {

  it2++;

  }

  *it1++ = *it2++;

  }

  return str;

  }

  int main(void)

  {

  char *a = new char[10];

  strcpy(a , "abcdcccd");

  cout<

  return 0;

  }

  char *f(char *str , char ch)

  {

  char *it1 = str;

  char *it2 = str;

  while(*it2 != '\0')

  {

  while(*it2 == ch)

  {

  it2++;

  }

  *it1++ = *it2++;

  }

  return str;

  }

  int main(void)

  {

  char *a = new char[10];

  strcpy(a , "abcdcccd");

  cout<

  return 0;

  }A、abdcccd

  B、abdd

  C、abcc

  D、abddcccd

  E、Access violation

  16、Consider the following definition of a recursive function,power,that will perform exponentiation.

  [cpp] view plaincopyprint?int power(int b , int e)

  {

  if(e == 0)

  return 1;

  if(e % 2 == 0)

  return power(b*b , e/2);

  else

  return b * power(b*b , e/2);

  }

  int power(int b , int e)

  {

  if(e == 0)

  return 1;

  if(e % 2 == 0)

  return power(b*b , e/2);

  else

  return b * power(b*b , e/2);

  }Asymptotically(渐进地) in terms of the exponent e,the number of calls to power that occur as a result of the call power(b,e) is

  A、logarithmic

  B、linear

  C、quadratic

  D、exponential

  17、Assume a full deck of cards has 52 cards,2 blacks suits (spade and club) and 2 red suits(diamond and heart). If you are given a full deck,and a half deck(with 1 red suit and 1 black suit),what is the possibility for each one getting 2 red cards if taking 2 cards?

  A、1/2 1/2

  B、25/102 12/50

  C、50/51 24/25

  D、25/51 12/25

  E、25/51 1/2

  18、There is a stack and a sequence of n numbers(i.e. 1,2,3,...,n), Push the n numbers into the stack following the sequence and pop out randomly . How many different sequences of the n numbers we may get? Suppose n is 2 , the output sequence may 1,2 or 2,1, so wo get 2 different sequences .

  A、C_2n^n

  B、C_2n^n - C_2n^(n+1)

  C、((2n)!)/(n+1)n!n!

  D、n!

  E、None of above

  19、Longest Increasing Subsequence(LIS) means a sequence containing some elements in another sequence by the same order, and the values of elements keeps increasing.

  For example, LIS of {2,1,4,2,3,7,4,6} is {1,2,3,4,6}, and its LIS length is 5.

上一页  [1] [2] [3] [4]  下一页


Tag:笔试笔试大全招聘应聘 - 笔试
》《微软校园招聘笔试题》相关文章