A.3,4
B.3,3
C.2,4
D.2,3
第1题:
有如下函数定义;void func(int a,int & b){a++;b++;}若执行代码段:int x=0,y=1;func(x,y);则变量x和y的值分别是
A.0和1
B.1和1
C.0和2
D.1和2
第2题:
有下列函数定义: int fun(double a,double b) {return a*b;} 若下列选项中所用变量都已经正确定义并赋值,错误的函数调用是( )。
A.if(fun(x,y)){……}
B.z=fun(fun(x,y),fun(x,y));
C.z=fun(fun(X,y)x,y);
D.fun(x,y);
第3题:
有如下函数定义: void funC(int a,int&B. {a++;b++;} 若执行代码段: int x=0,Y = 1; funC(X,Y); 则变量x和y的值分别是( )。
A.0和1
B.1和1
C.0和2
D.1和2
第4题:
若有函数fun(x,y),并且已经使函数指针变量p指向函数fun,则使用p调用函数fun的正确方法是( )。
A.(*p)fun(x,y);
B.*pfun(x,y);
C.(*p)(x,y)
D.*p(x,y)
第5题:
下列程序的执行结果是( )。
#include(iostream.h>
#include<stdlib.h>
classTestClass
{
public:
intX,y;
TestClass( ){x=y=0;}
TestClass(inta,intb){x=a;y=b;}
voiddisp( )
{
cout<<"x="<<x<<",y="<y<<endl;
}
};
voidmain( )
{
TestClasss1(2,3);
s1.disp( );
}
A.x=2,y=2
B.x=2,y=3
C.x=3,y=2
D.x=3,y=3
第6题:
下列函数的运行结果是( )。 #include<iostream.h> intadd(inta,intb); voidmain() { externintX,y; cout<<add(X,y)<<endl; } intx(20),y(5); intadd(inta,intb) { ints=a+b: returns; }
A.25
B.30
C.20
D.15
第7题:
下列程序的执行结果是( )。 #include(iostream.h> #include<stdlib.h> classTestClass { public: intX,y; TestClass( ){x=y=0;} TestClass(inta,intb){x=a;y=b;} voiddisp( ) { cout<<"x="<<x<<",y="<y<<endl; } }; voidmain( ) { TestClasss1(2,3); s1.disp( ); }
A.x=2,y=2
B.x=2,y=3
C.x=3,y=2
D.x=3,y=3
第8题:
下列程序的执行结果是( )。 #include<iostream.h> classSample { intx,y; public: Sample(){x=y=0;} Sample(inta,intb){x=a;y=b;} ~Sample() { if(x==y) cout<<"x=y"<<endl; else cout<<"x!=y"<<endl; } voiddisp() { cout<<"x="<<x<<",y="<<y<<endl;} }; voidmain() { Samples1(2,3); s1.disp(); }
A.x=2,y=2
B.x=3,y=3
C.x=2,y=3
D.x=3,y=2
第9题:
设x、y、z均为int型变量,则执行以下语句后,x、y, z的值为( ) X=1; y=0; Z=2; y++&&++Z ||++ X;
A.2、l、3
B.2、0、3
C.2、l、3
D.2、1、2
第10题:
若有定义intx=3,y;则执行语句y=(x++)+(x++)+(x++)后,y=()
第11题:
6
5
4
3
第12题:
9
12
15
18
第13题:
A.1
B.2
C.3
D.4
第14题:
有下列程序: #include<stdi0.h> voidfun(int*a,int*b) {int*C; c=a;a=b;b=C; } voidmain( ) {intx=3,y=5,*p=&x,*q=&y; fun(p,q);printf("%d,%d,",*P,*q); fun(&x,&y);printf("%d,%d\n",*P,*q) } 程序运行后的输出结果是( )。
A.3,5,5,3
B.3,5,3,5
C.5,3,3,5
D.5,3,5,3
第15题:
有下列程序: 、 fun(int X,int y){return(x+y);) main( ) { int a=1,b=2,c=3,sum; sum=fun((a++,b++,a+b),c++); printf("%d\n",sum); } 执行后的输出结果是( )。
A.6
B.7
C.8
D.9
第16题:
有如下类声明: classXA{ intx: public: XA(intn){x=n;} }; classXB:publicXA{ inty; oublic: XB(inta,intb); }; 在构造函数XB的下列定义中,正确的是( )。
A.XB::XB(inta,intb):x(a),y(b){}
B.XB::XB(inta,intb):XA(a),y(b){}
C.XB::XB(inta,intb):x(a),XB(b){}
D.XB::XB(inta,intb):XA(a),XB(b){}
第17题:
有以下函数定义: int fun(double a,doubleB){return a*b;} 若以下选项中所用变量都已正确定义并赋值,错误的函数调用是( )。
A.if(fun(x,y)){……}
B.z=fun(fun(x,y),fun(x,y));
C.z=fun(fun(x,y)x,y);
D.fun(x,y);
第18题:
有以下程序: fun(int x,int y){return(x+y);} main() {int a=1,b=2,c=3,Sum; sum=fun((a++,b++,a+b),c++); printf("%d",sum); } 执行后的输出结果是______。
A.6
B.7
C.8
D.9
第19题:
下列程序的执行结果是( )。 #include<iostream.h> #include<stdlib.h> classTestClass { public: intX,y; TestClass(){x=y=0;} TestClass(inta,intb)(x=a;y=b;}voiddisp() { cout<<"x="<<x<<",y="<<y<<endl; } }; voidmain() { TestClasss1(2,3); s1.disp(); }
A.x=2,y=2
B.x=2,y=3
C.x=3,y=2
D.x=3,y=3
第20题:
有以下程序: #include(iostream.h) voidfun(inta,intb,intc) {a=456,b=567,C=678;} voidmain( ) { intx=10,y=20,z=30; fun(x,Y,z); cout<<x<<,<<y<<,<<Z<<endl; } 输出结果是( )。
A.30,20,10
B.10,20,30
C.456,567,678
D.678,567,456
第21题:
已知一个函数的定义如下:double fun(int x,double y){⋯⋯}则该函数正确的函数原型声明为()
第22题:
若有定义intx=3,y;则执行语句y=(++x)+(++x)+(++x)后,y=()
第23题:
0和1
1和1
0和2
1和2