小米公司2013校园招聘笔试题(研发)
一,填空题
1. 两个人一个速度为a,一个速度为b,相向而行,在距离为s的时候,A放出鸽子,速度为c,鸽子飞到B后,会返回A,遇到A后再返回B。在这期间鸽子飞行的路程
2. (he)的平方 = she。 h,e,s 各代表什么
3. 运算 93 & -8
4. 将无序数组构建成最大堆,最差的时候,复杂度是
5. int *p = &n;
*p 的值是
A. p 的值 B. p的地址 C. n的值 D. n的地址
6. 一个完全二叉树有770节点,那么叶子个数为
7. 有一个数组a[1...100, 1...65] 有100行 65列。
按行优先,如果数组基地址是 10000,每个元素2各存储单元,问a[56, 22]的地址是
8. 写出一下程序结果
#include <iostream>#include <string>using namespace std;class B{public:B(){cout<<"B is constructing"<<endl;s = "B";}void f(){cout<<s;}private:string s;};class D:public B{public:D():B(){cout<<"D is constructing"<<endl;s = "D";}void f(){cout<<s;}private:string s;};int main(){B* b = new D();b->f();((D*)b)->f();delete b;}