1,2
3,6
4,7
变量的地址值
第1题:
A.输出:* * * *
B.输出:# # #
C.#存在语法错误
D.无输出结果
第2题:
以下程序的输出结果是( )。 main {int x=0.5;char z=a; printf("%d\n",(x&1)&&(z<2));}
A.0
B.1
C.2
D.3
第3题:
执行下列程序 int fun(int x1,int x2){ int x; x1>x2 ?(x=3):(x=4); return x+x1; } void main(){ cout<<fun(7,8); } 后输出结果是 ______。
A.9
B.10
C.11
D.12
第4题:
有如下程序: #include <iostream.h> class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<a; } }; class x2 : virtual public x { public: x2() { a+=2; cout<<a; } }; class y : public xl,public x2 { public: y() { cout<<a<<end1; } }; int main() { y obj; return O; } 该程序运行后的输出结果是( )。
A.1
B.123
C.242
D.244
第5题:
有以下程序
#inculde <stdio.h>
int Fun()
{ ststic int x=1;
x*=2;return x;
}
main ()
{ int i,s=1;
For(i=1;I<=2,I + +) s =Fun();
printF(“%d\n”,s);
}
程序运行后的输出结果是
A.0
B.1
C.4
D.8
第6题:
有以下程序: #include<stdio.h> int fun( ) {static int x=1; X*=2;return X; main( ) int i,s=1; for(i=1;i<=2;i++)s=fun( ); printf{¨%d\n",s); } 程序运行后的输出结果是( )。
A.0
B.1
C.4
D.8
第7题:
有以下程序: #include<stdio.h> int fun( ) {static int x=1; X*=2: return x; } main( ) {int i,S=1; for(i=1;i<=3;i++)S*=fun( ); printf("%d\n",s); } 程序运行后的输出结果是( )。
A.0
B.10
C.30
D.64
第8题:
以下程序的输出结果是 #include<stdio.h> struct st { int x;int *y;}*p; int dt[4]={10,20,30,40}; struct st aa[4]={50,&dt[0],60,&dt[0],60,&dt[0],60,&dt[0],}; main() { p=aa; printf("%d\n",++(p->x));}
A.10
B.11
C.51
D.60
第9题:
若有以下程序: #include <iostream> using namespace std; class A { public: A() { } A(int i) { x1=i; } void dispa0 { cout<<"x1="<<x1<<","; } private: int x1; }; class B: public A { public: B() { } B(int i):A(i+10) { x2=i; } void dispb() { dispa(); cout<<"x2="<<x2<<endl; } private: int x2; }; int main() { B b(2); b.dispb(); return 0; } 程序运行后的输出结果是( )。
A.x1=10,x2=2
B.x1=12,x2=10
C.x1=12,x2=2
D.x1=2,x2=2
第10题:
(37)有以下程序
#include <stdio.h>
struct ord
{ int x,y;}dt[2]={1,2,3,4};
main()
{
struct ord *p=dt;
printf("%d,",++(p->x)); printf("%d\n",++(p->y));
}
程序运行后的输出结果是
A)1,2
B)4,1
C)3,4
D)2,3
第11题:
11
21
6
120
第12题:
0
10
30
64
第13题:
有以下程序 include<stdio.h> typedef struct { int num;double s; }REC; void funl(REC *x) { x->num=23;x->s=88.5; } void main() { REC a={16,90.0}; fun1(&A); printf("%d\n",a.num); } 程序运行后的输出结果是( )。
第14题:
以下程序的输出结果是【 】。
include <stdio.h>
int fun(int x)
{ static int t=0;
return(t+=x);
}
main()
int s,i;
for(i=1 ;i<=5;i++) s=fun(i);
printf("%d\n",s);
第15题:
有以下程序 #include<stdio.h> struct ord { int x,y;} dt[2]={1,2,3,4}; mare() { struct ord*p=dt; printf("%d,",++p->x); printf("%d\n",++p->y); } 程序的运行结果是______。
A.1,2
B.2,3
C.3,4
D.4,1
第16题:
有以下程序
#include<stdio.h>
struct ord
{int x,y;} dt[2]={1,2,3,4};
main()
{
struct ord*p=dt;
printf(“%d,”,++(p一>x));printf(“%d\n”,++(p一>y));
}
程序运行后的输出结果是
A.1,2
B.4,1
C.3,4
D.2.3
第17题:
有以下程序: #include<stdio.h> struct ord {int X,y;)dt[2]={1,2,3,4}; main( ) { struct ord*p=dt; printf("%d,",++(p->x));printf("%d\n",++(p->y)); } 程序运行后的输出结果是( )。
A.1,2
B.4,1
C.3,4
D.2,3
第18题:
若有以下程序: #include <iostream> using namespaces std; class A { public: A (){} A (int i) { x1=i; } void dispa() { cout<<"xl="<<xl<<" , "; } private: int x1; }; class B : public A { public: B (){} B (int i):A(i+10) { x2=i; } void dispb() { dispa (); cout <<"x2="<<x2<<end1; } private: int x2; }; int main () { B b(2); b.dispb (): return 0; } 程序运行后的输出结果是( )。
A.x1=10,x2=2
B.x1=12,x2=10
C.x1=12,x2=2
D.x1=2,x2=2
第19题:
若有以下程序: #include<iostream> using namespaces std; class A { public: A(){} A(int i) { xl=i; } void dispa() { cout<<"x1="<<x1<<","; } private: int x1; }; class B:public A { public: B(){} B(int i):A(i+10) { x2=i; } void dispb() { dispa(); cout<<"x2="<<x2<<endl; } private: int x2; }; int main{) { B b(2); b.dispb(): return 0; } 程序运行后的输出结果是
A.x1=10,x2=2
B.x1=12,x2=10
C.x1=12,x2=2
D.x1=2,x2=2
第20题:
若有以下程序: #include<iOStream> using namespaces std; class A { public: A(){} A(int i) { x1=i; } void dispa() { cout<<"X1="<<x1<<",": } private; int x1; }; class B:public A { public: B(){} B(int i):A(i+10) { x2=i; } void dispb() { dispa(); cout<<"x2="<<x2<<end1; } private: int x2; }; . int main() { B b(2); b.dispb() return 0; } 程序运行后的输出结果是( )。
A.x1=10,x2=2
B.x1=12,x2=10
C.x1=12,x2=2
D.x1=2,x2=2
第21题:
执行下列程序后的输出结果是( ) int fun(int x1,int x2) { int x;x1>x2?(x=3):(x=4);return(x+x1); } main() { printf("%d\n",fun( 7,8));}
A.9
B.10
C.11
D.12
第22题:
0
1
4
8
第23题:
1
0
2
4