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

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

3、给定下面程序段,输出结果是()。 int i= 1, j = 0; switch(i){ case 1 : j += 6; case 2 : j += 1; default : j += 2; } System.out.println(j); A.2 B.6 C.7 D.9


参考答案和解析
1 5 9
更多 “3、给定下面程序段,输出结果是()。 int i= 1, j = 0; switch(i){ case 1 : j += 6; case 2 : j += 1; default : j += 2; } System.out.println(j); A.2 B.6 C.7 D.9” 相关考题
考题 以下程序的输出结果是 【 9 】 。#includestdio.hmain(){ int j,a[]={1,3,5,7,9,11,13,15},*p=a+5;for(j=3;j;j--){ switch(j){ case 1:case 2:printf( " %d " ,*p++); break;case 3:printf( " %d " ,*(--p));}}}

考题 以下程序的输出结果是( )。 define PR(ar)printf("ar=%d”,ar) main() {int j,a[]={1,8,3,7,6,13,17,15},*p=a+5; for(j=3;j;j--) switch(j) {case 1: case 2:PR(*p++);break; case 3:PR(*(--p)); } }

考题 以下程序的输出结果是 ( ) 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.值不确定

考题 以下程序的输出结果是【 】。include main() {int j,a[]={1,3,5,7,9,11,13,15},*P=a+5; f 以下程序的输出结果是【 】。include <stdio.h>main(){ int j,a[]={1,3,5,7,9,11,13,15},*P=a+5;for(j=3; j;j-){ switch(i){ case 1:case 2: printf("%d",*p++); break;case 3: printf("%d",* (-p));}}}

考题 以下代码的输出结果是什么? 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

考题 intI=1,j=02.3.switch(i){4.case2:5.j+=6;6.7.case4:8.j+=1;9.10.default:11.j+=2;12.13.case0:14.j+=4;15.}16.Whatisthevalueofjatline16?() A.0B.1C.2D.4E.6

考题 publicclassTest{publicstaticvoidmain(StringArgs[]){inti=1,j=0;switch(i){case2:j+=6;case4:j+=1;default:j+=2;case0:j+=4;}System.out.println(j=”+j);}}Whatistheresult?() A.0B.2C.4D.6E.9F.13

考题 inti=1,j=-1;switch(i){case0,1:j=1;case2:j=2;default;j=0;}System.out.println(j=”+j);Whatistheresult?() A.j=-1B.j=0C.j=1D.j=2E.Compilationfails.

考题 intI=1,j=0switch(i){case2:j+=6;case4:j+=1;default:j+=2;case0:j+=4;}Whatisthevalueofjatline16?() A.0B.1C.2D.4E.6

考题 下面程序的运行结果是( )。 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]); } } }

考题 有以下程序main(){ int n[3],i,j; for(i=0;i3;i++) n[i]=0; for(i=0;i2;i++) for(j=0;j2;j++) n[j]=n[i]+1; printf( "%d\n",n[1]);}程序运行后的输出结果是A.2 B.1C.0 D.3

考题 以下程序的输出结果是()。includemain(){int a[3][3]={0,1,2,0,1,2,0,1,2},i,j,s=1;for 以下程序的输出结果是( )。 #include<stdio.h> main() {int a[3][3]={0,1,2,0,1,2,0,1,2},i,j,s=1; for(i=0;i<3;i++) for(j=i;j<=i;j++) s+=a[i][a[j][j]]; printf("%d\n",s); }A.3B.4C.1D.9

考题 下列程序的输出的结果是______。 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

考题 下列程序的输出结果是【】。 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;}

考题 以下程序的输出结果是()。//includemain(){ int b[3][3]={0,1,2,0,1,2,0,1,2},i,j, t 以下程序的输出结果是( )。 //include<iostream.h> main() { int b[3][3]={0,1,2,0,1,2,0,1,2},i,j, t=1; for(i=0,i<3; i+ +) for(j=i;j<=i; j+ +) t=t+b[i][b[j][j]]; cout<<t; }A.3B.4C.1D.9

考题 下面程序的输出结果是()。include using namespace std;void main( )int i,j,m=0,n=0; 下面程序的输出结果是( )。 #include <iostream> using namespace std; void main( ) int i,j,m=0,n=0; for(i=0;i<2;i++) for(j=0;j<2;j++) if(j> =i) m=1;n++; cout<<m<<endl; cout<<n;A.1 1B.1 4C.1 6D.0 2

考题 以下程序段的输出结果为( )。 int j=2 switch (j){ Case 2: system.out.print("two."): Case 2+1: System.out.println("three."); break: default: System.out.println (“value is”+j): Break }A.B.twoA.two.three.B.twoC.threeD.value is 2

考题 有以下程序:int f(int b[][4]){int i, j, s=0;for(j=0; j2)i=3-j;S+=b[i][j]; 有以下程序: int f(int b[][4]) { int i, j, s=0; for(j=0; j<4; j++) { i=j; if(i>2)i=3-j; S+=b[i][j]; } return s; } main() { int a[4][4]={{1, 2, 3, 4}, {0, 2, 4, 6}, {3, 6, 9, 12}, {3, 2, 1, 0}}; printf("%d\n", f(a)); } 执行后的输出结果是______。A.12B.11C.18D.16

考题 以下程序的运行结果为?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

考题 写出程序的运行结果。 #include main( ) { int i=0,j=0,k=0,m; for ( m=0;m4;m++ ) switch ( m ) { case 0:i=m++; case 1:j=m++; case 2:k=m++; case 3:m++; } printf ("/n%d,%d,%d,%d",i,j,k,m); } 该程序的执行结果是()。A、0,1,2,5B、0,1,2,4C、0,1,1,3D、0,1,2,3

考题 int I=1, j=0   switch(i) {   case 2:   j+=6;   case 4:   j+=1;    default:    j +=2;   case 0:   j +=4;   }   What is the value of j at line 16?()A、 0B、 1C、 2D、 4E、 6

考题 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 Test {  public static void main(String Args[]) {  int i =1, j = 0;  switch(i) {  case 2: j +=6;  case 4: j +=1;  default: j +=2;  case 0: j +=4;  }  System.out.println(“j =” +j);  }  }  What is the result? () A、 0B、 2C、 4D、 6E、 9F、 13

考题 int i = 1,j = -1;  switch (i) {  case 0, 1:j = 1;  case 2: j = 2;  default; j = 0;  }  System.out.println(“j=”+j);  What is the result?()  A、 j = -1B、 j = 0C、 j = 1D、 j = 2E、 Compilation fails.

考题 1. int I=1, j=0  2.    3. switch(i)  {  4. case 2:  5. j+=6;  6.    7. case 4:  8. j+=1;  9.    10. default:  11. j +=2;  12.    13. case 0:  14. j +=4;  15. }  16.      What is the value of j at line 16?()A、 0B、 1C、 2D、 4E、 6

考题 单选题int i = 1,j = -1;  switch (i) {  case 0, 1:j = 1;  case 2: j = 2;  default; j = 0;  }  System.out.println(“j=”+j);  What is the result?()A  j = -1B  j = 0C  j = 1D  j = 2E  Compilation fails.

考题 单选题public class Test {  public static void main(String Args[]) {  int i =1, j = 0;  switch(i) {  case 2: j +=6;  case 4: j +=1;  default: j +=2;  case 0: j +=4;  }  System.out.println(“j =” +j);  }  }  What is the result? ()A  0B  2C  4D  6E  9F  13