网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
多选题
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
0
B
1
C
2
D
4
E
6
参考答案
参考解析
解析:
暂无解析
更多 “多选题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?()A0B1C2D4E6” 相关考题
考题
下列程序的输出结果是()。 include main() {int a=0,i; for(i=1;i
下列程序的输出结果是( )。#include<stdio.h>main(){ int a=0,i;for(i=1;i<5;i++){ switch(i){ case 0:case 3:a+=1;case 1:case2:a+=2;default:a+=3;}}printf("%d",a);}A.19B.18C.6D.8
考题
下列程序段选择项,使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;
考题
下列程序的输出结果是( )。 #includestdio.h main( ) { int a=0,i; for(i=1;i5;i++) { switch(i) { case 0: case 3:a+=1; case 1: case 2:a+=2; default:a+=3; } } printf("%d",i); }A.19B.1C.6D.8
考题
下列程序的输出结果是()。includemain(){int a=0,i; for(i=1;i
下列程序的输出结果是( )。 #include<stdio.h> main() { int a=0,i; for(i=1;i<5;i++) { switch(i) { case 0: case 3:a+=1; case 1: case 2:a+=2; default:a+=3; } printf("%d",A) ; }A.19B.18C.6D.8
考题
以下程序的输出结果是()。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
考题
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=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]); } } }
考题
有以下程序: void sort(int a[],int n) { int i,j,t; for(i=0;i<n-1;i+=2) for(j=i+2; j<n;j+=2) if(a[i]<a [j]){t=a[i];a[i]=a[j];a[j]=t;} } main( ) { int aa[10]=(1,2,3,4,5,6,7,8,9,10),i; sort(aa,10); for(i=0;i<10;i++) printf("%d",aa[i]); printf("\n"); } 其输出结果是 ______。A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2.,1,C.9,2,7,4,5,6,3,8,1,10,D.1,10,3,8,5,6,7,4,9,2,
考题
下列程序的输出的结果是______。 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;}
考题
以下程序的输出结果为( )。 public class Main { public static void main(String[] args) { int i=0, j=0, a=6; if((++i>0)||(++j>0)) a++; System.out.println( "i=" +i+", j ="+j+", a="+A; } }A.i=0, j=0, a=6B.i=1, j=1, a=7C.i=1, j=0, a=7D.i=0, j=1, a=7
考题
下列程序的输出结果是( )。 #includestdio.h main { int a=0,i; for(i=1;i5;i++) { switch(i) { case 0: case 3:a+=1; case 1; case 2:a+=2; default:a+=3; } } printf("%d",a); }A.19B.1C.6D.8
考题
下列程序的输出结果是 ( ) 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+ +; printf("%d\n",n); }A.4B.2C.1D.0
考题
有以下程序:includevoid sort(int a[],int n){int i,j,t; for(i=0;i
有以下程序: #include <stdio.h> void sort(int a[],int n) { int i,j,t; for(i=0;i<n-1;i+=2) for(j=i+2;j<n;j+=2) if(a[i]<a[j]){t=a[i];a[i]=a[j];a[j]=t;} } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa,10); for(i=0;i<10;i++) printf("%d.",aa[i]); printf("\n"); } 其输出结果是( )。A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2,1,C.9,2,7,4,5,6,3,8,1,10,D.1,10,3,8,5,6,7,4,9,2,
考题
下列程序的输出结果是( )。#includestdio.hmain{ int a=0,i;for(i=1;i5;i++){ switch(i){ case 0:case 3:a+=1;case 1;case 2:a+=2;default:a+=3;}}printf(%d,a);}A.19B.1C.6D.8
考题
1. public class Target { 2. private int i = 0; 3. public int addOne() { 4. return ++i; 5. } 6. } And: 1. public class Client { 2. public static void main(String[] args) { 3. System.out.println(new Target().addOne()); 4. } 5. } Which change can you make to Target without affecting Client?() A、 Line 4 of class Target can be changed to return i++;B、 Line 2 of class Target can be changed to private int i = 1;C、 Line 3 of class Target can be changed to private int addOne() {D、 Line 2 of class Target can be changed to private Integer i = 0;
考题
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 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. public class test ( 2. public static void main(string args[]) { 3. int 1= 0; 4. while (i) { 5. if (i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. ) What is the value of i at line 10?()A、 0B、 3C、 4D、 5E、 The code will not compile.
考题
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.
考题
单选题1. public class ForBar { 2. public static void main(String []args) { 3. int i = 0, j = 5; 4. tp: for (;;) { 5. i ++; 6. for(;;) 7. if(i --j) break tp; 8. } 9. system.out.printIn(“i = ” + i + “, j = “+ j); 10. } 11. } What is the result?()A
The program runs and prints “i=1, j=0”B
The program runs and prints “i=1, j=4”C
The program runs and prints “i=3, j=4”D
The program runs and prints “i=3, j=0”E
An error at line 4 causes compilation to fail.F
An error at line 7 causes compilation to fail.
考题
单选题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
考题
单选题1. public class test ( 2. public static void main(string args[]) { 3. int 1= 0; 4. while (i) { 5. if (i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. ) What is the value of i at line 10?()A
0B
3C
4D
5E
The code will not compile.
考题
单选题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
热门标签
最新试卷