高分求做C++练习题

来源:百度知道 编辑:UC知道 时间:2024/05/18 01:04:22
11. Which is the running result of following program?
int i=100;
int fun( )
{static int i=10;
return ++i;
}
void main()
{
fun();
cout<<fun()<<”,”<<i;
}
A.10,100 B.12,100 C.12,12 D.11,100
12. Data encapsulation is to combine a set of data and operations based on the data together , to form a entity(实体), the entity is called
A. class B. object C. function D. block
13. If we have the class definition:
class SAMPLE
{
int n;
public:
SAMPLE(int i=0):n(i){}
void setValue(int n0);
};
Which is the right definition for member function setValue?
A.SAMPLE::setValue(int n0){n=n0;}
B.void SAMPLE::setValue(int n0){n=n0;}
C.void setValue(int n0){n=n0;}
D.setValue(int n0){n=n0;}
14. Which operator can not be overloaded in C++ ?
A. && B. [ ] C. :: D

(B)11. Which is the running result of following program?
int i=100;
int fun( )
{static int i=10;
return ++i;
}
void main()
{
fun();
cout<<fun()<<”,”<<i;
}
A.10,100 B.12,100 C.12,12 D.11,100

(A)12. Data encapsulation is to combine a set of data and operations based on the data together , to form a entity(实体), the entity is called
A. class B. object C. function D. block

(B)13. If we have the class definition:
class SAMPLE
{
int n;
public:
SAMPLE(int i=0):n(i){}
void setValue(int n0);
};
Which is the right definition for member function setValue?
A.SAMPLE::setValue(int n0){n=n0;}
B.void SAMPLE::setValue(int n0){n=n0;}
C.void setValue(int n0){n=n0;}
D.setValue(int n0){n=n0;}

(C)14. Which operator can not be overloaded in C++ ?
A. && B. [ ] C. :: D. New

(D)15. InC++,which fun