【单选题】【消耗次数: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
随机题目
【单选题】 Small as it is, the ant is as much a creature as ____ all other animals on the earth.
①  are
②  is
③  have
④  do
【单选题】 She’s fainted. Throw some water on her face and she’ll ____.
①  comeround
②  comealong
③  comeon
④  comeout
【单选题】 The inspector ____ his fingers over the sheet of newspaper. There were some marks on the surface of the paper.
①  turned
②  set
③  held
④  ran
【单选题】 ——May I put my luggage on the seat beside you, sir? ——____.
①  Sure,withpleasure
②  Okay,pleaseyourself
③  Well,nevermind
④  Yes,helpyourself
【单选题】 03. I promised to look_________ the matter as soon as I got there.
①  for
②  in
③  into
④  after
【单选题】 10. After a three-hour heated discussion, all the members in the jury reached the conclusions that the man was_________ of murder.
①  criminal
②  charged
③  guilty
④  faulty
【单选题】 09. The chemical factory was demolished _________ protecting the environment.
①  inspiteof
②  inhonorof
③  infavorof
④  inthenameof
【单选题】 06. He spoke so quickly that I didn t _________ what he said.
①  makefor
②  makesure
③  makeover
④  makeout
【单选题】 01. You should be able to_________ right from wrong.
①  perceive
②  distingusih
③  sight
④  observe
【单选题】 04. Your sister has made an_________for you to see the dentist at 3 this afternoon.
①  appointment
②  intervies
③  opportunity
④  assignment