网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
在以下程序: #include main() {  int a=1,b=0;  if(!a) b++;  else if(a==0)if(a)b+=2;  else b+=3;  printf(%d,b); } 程序运行后的输出结果是(  )。
A

0

B

1

C

2

D

3


参考答案

参考解析
解析:
根据在if-else语句中,else总是和最近的if配对的原则,本题中层次关系是:if(!a)与else if(a==0)是一组,在最外层。而if(a)与else是一组,位于else if(a==0)条件的内层。if(!a)与else if(a==0)条件均不成立,所以b未进行任何操作仍为初始值0。答案选择A选项。
更多 “单选题在以下程序: #include main() {  inta=1,b=0;  if(!a)b++;  elseif(a==0)if(a)b+=2;  elseb+=3;  printf(%d,b); } 程序运行后的输出结果是(  )。A 0B 1C 2D 3” 相关考题
考题 有以下程序#include stdio.hmain(){ int i,j,m=55;for(i=1;i=3;i++)for(j=3;j=i;j++) m=m%j;printf("%d\n",m);}程序的运行结果是A ) 0B ) 1C ) 2D ) 3

考题 有以下程序#include stdio.hmain(){ int a=1,b=2,c=3,x;x=(a^b)c; printf("%d\n",x);}程序的运行结果是A)0B)1C)2D)3

考题 有以下程序#include stdio.hmain(){ int x=1,y=0,a=0,b=0;switch(x){ case 1:switch(y){ case 0: a++; break;case 1: b++; break;}case 2: a++; b++; break;case 3: a++; b++;}printf("a=%d, b=%d\n",a,b);}程序的运行结果是A)a=1 , b=0B)a=2, b=2C)a=1, b=1D)a=2, b=1

考题 有以下程序#include stdio.hmain( ){ int a[ ]={1,2,3,4},y,*p=a[3];--p; y=*p; printf("y=%d\n",y);}程序的运行结果是A)y=0B)y=1C)y=2D)y=3

考题 有以下程序#include stdio.hmain(){ int a=1,b=0;printf("%d,",b=a+b);printf("%d\n",a=2*b);}程序运行后的输出结果是A)0,0B)1,0C)3,2D)1,2

考题 有以下程序: include main ( ) int i;for(i =0;i 有以下程序: #include <stdio.h> main ( ) int i; for(i =0;i <3 ;i ++ ) switch (i) case 0: printf(" % d" ,i); case 2: printf(" % d" , i); default: printf( "% d" , i);程序运行后的输出结果是( )。A.22111B.21021C.122D.12

考题 有以下程序:#includestdio.hmain( ){ int a=1,b=0;if(--a)b++;else if(a==0)b+=2;else b+=3:print[(%d\n,b);}程序运行后的输出结果是( )。A.0B.1C.2D.3

考题 有以下程序:include main(){ inta=1,b=2,c=3,x; x=(ab)c; printf("%d\n",x);}程 有以下程序: #include <stdio.h> main() { int a=1,b=2,c=3,x; x=(ab)c; printf("%d\n",x); } 程序的运行结果是( )。A.0B.1C.2D.3

考题 有以下程序 include main( ) { printf("%d\n",NULL); } 程序运行后的输出结果是 有以下程序#include <stdio.h>main( ){ printf("%d\n",NULL); }程序运行后的输出结果是A.0B.1C.-1D.NULL没定义,出错

考题 有以下程序:include main(){ printf("%d\n",NULL);}程序运行后的输出结果是()。A.0B.1C 有以下程序: #include<stdio.h> main() { printf("%d\n",NULL);} 程序运行后的输出结果是( )。A.0B.1C.-1D.NULL没定义,出错

考题 有以下程序includemain(){ int a=1,b=2,c=3,d=0;if(a=1 b++=2)if(b!=2||c-! 有以下程序 #include <stdio.h> main() { int a=1,b=2,c=3,d=0; if(a=1 b++=2) if(b!=2||c-!=3) printf("%d,%d,%d\n",a,b,c); else printf(%d,%d,%d\n",a,b,c); else printf("%d,%d,%o\n",a,b,c); } 程序运行后的输出结果是______。A.1,2,3B.1,3,2C.1,3,,3D.3,2,1

考题 (C语言)数字字符0的ASCII值为48,若有以下程序main(){char a='1',b='2';printf("%c,",b++);printf("%d\n",b-a);}程序运行的输出结果是A、3,2B、50,2C、2,2D、2,50

考题 以下程序运行后的输出结果是( )。 include main() { int x=20; printf("%d", 0 以下程序运行后的输出结果是( )。include<stdio.h>main(){ int x=20;printf("%d", 0<x<20);printf("%d\n", 0<x x<20);}

考题 有以下程序:includemain(){int x=3,y=2,z=1; printf("%d\n",x/y~z);程序运行后的 有以下程序: #include <stdio.h> main() { int x=3,y=2,z=1; printf("%d\n",x/y~z); 程序运行后的输出结果是( )。A.3B.2C.1D.0

考题 以下程序的运行结果是( )。A)0B)1C)2D)3

考题 有以下程序#includestdio.hmain(){ int a=1,b=0;if(--a)b++;else if(a==0) b+=2;else b+=3:printf("%d\n",b);}程序运行后的输出结果是A.0B.1C.2D.3

考题 有以下程序#includestdio.hmain( ){int a=1,b=0if(!a)b++;else if(a==0)if(a)b+=2else b+=3printf(”%d\n”,b);}程序运行后的输出结果是( )。A.0B.1C.2D.3

考题 试题18有以下程序#include stdio.hmain(){ int a=1,b=0;if(- -a) b++;else if(a= =0) b+=2;else b==3;printf(“%d\n”, b);}程序运行后的输出结果是()A.0B.1C.2D.3

考题 下列程序的输出结果是(). main( ) { int x=1,y=0,a=0,b=0; switch(x) { case 1:switch(y) { case 0:a++;break; case 1:b++;break; } case 2:a++;b++;break; case 3:a++;b++;break; } printf("a=%d,b=%d/n",a,b); }A、a=1,b=0B、a=2,b=1C、a=1,b=1D、a=2,b=2

考题 单选题有以下程序:#include main(){ int x=1,y=0; if(!x)y++; else if(x==0) if(x)y+=2;  else y+=3; printf(%d,y);}程序运行后的输出结果是(  )。A 3B 2C 1D 0

考题 单选题有以下程序:#include #include main(){ char x[]=STRING;  x[0]=0; x[1]='\0'; x[2]='0';  printf(%d %d,sizeof(x),strlen(x)); }程序运行后的输出结果是(  )。A 6 1B 7 0C 6 3D 7 1

考题 单选题有以下程序:#include main(){ int a=3; int b=3; printf(%d, ab);}程序运行后的输出结果是(  )。A 6B 1C 0D 3

考题 单选题有如下程序:#include main(){ int a =0,b=1; if(++a==b++)  printf(T); else  printf(F); printf(a=%d,b=%d,a,b); printf();}程序运行后的输出结果是(  )。A Ta=0,b=1B Fa=1,b=2C Ta=1,b=2D Fa=0,b=2

考题 单选题有以下程序 #include main() {  inta[3][4]={1,3,5,7,9,11,13,15,17,19,21,23},(*p)[4]=a,i,j,k=0;  for(i=0;i   for(j=0;j  printf("%d",k); } 程序运行后的输出结果是(  )。A 99B 68C 60D 108

考题 单选题有以下程序#include #include main(){ int a = 3; printf(%d,(a+=a-=a*a));}程序运行后的输出结果是(  )。A -12B 9C 0D 3

考题 单选题在以下程序: #include main() {  inta=1,b=0;  if(!a)b++;  elseif(a==0)if(a)b+=2;  elseb+=3;  printf(%d,b); } 程序运行后的输出结果是(  )。A 0B 1C 2D 3

考题 单选题有以下程序:#includemain(){ int a=1,b=0; if(--a) b++; else if(a==0) b+=2; else b+=3; printf(%d,b);}程序运行后的输出结果是(  )。A 0B 1C 2D 3

考题 单选题以下程序: #include #defineSUB(a)(a)-(a) main() {  inta=2,b=3,c=5,d;  d=SUB(a+b)*c;  printf(%d,d); } 程序运行后的结果是(  )。A 0B -12C -20D 10