期中理论题总结
来源:互联网 发布:mac版ae cc破解补丁 编辑:程序博客网 时间:2024/06/05 17:10
程设理论期中总结
标签:c++
If we define double a = 3.14;
,which is NOT correct? (B)
A.double &b = a;B.int &b = a;C.const int &b = a;D.const double &b = a;
Which function will be called? (C)
void f(int i) {}void f(const int i) {}int main() { const int a = 0; f(a);}A.void f(int i)B.void f(const int i)C.compile errorD.runtime error
因为两个函数都是按值传递的参数,因此不会对main函数中的变量产生影响,编译器可能会认为是同一个函数,从而导致重复定义
Which function will be called? (B)
void f(int* i) {}void f(const int* i) {}int main() { const int a = 0; const int* p = &a; f(p);}A.void f(int* i)B.void f(const int* i)C.compile errorD.runtime error
这道题用的是指针传参,因此会对main函数里的变量产生影响。
Which of the following does the C++ compiler NOT examine, in order to select the proper overloaded? (D)
A. types of the arguments in the function callB. order of the arguments in the function callC. the number of arguments in the function callD. the return type of the function
What does the code A a();
do ? (B)
class A { int i;};A. create a object named "a"B. declare a function named "a"C. compile errorD. runtime error
Which is correct? (A)
A. const object can only call const member functionB. non-const object can only call non-const member functionC. static member function can also be const
What‘s the value of a and b after constructor?
class A { public: A() : b(1), a(b+1) {} private: int a; int b;};A. 2 1B. 1 2C. undefined-value 1D. undefined-value undefined-value
对象创建过程中跟定义的顺序有关,与参数列表的顺序无关
Which statement will cause a “compile error”? (3)
class A { public: A() : a(1) {} private: const int a;};int main() { A a, b; // (1) A c(a); // (2) a = b; // (3) return 0;}
The copy constructor is executed on :
(1) Assigned one object to another object at its creation
(2) When objects are sent to function using call by value mechanism
(3) When the function return an object
Which function will be called ? (D)
class A { public: void f() {} void f(int i) {}};class B : public A { public: void f(A a) {}};int main() { B b; b.f(3); return 0;}A. void f()B. void f(int i)C. void f(A a)D. compile error
PS: Name hiding
- 期中理论题总结
- 程设期中理论题解析
- 大一上学期期中总结
- 大一下学期期中总结
- CSDN week4及期中总结
- 三道期中考试题总结
- [开源夏令营][八] 期中总结
- Linux u盘助手期中总结
- 2016.4总结(月考省选期中三连挂)
- javaee期中考前简略只是总结(个人/很简陋)
- 工作流理论总结
- 工作流理论总结
- JAVA 理论总结
- 工作流理论总结
- 驾照理论考试总结
- 流媒体的理论总结
- LDAP理论精炼总结
- 测试理论总结
- UML---面向对象与面向过程
- 大学生程序设计邀请赛(华东师范大学)A
- A+B Problem
- RocketMQ源码解析:Message顺序发送与消费
- 单点登录系统
- 期中理论题总结
- 【源码分析】Volley用法及源码分析
- “惊群”,看看nginx是怎么解决它的
- iOS蓝牙4.0开发流程
- 计算机病毒
- RecyclerView实现checkBox
- 初学python爬虫
- 数组
- 别再乱用jQuery return false