所有题目为不定项选择

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

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

2. What's the output of the 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
答案:B
解析:此题考的是继承中的多态问题,即虚函数覆盖的问题,对于直接调用a->f(),是会调用B类的f()函数。但是如果传到A中,由于const函数没被覆盖,因此会调用A的const f()函数,因此要选B。

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
答案:ABC
解析:考查数组和链表的差别。

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

答案:C
解析:一个application至少有一个线程和一个进程。线程也有自己的栈空间。线程不能改变其从属进程。

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
答案:B or D
解析:此题有一点疑惑,编译器不同,答案不同。理论上讲,x++后,x的值变为11,但其返回值仍是10,++y毫无疑问是11.所以理论上面应该是10,11.但在vs上面测试答案是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
答案:D
解析:数组溢出

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
答案:ABC
解析:const的语法。参照 关于const

8. Given the following code:(3 Points)
#include <iostream>
class 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
【此题答案貌似应该是 22221111】

解析:注意A的大小是4字节,B的大小是8字节,B data[4]总共有32字节,在调用seta函数的时候,由于使用的是A的指针,因此每次步进只有4字节。因此只把前4个long值置为了2。

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
答案:B
解析:2^10 = 1024.二进制编码问题。

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
答案:BCD

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
答案:C
解析:负数右移高位补符号位

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
答案:D
解析:横向的点数有5,纵向的有4,因此是排列组合的从5个中选2个,乘以从4个中选两个,即10*6 = 60

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
答案:A
解析:找规律。f(n) = n + f(n-1),f(1)=2.所以f(100) = 5051.

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
答案:AD
解析:稳定的排序有:冒泡排序、鸡尾酒排序、插入排序、合并排序、桶排序、基数排序、二叉树排序、图书馆排序;
不稳定的排序有:选择排序、希尔排序、堆排序、快速排序。

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
答案:AB

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
答案:AC
解析:要确定一棵二叉树,一定要知道中序遍历。再加上前序或后序。

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!
答案:C
解析:找规律,大小为1的有n个,大小为2的有n-1个,。。。,大小为n的有一个,共n*(n+1)/2个。

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

A. 1
B. 2
C. 3
D. 4
E. 5
答案:B
解析:SQL基本语法。

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

答案:D
解析:使用贪心、动态规划、暴力等各种策略,都能很快得到答案。

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
答案:ABCD
解析:小于或等于3^3=27的数都行。
12可以分为6,6一次,3,3,一次,1,1一次。
16可分为5,5一次,如果5,5不相等,继续2,2,一次,1,1一次。如果5,5相等,剩下的3,3一次,1,1一次。
20可分为7,7一次,如果7,7不相等,再3,3一次,1,1一次。如果7,7相等,则剩下的3,3一次,1,1一次。
24可分为9,9一次,如果9,9不相等,轻的那一端再3,3一次,如果3,3相等,则再1,1一次,如果3,3不相等,则轻的那一端1,1一次。如果9,9相等,则剩下的3,3一次,1,1一次。

微软2013暑假实习生笔试题解析相关推荐

  1. 微软2013暑假实习生笔试题

    部分题目答案不确定,会持续更新-- 1. Which of the following calling convention(s) support(s) supportvariable-length ...

  2. 阿里巴巴2013年实习生笔试题A

    一.单项选择题 1.下列说法不正确的是:(B) A.SATA硬盘的速度速度大约为500Mbps/s B.读取18XDVD光盘数据的速度为1Gbps C.前兆以太网的数据读取速度为1Gpbs D.读取D ...

  3. Java类的连接与初始化 (及2013阿里初始化笔试题解析)

    2019独角兽企业重金招聘Python工程师标准>>> Java虚拟机通过装载.连接.初始化来使得一个Java类型可以被Java程序所使用,如下图所示,其中连接过程又分为验证.准备. ...

  4. 微软2013校园招聘笔试题

    1.       数据库 基于某个条件选出一个订单列表,考的是最基本的数据库语言select * from * where * 解: 详见http://blog.csdn.net/zephyr_be_ ...

  5. 微软2012实习生笔试题及答案(望讨论)

    微软的实习生笔试题,不是太难,算法的题好多,但是很多答案都不确定,欢迎大家讨论答案~ 答案:1.C(每迭代一次至少一个确定)  2.AC 3.ACE 4.A 5.C 6.C 7.D 8. AD 9.B ...

  6. 腾讯2016春招安全岗笔试题解析

    腾讯2016春招安全岗笔试题解析 昨天(4月2日)晚上7:00到9:00做了腾讯春招安全岗的笔试题.下面解析一下: 题目解析 1 在生成随机数前用当前时间设置随机数种子应该是安全的.如果程序用固定的数 ...

  7. 【C语言指针】 回调函数、冒泡函数模拟实现qsort、指针和数组笔试题解析

    目录 一.回调函数 定义: 用回调函数形式实现加法运算 二.qsort 函数参数: void指针 用qsort排序整型和结构体 用冒泡函数模拟实现qsort,排序整型和结构体 三.指针和数组笔试题解析 ...

  8. 头条2020届实习生笔试题

    头条2020届实习生笔试题 一卷 编程题: 输入某年某月某日,判断这一天是这一年的第几天? // 判断是否为闰年function isRun(a) {return a % 4 == 0 &&a ...

  9. 记 随手科技2020届实习生笔试题(Java开发工程师)笔试题

    2020届实习生笔试题(Java开发工程师) 一.选择题(共6题,每小题5分,满分30分) 1 2 3 4 5 6 总分 B B A C B C 1.下列排序算法中,初始数据集合对排序性能无影响的是( ...

最新文章

  1. [经典排序算法][集锦]
  2. [微信小程序直播平台开发]___(一)介绍与流程
  3. skywalking 安装_SkyWalking全链路追踪利器
  4. python怎么安装request_【python】如何安装requests
  5. forth day ---内置函数、匿名函数
  6. 平均年薪 70 万!刚刚,这类程序员又涨薪了!佩服!
  7. 李开复:2018中国最大AI红利?是政策
  8. java线程同步的作用_Java并发编程之线程同步
  9. php isnumber 小数点,JavaScript常用正则验证函数实例小结【年龄,数字,Email,手机,URL,日期等】...
  10. Android 常用炫酷控件(开源项目)git地址汇总
  11. Ubuntu20.04(标题栏实时显示网速,cpu以及内存使用率)
  12. 短信服务器和运营商的区别,什么是短信服务商?与短信运营商的区别
  13. 20开头的HSCode总览
  14. php 外包 上海,== | php外包与php技术服务商
  15. linux shell完整程序,Linux Shell程序设计
  16. mmdetection3d 训练
  17. 最新全国姓名报告出炉!
  18. 踩坑记录丨记Jekyll + Github Pages搭建个人博客时遇到的各种问题
  19. 前端人应该知道的 Centos/Docker/Nginx/Node/Jenkins 的基本操作
  20. dw自动滚动图片_Dreamweaver连续滚动图片的制作

热门文章

  1. RDKit入门教程(2)——利用RDKit获取分子指纹
  2. cobol .cpy文件_Visual COBOL R3:“使传统的COBOL能够部署在JVM或.NET上”。
  3. 软件测试用例编写规范文档,模板都给你了我看谁还不会写测试用例
  4. 脱离文档流的三种方法
  5. python实现docx的批注(comments)插入
  6. 关于生产环境跨域问题
  7. 常用排序算法稳定性、时间复杂度分析
  8. php获取文件夹下所有文件名(php遍历目录)
  9. 贝叶斯软件genle教程_贝叶斯网络软件SMILE和GENIE的使用
  10. 番茄花园版侵权被禁,用户怎么办?