long val=6;
int age = 23L;
short x=1,y=2,z z=x+y;
int a= ‘A’;
第1题:
有如下程序: #include <iostream> using namespace std; class Part{ public: Part(int x=0):val(x) { cout<<val; } ~Part() { cout<<val; } private: int val; }; class Whole { public: Whole(int x, int y, int z=0):p2(x),p1 (y),val(z) { cout<<val; } ~whole() { cout<<val; private: Part p1,p2; int val; }; int main() { Whole obj (1,2,3); return 0; }程序的输出结果是
A.123321
B.213312
C.213
D.123123
第2题:
以下程序执行后的输出结果是( )。 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = X*X; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第3题:
有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x){cout< ~Part( ){cout<<val;} pritave: int val; }; class Whole{ public: Whole(int x,int Y,int z=0):p2(x),p1(Y),val(z){cout<<val;} ~Whole( ){cout<<val;} pritave: Part p1,p2; int val; f; int main( ){ Whole obj(1,2,3); return 0; } 程序的输出结果是
A.123321
B.213312
C.213
D.123123
第4题:
以下程序的输出结果是______。 fun(int x, int Y, int z) { z=x*x+y*y;} main() { int a=31; fun(5, 2, a); printf("% d", a); }
A.0
B.29
C.31
D.无定值
第5题:
若有以下变量和函数说明: #include<iostream.h> charCh='*'; void sub(int x,int y,char ch,double*Z) { switch(ch) { case'+':*Z=x+y;break; case'-':*Z=x-y;break: case'*':*Z=x*y;break; case'/':*z=x/y;break: } } 以下合法的函数调用语句是( )。
A.sub(10,20,Ch,y);
B.sub(1.2+3,2*2,'+',&Z);
C.sub(sub(1,2,'+',&y),sub(3,4'+',&x),'-',&y);
D.sub(a,b,&x,ch);
第6题:
已有定义int x=3, y=4, z=5;则表达式“!(x+y)+z-1y+z/2”的值是________。
A.6
B.0
C.2
D.1
第7题:
有如下程序: #jnClude<iostream> using namespaCe std; Class Part{ publiC: Part(int x=0):val(X){Cout<<val;} ~Part{Cout<<val;} private: int val; t }; Class Whole{ publiC: Whole(int x,int Y,int z=0):p2(x),pl(y),val(z){Cout<<val;} ~Whole{eout<<val;} private: Part pl,p2; int val; }; int main { Whole obj(1,2,3); return 0; } 执行这个程序的输出结果是( )。
A.123321
B.213312
C.213
D.123123
第8题:
下列函数定义不正确的是 ( )
A.int max { int x y,z; z=x>y? x: y }
B.int max(x,y) int x,y; { int z; z=x>y? x:y; return(z) }
C.int max(x,y) { int x,y z; z=x>y? x: y; return(z); }
D.int max( ) {}
第9题:
以下程序执行后的输出结果是( )。 #include<iostream> using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y, int z,int r) { z = x+y; X = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第10题:
以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第11题:
若有int x=3,y=4,z=5; ,则表达式 !(x+y)+z-1 && y+z/2的值是()
第12题:
long val=6;
int age = 23L;
short x=1,y=2,z z=x+y;
int a= ‘A’;
第13题:
下面结构体的定义语句中,错误的是( )。
A.struct ord{int x;int Y;int Z;};struet ord a;
B.struct ord{int x;int y;int Z;}struct ord a;
C.struct ord{int X;int Y;int Z;}a;
D.struct{int X;int y;int Z;}a;
第14题:
以下程序的输出结果是 ( ) fun (int x,int y, int z) { z=x * x+y * y;} main( ) { int a=31; fun(5,2,a); print{("%d",a); }
A.0
B.29
C.31
D.无定值
第15题:
以下程序的输出结果是______。
fun(int x,inty,int z)
{ z=x*x+y*y;}
main()
{ int a=31;
fun(6,3,a)
printf("%d",a)
}
第16题:
有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x) {cout<<val;} ~Part(){cout<<val;} private: int val; }; class Whole{ public: Whole(int x ,int y, int z=0):p2(x),p1(y),val(z){cout<<val;} ~Whole(){cout<<val;} private: Part p1,p2; int val; }; int main() Whole obj(1,2,3); return 0; } 程序的输出结果是( )。
A.123321
B.213312
C.213
D.123123
第17题:
已有定义:int x=3,y=4,z=5,则表达式!(x+y)+z-1&&y+x/2的值是
A.6
B.0
C.2
D.1
第18题:
以下程序输出结果是 ______。 #include<iostream.h> void fun(int x,int y,int z){z=x+y;} void main() { int a=10; fun (2,2,a); cout<<a; }
A.0
B.4
C.10
D.无定值
第19题:
以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y,int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第20题:
以下程序执行后的输出结果是 #include<iostream> using namcspace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第21题:
已有定义:int x=3,y=4,z=5;,则表达式!(x+y)+z-1 && y+z/2的值是
A.6
B.0
C.2
D.1
第22题:
下列带缺省值参数的函数说明中,正确的说明是 ______。
A.int Fun(int x, int y=2,int z=3);
B.int Fun(int x=1,int y,int z=3);
C.int Fun(int x, int y=2,iht z);
D.int Fun(int x=1,int y, int z=3);
第23题:
下列赋值语句正确的是哪一项?()
第24题:
struct ord{int x;int y;int z;};struct ord a;
struct ord{int x;int y;int z;}struct ord a;
struct ord{int x;int y;int z;}a;
struct {int x;int y;int z;}a;