1、下面程序的正确输出结果为()

class test
{
public:void print(){cout<<"test"<<endl;}
};int main(void)
{test *t = new test();t->print();t = NULL;t->print();return 0;
}

A、编译不通过           B、运行时必然出错退出          C、运行时可能出错退出
D、test                    E、test  test                           F、test  随机信息  
print是一个类级别的东西,也就是说它和类的实例(或者类的对象)没有任何关系,这也就是说“并未使用this指针”,在这种情况下,print仅与test的类型有关,而不管t是什么东西,只要是类类型的指针就可以调用这个函数。
对象级别的东西,比如类中的某个非静态成员变量,这种东西和类的实例有关,因此它使用this指针。 http://topic.csdn.net/u/20120428/22/06ecf02b-45a3-41e5-8eee-2e0be73a31db.html

2、在小端字节序的机器上执行下列代码的输出为多少?

union UData
{unsigned char btVals[4];unsigned int uiVal;
};UData d;
int main(void)
{d.uiVal = 0x01020408;unsigned int btSum = (d.btVals[0]<<5)+(d.btVals[1]<<3)+(d.btVals[2]<<1)+(d.btVals[3]<<0);cout<<btSum<<endl;return 0;
}

3、下列代码的输出为()

class CClassA
{
public:virtual void Print(){printf("A ");}
};
void PrintFunc(CClassA a)
{a.Print();
}class CClassB:public CClassA
{
public:virtual void Print(){printf("B ");}
};
void PrintFunc(CClassA *pa)
{pa->Print();
}int main(void)
{CClassB b;PrintFunc(b);PrintFunc(&b);return 0;
}

A、A A           B、A B    C、B  A
D、B B            E、程序无法通过编译     F、运行后程序异常终止

4、以下关于const 的用法错误的是()

A、   const int a = 10;
B、  int func(void) const
C、  const int func(void)D、
class A
{
public:void SetStr(const string& str){_str = str;}
private:string _str;
};E、
class A
{
public:const string& void GetStr(void)const{return _str;}
private:string _str;
};

5、读下题

class A
{
public:A();virtual ~A();int a;
};class B : public A
{
public:int b;
};A *a = new B;
B* b1 = dynamic_cast<B *>(a);
B* b2 = static_cast<B *>(a);
B* b3 = reinterpret_cast<B *>(a);

假如b1的值为 0X12345678,则b2、b3可能的值为()

A、0X12345678    0X12345674

B、0X12345674    0X12345674

C、0X12345678    0X12345678

D、0X12345674    0X12345678

Perfect World相关推荐

  1. 367. Valid Perfect Square

    题目: Given a positive integer num, write a function which returns True if num is a perfect square els ...

  2. a prefect storm歌词_Storm s Perfect Storm歌词

    Storm s Perfect Storm歌词 添加日期:2003-05-05 时长:02分18秒 歌手:X Men Artist: Sara Evans Album: Sara Evans : Re ...

  3. Java was not the perfect solution for every pro...

    为什么80%的码农都做不了架构师?>>> When I started writing From Java to Ruby, I had a good idea that Java ...

  4. Two Straws May Make a Perfect Diamond: Selecting Individually Weak Features for a Better Accuracy

    Two Straws May Make a Perfect Diamond: Selecting Individually Weak Features for a Better Accuracy 摘要 ...

  5. 概率图模型PGM——D map, I map, perfect map

    若F分布的每个条件独立性质都反映在A图中,则A图被称为F分布的D map. 若A图表现出的所有条件独立性质都在F分布中满足(与F分布不矛盾),则A图被称为F分布的I map. 弱A图既是F分布的D m ...

  6. Java and Python: a perfect couple - Developer.com

    Java and Python: a perfect couple - Developer.com Java and Python: a perfect couple

  7. Swift-学习Perfect搭建博客

    前段时间听说swift5的改变之一是ABI稳定,现在看的话,swift是值得学习的,于是想通过搭建自己的博客来学习swift,顺便了解后端和mysql,以及前端页面的一些样式. 博客传送门 博客项目放 ...

  8. Perfect service(树形dp)

    Perfect service(树形dp) 有n台机器形成树状结构,要求在其中一些机器上安装服务器,使得每台不是服务器的计算机恰好和一台服务器计算机相邻.求服务器的最小数量.n<=10000. ...

  9. [leetcode] 367. Valid Perfect Square

    Given a positive integer num, write a function which returns True if num is a perfect square else Fa ...

  10. LeetCode Perfect Squares

    Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 1 ...

最新文章

  1. 嵌入式 Jlink中flash.csv和*.jflash文件分析
  2. MAT之PSO:利用PSO实现对一元函数y = sin(10*pi*x) ./ x进行求解优化,找到最优个体适应度
  3. sphinx在window下和linux下加入开机自启动
  4. 线程池:ThreadPoolExecutor
  5. 【Vulnhub靶机系列】DC2
  6. XCTF_Web_新手练习区:view_source
  7. mysql sleep详解_MySQL中sleep函数的特殊现象示例详解
  8. Oracle注册表修改 乱码编码
  9. 计算机辅助工程分析及应用论文,计算机辅助工程计量的论文
  10. Vue 调试工具 vue-devtools 安装及使用
  11. win10系统怎么写java_win10系统制作java文本的操作方法
  12. unix network programming volume1 sorce code build and get(UNIX網絡編程卷1第三版)
  13. 抠图软件哪个好用又免费?快来看看这几款软件
  14. Pycocotools 报error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Bui
  15. JS_js数组倒序排列、字符串数组转为数字数组,反转数组/字符串/数字
  16. python发送qq邮件失败_python发送QQ邮件
  17. Winhex的使用(慢慢更
  18. 太强了,用Python+Excel制作天气预报表!
  19. 身份证复印件一定要加签注 否则可能吃大亏!
  20. 小灰,你出书花了多少钱?

热门文章

  1. 四川一级计算机课程编码,四川省计算机一级考试真题
  2. 你有一份云栖大会的IoT邀请函,请查收
  3. 云原生演进趋势下传统数据库升级实践
  4. 冷链食品竟然也有 “身份证”?
  5. 中国基础软件历史性突破!Gartner最新报告:阿里云进入全球数据库领导者象限
  6. 揭秘双11丝滑般剁手之路背后的网络监控技术
  7. Linux(Redhat5.5)配置时间服务器(Ntp)法
  8. 超图iserver登录密码忘记,重置密码
  9. PHP与SQL注入攻击
  10. Python异常体系结构图