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

题目内容 (请给出正确答案)

已知int i=1,j=0;执行下面语句后j的值是____。    while(i) switch(i) { case 1: i+=1;j++;break; case 2: i+=2;j++;break; case 3: i+=3;j++;break; default: i--;j++;break;}

A.1

B.2

C.3

D.死循环


参考答案和解析
死循环
更多 “已知int i=1,j=0;执行下面语句后j的值是____。    while(i) switch(i) { case 1: i+=1;j++;break; case 2: i+=2;j++;break; case 3: i+=3;j++;break; default: i--;j++;break;}A.1B.2C.3D.死循环” 相关考题
考题 以下程序的运行结果是 【 9 】 。main( ){ int a=2,b=7,c=5;switch(a0){ case 1:switch(b0){ case 1: printf ("@"); break;case 2: printf("!"); break;}case 0: switch(c==5){ case 0 : printf (" * "); break;case 1 : printf(" # "); break;case 2: printf(" $ "); break;}default : printf("");}printf("\n");}

考题 ( 18 )以下选项中与 if ( a==1 ) a=b; else a++; 语句功能不同的 switch 语句是A )switch ( a ){case : a=b ; break ;default:a++ ;}B )switch ( a==1 ){case 0 : a=b ; break ;case 1 : a++ ;}C )switch ( a ){default : a++ ; break ;case 1 : a=b ;}D )switch ( a==1 ){case 1 : a=b ; break ;case 0 : a++ ;}

考题 以下程序的输出结果是 ( ) main( ) { int n[3] [3],i,j; for (i=0;i<3;i+ +) for(j=0;i<3;++) n[i][j]=i+j; for(i=0;i<2;i++) for(j=0,j<2;j++) n[i+1][j+1]+=[i][j]; printf("%d\n",n[1][j]); }A.14B.0C.6D.值不确定

考题 下列程序的输出结果是______。 main() { int i=3; switch(i) { case 1: case 2:printf("%d",i); case 3: case 4:break; default:printf("OK"); } }A.0B.3C.OKD.没有任何输出

考题 下列程序段选择项,使i的运行结果为3的程序段是( )。A.int i=0,j=O; (i=2,(j++)+i);B.int i=1,j=0; j=i=((i=3)*2);C.int i=0,j=1; (j=1)?(i=1):(i=3);D.int i=1,j=1; i+=j+=1;

考题 以下代码的输出结果是什么? class Foo{ public static void main(String args[]){ int x=4,j=0; switch(x){ case 1:j++; case 2:j++; case 3:j++; case 4:j++; case 5:j++; break; default:j++; } System.out.println(j); } }()A.1B.2C.3D.编译错误

考题 以下程序的输出结果是()。includevoid main(){int a(5),b(6),i(0),j(0);switch(a) { 以下程序的输出结果是( )。 #include<iostream.h> void main() { int a(5),b(6),i(0),j(0); switch(a) { case 5:switch(b) { case 5:i++;break; case 6:j++;break; default:i++;j++; } case 6:i++; j++; break; default:i++;j++; } cout<<i<<","<<j<<endl; }A.1,2B.1,3C.2,2D.2,3

考题 以下程序的运行结果是( )。main()(int a=2,b=7,c=5;switch(a>0){case 1:switch(b<0){case 1:switch(");break;case 2:printf("!");break;}case 0:switch(c==5){case 0:printf("*");break;case 1:printf("");break;case 2:printf("$");break;}default:printf ("&");}printf("\n");}

考题 publicclassSwitchTest{publicstaticvoidmain(String[]args){System.out.println(value=+switchIt(4));}publicstaticintswitchIt(intx){intj=1;switch(x){case1:j++;case2:j++;case3:j++;case4:j++;case5:j++;default:j++;}returnj+x;}}Whatistheresult?()A.value=3B.value=4C.value=5D.value=6E.value=7F.value=8

考题 publicclassSwitchTest{publicstaticvoidmain(Stringargs){System.out.PrintIn(value=”+switchIt(4));}publicstaticintswitchIt(intx){intj=1;switch(x){case1:j++;case2:j++;case3:j++;case4:j++;case5:j++;default:j++;}returnj+x;}}Whatistheoutputfromline3?()A.Value=3B.Value=4C.Value=5D.Value=6E.Value=7F.Value=8

考题 已知C源程序如下: include include void reverse(char S[]){ int C,i,J; f 已知C源程序如下:include<stdio. h>include<string. h>void reverse(char S[]){int C,i,J;for(i=0,j=strlen(s)-1;i<j;i++,j++){c=s[i];s[i]=s[j];s[j]=c;}}void getHex(int number,char s[]){int I;i=0;while(number>0){if(number%16<10)s[i++]=number%16+'0';elseswitch(number%16){case 10:s[i++]='A';break;case 11:s[i++]='B';break;case 12:s[i++]='C';break;case 13:s[i++]='D';break;case 14:s[i++]='E';break;case 15:s[i++]='F';break;default:printf("Error");break;}number/=16;}s[i]:'\o';reverse(s);}int main(){unsigned int number;int i=0:char s[50];printf("%s","please input number;\n");scanf("%d",&number):getHex(number,s);i=0;while(s[i])printf("%c",s[i++]);return 0;}画出程序中所有函数的控制流程图。

考题 若a,b,c1,c2,x,y均是整型变量,正确的switch语句是______。A.switch(a+b); {case 1:y=a+b;break; case 0:y=a-b;break; }B.switch(a*a+b*b) {case 3; case 1:y=a+b;break; case 3:y=b-a;break; }C.switch a {case c1:y=a-b;break; case c2;x=a*b;break; default:x=a+b; }D.switch(a-b) {default:y=a*b;break; case 3:case 4:x=a+b;break; case 10:case11:y=a-b;break; }

考题 已知:int a,b;下列switch语句中,( )是正确的。A.switdh (a) { case a: a + +;break; case b: b + +;break; }B.switch(a+b) { case 1:a+b;break; case 1:a-b }C.switch(a*a) { case 1,2:+ +a; case 3, 4:+ +b: }D.switch(a/10+b) { cases 5:a/5:break: default:a+b; }

考题 下面程序的运行结果是( )。 define P(A)printf("%d",A)main() {int j,a[]={1,2,3,4,5,6,7},i=5; for(j=3;j>1;j--) {switch(j) {case 1: case 2:P(a[i++]);break; case 3:P(a[--i]); } } }

考题 下列程序的输出的结果是______。 public class exl6 { public static void main(String[] args) { int j=10; for(int i=0;i<3;i++) { j-=i+1; switch (j){ case 3: break; case 5: break; case 8: break; default: j=0;break; } } System,out.println(j); } }A.5B.3C.8D.0

考题 下面这段代码有错误么?switch (i){case():CaseZero();break;case 1:CaseOne();break;case 2:dufault;CaseTwo();break;}

考题 下列程序的输出结果是【】。 include void main() { inta(5),b(6),i(0)1j(0); switch(a 下列程序的输出结果是【 】。include<iostream.h>void main(){inta(5),b(6),i(0)1j(0);switch(a){case 5:switch(b){case 5:i++;break;case 6:j++;break;defaun:i++;j++;}case 6:i++;j++;break;default:i++;j++;}cout<<i<<","<<j<<endl;}

考题 若a、b、c1、c2、x、y均是整型变量,则正确的switch语句是______。A.swich(a+b); { case 1:y=a+b;break; case 0:y=a-b;break; } case 3:y=b-a, break;B.switch(a*a+b*b) { case 3: case 1:y=a+b;break; }C.switch a { case c1:y=a-b;break; case c2:x=a*d;break; default:x=a+b; }D.switch(a-b) { default:y=a*b;break; case 3:case 4:x=a+b;break; case 10:case 11:y=a-b;break; }

考题 若a、b、c1、c2、x、y均是整型变量,则正确的switch语句是( )。A.switch(a+b); { casel:y=a+b;break; case0:y=a-b;break; }B.switch(a*a+b*b) { case 3: case 1:y=a+b;break; case 3:y=b-a;break; }C.switch a {case c1:y=a-b;break; case c2:x=a*d;break; default:x=a+b; }D.switch(a-b) {default:y=a*b;break; case 3:case 4:x=a+b;break; case 10:case 11:y=a—b;break; }

考题 若有定义语句int a,b;double x;则下列选项中没有错误的是( )。A.switch(x%2) {case O:a++;break; case 1:b++;break; default:a++;b++; }B.switch((int)x/2.0) {case O:a++;break; case 1:b++;break; default:a++;b++; }C.switch((int)x%2) {case O:a++;break; case 1:b++;break; default:a++;b++; }D.switch((int)(x)%2) {case 0.O:a++;break; case 1.0:b++;break; default:a++;b++; }

考题 若有定义语句“int a,b;double X;”,则下列选项中没有错误的是( )。A.switch(X%2) { case 0:a++;break; case l:b++;break; default:a++;b++; }B.switch((int)x/2.O) { case 0:a++;break; case l:b++;break; default:a++;b++; }C.switch((int)X%2) { case 0:a++;break; case l:b++;break; default:a++;b++; }D.switch((int)(x)%2) { case 0.0:a++;break; case l.0:b++;break; default:a++;b++; }

考题 下列程序的输出结果是_______。 main() { int i=3; switch(i) { case1: case 2:printf("%d",i) case 3: case 4:break; default : printf("OK") } }A.0B.3C.OKD.没有任何输出

考题 以下程序的运行结果为?class test {public static void main(String args[]) {int i,j=0;for(i=10;iswitch(j) {case (0) : j=j+1;case ( 1、 : j=j+2; break;case ( 2、: j=j+3; break;case (10) : j=j+10; break;default : break;}System.out.println(j);}}A. 0B. 1C. 2D. 3E. 10

考题 public class SwitchTest {  public static void main(String[] args) {  System.out.println(“value = “ + switchIt(4));  }  public static int switchIt(int x) {  int j = 1;  switch (x) {  case 1: j++; case 2: j++;  case 3: j++;  case 4: j++;  case 5: j++;  default: j++;  }  return j + x; }  }  What is the result?()  A、 value = 3B、 value = 4C、 value = 5D、 value = 6E、 value = 7F、 value = 8

考题 单选题public class SwitchTest {   public static void main (String args) {   System.out.PrintIn(“value =” +switchIt(4));   }   public static int switchIt(int x) {   int j = 1;   switch (x) {   case 1: j++;   case 2: j++;   case 3: j++;  case 4: j++;   case 5: j++;   default:j++;   }   return j + x;   }   }   What is the output from line 3? ()A  Value = 3B  Value = 4C  Value = 5D  Value = 6E  Value = 7F  Value = 8

考题 单选题1. public class SwitchTest {  2. public static void main (String []args)  {  3. System.out.PrintIn(“value =” +switchIt(4));  4. }  5. public static int switchIt(int x)  {  6. int j = 1;  7. switch (x) {  8. case 1: j++;  9. case 2: j++;  10. case 3: j++;  11. case 4: j++;  12. case 5: j++;  13. default:j++;  14. }  15. return j + x;  16. }  17. }     What is the output from line 3?()A  Value = 3B  Value = 4C  Value = 5D  Value = 6E  Value = 7F  Value = 8

考题 单选题public class SwitchTest {  public static void main(String[] args) {  System.out.println(“value = “ + switchIt(4));  }  public static int switchIt(int x) {  int j = 1;  switch (x) {  case 1: j++; case 2: j++;  case 3: j++;  case 4: j++;  case 5: j++;  default: j++;  }  return j + x; }  }  What is the result?()A  value = 3B  value = 4C  value = 5D  value = 6E  value = 7F  value = 8

考题 单选题有以下程序:#include main(){ int a[]={2,3,5,4},i; for(i=0;i4;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;i4;i++)printf(%d,a[i]); printf();}程序运行后的输出结果是(  )。A 3344B 2050C 3040D 0304