资源预览内容
第1页 / 共20页
第2页 / 共20页
第3页 / 共20页
第4页 / 共20页
第5页 / 共20页
第6页 / 共20页
第7页 / 共20页
第8页 / 共20页
第9页 / 共20页
第10页 / 共20页
亲,该文档总共20页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
江西财经大学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 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 *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); coutx=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 overloading, ( ) 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 accessed 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 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 members 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. 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 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 without 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, 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 &).-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 name 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
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号