面向对象程序设计(C++)(双语)

上传人:壹****1 文档编号:429883513 上传时间:2022-11-18 格式:DOC 页数:20 大小:121.50KB
返回 下载 相关 举报
面向对象程序设计(C++)(双语)_第1页
第1页 / 共20页
面向对象程序设计(C++)(双语)_第2页
第2页 / 共20页
面向对象程序设计(C++)(双语)_第3页
第3页 / 共20页
面向对象程序设计(C++)(双语)_第4页
第4页 / 共20页
面向对象程序设计(C++)(双语)_第5页
第5页 / 共20页
点击查看更多>>
资源描述

《面向对象程序设计(C++)(双语)》由会员分享,可在线阅读,更多相关《面向对象程序设计(C++)(双语)(20页珍藏版)》请在金锄头文库上搜索。

1、江西财经大学06-07学年第一学期期末考试试卷试卷代码: 03874B 课时: 64学时课程名称:面向对象程序设计(C+)(双语) 适用对象:05级信管、信计一、Single-Choice (Every question is 2 point, total is 32 point)1、( ) has the same function as the sentence: printf(“Hello worldn”) in C language.A. cout”Hello worldn” B. cin”Hello worldn”C. cout”Hello worldn” D. cin”Hello

2、worldn”2、The result of the program is ( ).#include double f(double x, int n) double val = 1.0; while (n-)val = val*x;return(val); void main(void) cout f(5,2) endl; A. 10 B. 7 C. 25 D. 33、For pointers, ( ) is not right.A. int i; int* ptr=&i B. int i; int *ptr; i=*ptrC. int *ptr; ptr=0 D. int i=5; int

3、 *ptr; *ptr=i4、In the following functions, ( ) can not be overloaded.A. Common member functions B. Common non-member functionsC. Destructor D. Constructor5、After executing the following program, ( ) is the result.#includevoid Swap(int a, int b)int t;t=a;a=b;b=t;int main() int x=5, y=10; Swap(x,y); c

4、outx=x y=yendl; return 0; A. x=5 y=10 B. x=10 y=5 C. x=5 y=5 D. x=10 y=106、If a derived class is gained from a base class by private inherit, the private and public members in the base class will become ( ) members for derived class. A. public B. private C. protectedD. friend7、For operator overloadi

5、ng, ( ) is correct.A. The number of operands can be changedB. The priority for operators can be changed C. The syntax for operators cant be changedD. The combination sequence can be changed8、( ) is not right for the description of class.A. Class is a user defined type B. The private members can be a

6、ccessed by friend functions in classC. In class, without declaration the member data are private D. In class, without declaration the member functions are public9、Given a class MyClass, after executing the sentence: MyClass a, b, *p, the constructor will be called ( ) times.A. 1 B. 2 C. 3 D. 410、The

7、 default constructor can exist in the situation of ( ).A. All the timeB. No copy constructor is givenC. No constructor with arguments is givenD. No constructor is given 11、A friend function in a class or a friend class can access ( ) of the class. A. public members B. protected members C. private me

8、mbers D. all members12、For static member data, it is initialized at().A. Before the declaration of class and after the main functionB. Before the main function and after the declaration of classC. In the classD. In the main function13、( ) is equal to the sentence: while(!x).A. x=1 B. x!=1C. x!=0 D.

9、x=014、For macros, ( ) is the result of the following program.#include #define ONE 1#define TWO ONE+ONE#define THREE ONE+TWOvoid main() coutTHREEendl; cout(TWO)*5endl;A. 2 10 B. 1 10 C. 3 10 D. 0 015、In the case of ( ), it can be used inline functions.A. There are cycle sentences in the function like

10、 for(int i)B. There are recursive sentences in the functionC. In order to speed the functionD. There are many codes in the function and they are not frequently used 16、For the descriptions of pure virtual functions and abstract class, () is wrong.A. Pure virtual function is a special function withou

11、t given definitionsB. Abstract class is a class with pure virtual functionsC. If a base class has pure virtual functions, the derived class form it will never be abstract class D. Abstract class can be used as base class, the pure virtual functions in it will defined in the derived class二、Judgment,

12、if it is right please otherwise . (Every question is 2 point, total is 18 point)1、C+ is a sub-set of C, it reserves almost all the characteristics of C.-2、Given int a; int b=a; a=10; b=20; if couta,b; the result is: 20,20.-3、Given class AB, the copy constructor can be defined as: AB:AB(const AB &).-

13、4、Both constructor and destructor can not be overloaded.-5、If class B is a friend of class A, then all member functions of class B can access the members in class A, vice versa.-6、For a non-member operator overloading function, a mode computation can de defined as: X operator%(X), where X is the nam

14、e of a class.-7、No objects of an abstract base class can be instantiated.-8、Given class B int x; /*.*/; we can define class D: public Bint z; public: void SetXZ( int a, int c) x=a; z=c; int Sun() return x+z;-9、Object of a base class can be treated as an object of the derived class.- 三、Complete the program (3*5=15) (Every question is 5 point, total is 15 point) (attention: one l

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 学术论文 > 其它学术论文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号