【单选题】【消耗次数:1】
下述程序的运行结果( )。 #includevoid main() { int x=1,a=0,b=0; switch(x) { case 0:b++; case 1:a++; case 2:a++;b++; } printf(a=%d,b=%d\n,a,b); }
a=2,b=1
a=1,b=2
a=0,b=1
a=1,b=0
参考答案:
复制
纠错
相关题目
【单选题】 下述程序的运行结果( )。 #includevoid main() { int x=1,a=0,b=0; switch(x) { case 0:b++; case 1:a++; case 2:a++;b++; } printf(a=%d,b=%d\n,a,b); } case 1:a++; case 2:a++;b++; } printf(a=%d,b=%d\n,a,b); }
①  a=1,b=1
②  a=2 ,b=1
③  a=2,b=2
④  a=3,b=3
【单选题】 有如下程序:main(){  intx=1,a=0,b=0;  switch(x){  case0:b++;case1:a++;case2:a++;b++;}  printf(“a=%d,b=%d\n”,a,b);}该程序的输出结果是()
①  a=2 b=1
②  a=1 b=1
③  a=1 b=0
④  a=2 b=2
【单选题】 有如下程序: #includevoid main( ) { int a=2,b=-1,c=2; if (ab) if (b0) c=0; else c++; printf(%d\n } 该程序的输出结果是
①  0
②  1
③  2
④  3
【单选题】 有以下程序#includestdio.hmain(){ int a=1,b=0;if(--a) else if(a==0) b+=2;else b+=3;printf(“%d\n”,b); }程序运行后的输出结果是(  )。
①  0
②  1
③  2
④  3
【单选题】 有以下程序#includestdio.hmain(){ int a=1,b=0;if(--a) else if(a==0) b+=2;else b+=3;printf(“%d\n”,b); }程序运行后的输出结果是。
①  0
②  1
③  2
④  3
【单选题】 以下程序的输出结果是()。 main( ) { int b[3][3]={0,1,2,0,1,2,0,1,2},i,j,t=0; for(i=0;i for(j=i;j t=t+b[i][b[j][j]]; printf(%d\n,t); }
①  3
②  4
③  1
④  9
【单选题】 运行以下程序,从键盘上输入china# #includevoid main() { int v1=0,v2=0; char ch; while((ch=getchar())!=#) switch(ch) { case a: case h: default: v1++; case 0:v2++; } printf(%d,%d\n,v1,v2); } 运行结果( )。
①  2,2
②  3,3
③  4,4
④  5,5
【单选题】 下述程序的运行结果( )。 #includevoid main() { int a=1,b=2,c=3; if(c=a)printf(%d\n else printf(%d\n }
①  1
②  3
③  5
④  6
【单选题】 有以下程序,程序运行以后的输出结果是() #include stdio.h main( ) { int a[ ]={2,3,5,4},i; for(i=0;i switch(i%2) { case 0:switch(a[i]%2) {case 0:a[i]++;break; case 1:a[i]--; }break; case 1:a[i]=0; } for(i=0;i printf(\n); }
①  3 3 4 4
②  2 0 5 0
③  3 0 4 0
④  0 3 0 4
【单选题】 下述程序的运行结果( )。 #includevoid main() { int a=4,b=3,c=5,t=0; if(aa=b;b=t; if(aa=c;c=t; printf(%d,%d,%d\n,a,b,c); }
①  5,1,3
②  4,5,6
③  5,0,3
④  3,4,7
随机题目
【单选题】 清朝在广州设立的对外垄断代理商行称
①  申明亭
②  十三行
③  官本船
④  市舶司
【单选题】 清朝特别创立的刑罚有
①  发遣
②  充军
③  枷号
④  刺字
【单选题】 中国古代经济立法最活跃的时期是
① 
② 
③ 
④ 
【单选题】 中国历史上最后一部以刑为主、诸法合体的法典是
①  《大清律集解附例》
②  《大清律例》
③  《大清新刑律》
④  《大清会典》
【单选题】 清代以“四格”为标准考核官吏,其中品德操行方面的内容称为
① 
② 
③ 
④ 
【单选题】 首创市舶制度的朝代是
① 
② 
③ 
④ 
【单选题】 充军作为正式刑名,始自
①  宋朝
②  明朝
③  清朝
④  元朝
【单选题】 元朝中央最高行政机关是
①  理藩院
②  宣政院
③  大宗正府
④  中书省
【单选题】 封建五刑十恶最早规定于
①  《北齐律》
②  《晋律》  
③  《唐律疏议》
④  《开皇律》
【单选题】 科举制首创于  
① 
② 
③ 
④