C++测试题练习题1
1、which of the following is not automatically generated by the compiler?
a. default constructor b. copy constructor c. equality operator(op==) d. assignment operator(op=) e. destructor
2、which of the following is not an STL collection?
a. vector b. list c. map d. tree e. set
3、which statement is false?
a. Destructors are called when a pointer is deleted.
b. Destructors are called when an object goes out of scope.
c. Destructors are called when a reference goes out of scope.
d. A virtual destructor should be used if the class has virtual methods.
e. Base class destructors are called after derived class destructors.
4、what should you avoid calling from a constructor?
a. a static method b. an inlined method c. a virual method d. a const method e. an extern method
5、which of the following C++ operators cannot be overloaded?
a. << b. [] c. ++ d. () e. :?
6、Consider the following function:
void foo(const char* name) { char* Name1 = name; //Statement1 const char* Name2 = name; //Statement2 char* const Name3 = name; //Statement3 char const* Name4 = name; //Statement4 }
which of the following is true?
a. Statement 1 fails to compile b. Statement 1 and 3 fails to compile
c. Statement 3 and 4 fails to compile d. Statment 2 fails to compile
e. Statment 3 and 4 fails to compile
7、Consider the following code:
struct MyStruct { int foo(){return 1;} };class MyClass { int foo(){ return 2;} }; MyStruct s; MyClass c; ***** int x = s.foo(); //Statement1 int y = c.foo(); //Statement2
Circle one answer below which is true of the above code.
a. Statement 1 will cause a compilation error b. Statement 2 will cause a compilation error
c. Both statement will compilation successfully d. Both statement will fail to compile
8、Consider the following class:
class ClassX { public: ClassX():C_(1),B_(2),A_(B_+C_){} private: int A_; int B_;int C_; };
what value will the member variable A be initialized to?
a. 0 b. 1 c. 2 d. 3 e. None of the above
9、Name the design pattern that is implemented in the following C++ class:
class XXX { public: static XXX * instance() { static XXX x; return &x; } protected: { XXX(){} }};
a. proxy b. composite c. singleton d. factory e.adapter
10 class Foo { public:virtual void cala(){cout << "foo"<<end1;} }class Bar : public Foo { public:void calc(){cout << "bar"<<end1;} }int main() {Bar * b1 = new Bar();Bar b2;Foo f1 = *b1;Foo &f2 = b2;Foo *f3 = b1;f1.calc();f2.calc();f3.calc(); }
which of the output of the above code?
a. foo foo foo b. foo bar bar c. foo foo bar d. bar bar bar e. bar foo bar
转载于:https://www.cnblogs.com/CD-lulu/p/4174775.html
C++测试题练习题1相关推荐
- 商务智能_测试题/练习题
一 1.什么是商务智能产生的驱动力( c ) a将企业内部的数据转换为利润 b商务智能可帮助企业收集信息 c商务智能可将数据转换为信息,将信息转换为知识,进而支持企业进行决策 d商务智能也制定企业决策 ...
- 【练习题】20道HTML测试题
编辑整理 | web前端开发 1.HTML语言中的换行标记是 ( ) A.html B.br C.title D.p 2.<img>标记符中连接图片位置的参数是 ( ) A.href ...
- python小甲鱼练习题答案_小甲鱼Python第 013讲元组:戴上了枷锁的列表 | 课后测试题及参考答案...
测试题: 0. 请用一句话描述什么是列表?再用一句话描述什么是元组? 列表:一个大仓库,可以随时往里面添加和删除任何东西. 元祖:封闭的列表,一旦定义,就不可改变(不能添加.删除或修改) 1. 什么情 ...
- mysql测试题汇总_总结:SQL练习【SQL经典练习题】
好像今天圣诞节 刚刷完SQL练习[SQL经典练习题],本篇文章将对我不牢固的知识做简单汇总. 没对比就没标准,当练习超经典SQL练习题,做完这些你的SQL就过关了时才知道自己以前练习的SQL是最基础的 ...
- 小猿圈python之python期末考试测试题(二)_小猿圈python之练习题
很多朋友通过自学来学习python,只是一味的看视频,从来不知道自己动手练习一下,实践是检验自己学没学会的唯一真理,今天小猿圈加加针对自学的朋友出一道经典的练习题,检验一下学习的程度,面试的小伙伴也可 ...
- 计算机技能测试题6,2016年10月自考计算机网络技术练习题及答案(6)
[正保网校课程]为了使各位考生能顺利通过2016年自学考试,无忧考网为大家特别推荐2016年自学考试课程!点击进入免费试听<<<< 11.对一个网络进行层次结构的划分时应做到: ...
- 计算机技能测试题12答案,计算机基本技能考试选择题及答_计算机一级考试练习题及答案...
计算机一级考试练习题及答案分为四个等级,不同等级的内容不同,一级主要考核微型计算机基础知识和使用办公软件及因特网(Internet)的基本技能.那么计算机一级考试怎么考?以下仅供参考! 一.选择题 1 ...
- 计算机基础操作测试题,计算机基础操作练习题.pdf
计算机基础操作练习题 试卷名称:ssssssss 试卷说明: 命题教师:北京邮电大学世纪学院 计算机科学与技术系 许 艺枢 一.Word 操作题(总分50 ) 1.(分值:1.9 分)Word 文字编 ...
- 华师的入学计算机测试题,华师期末考试计算机练习题
华师期末考试计算机练习题 (26页) 本资源提供全文预览,点击全文预览即可全文预览,如果喜欢文档就下载吧,查找使用更方便哦! 19.9 积分 .第1题在Word中,按Delete键,可删除_____ ...
最新文章
- 学习《Linux设备模型浅析之设备篇》笔记(二)
- redis 管理工具_Redis的跨平台GUI 桌面管理工具
- 如何处理SAP OData错误消息: Invalid parametertype used at function XXXX
- sign check fail: check Sign and Data Fail!-错误处理
- iOS多线程: pthread、NSThread
- 【画图专题】sns.heatmap的用法简介
- 火灾检测、人流量统计、安全帽检测,飞桨开源一键运行的产业案例教程
- php出来了 不知道做什么,PHP也做好好多年了,最近在看laravel框架,但是面对如此丰富的文档,我却不知道在讲什么,完全看不懂,请问我是哪里出了问题?...
- 淘宝店铺所有商品API接口(店铺所有商品列表接口)
- 软件质量保证与测试(秦航第二版)第二章
- 大公司比较习惯问及的97道问题附答案
- 火狐浏览器不支持html5,这样写 火狐浏览器不支持?
- 华为h12m03装系统_华为H22H-03服务器怎么从U盘装系统?
- 每日吃核桃桂圆红枣可延缓衰老
- 360插件化方案RePlugin学习笔记-汇总
- mysql存储引擎查看语句,在MySQL中,可以使用(??)语句查看MySQL服务器采用的默认存储引擎...
- 博世传感器BMM150数据读取
- 使能树莓派无线上网和SSH登录
- ❤️数据可视化❤️:基于Echarts + GeoJson实现的地图视觉映射散点(气泡)组件【15】 - 江西省
- 被假阀门坑过吗?如何辨别翻新阀门?
热门文章
- string转short java_[Java基础]之 数据类型转换
- html博客源码_5分钟搭建私人Java博客系统——Tale
- php实现tcp连接的原理,PHP实现TCP实例
- oracle 性能优化 常用,Oracle數據庫常用性能優化
- 我的世界java和基岩版哪个好玩_我的世界:Java版本好玩还是基岩版好玩?老玩家看完后沉默了...
- mysql 优化 修复原理_mysql下表的修复与优化
- Shell 脚本案例实战 [4]
- LinkedList源码阅分析
- 2.2基本算法之递归和自调用函数_一文学会递归解题
- 如何用PPT编制方案 (4)PPT中的图形设计