以下程序段的输出结果为 ( )int j=2;switch(j){case 2:System.out.print("two.");case 2+1:System.out.println("three.");breakdefault:System.out.println("value is"+j);break;}
A.two.three.
B.two.
C.three.
D.value is 2
以下程序的输出结果是 【 9 】 。#include<stdio.h>main(){ 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));}}}
点击查看答案
以下代码的输出结果是什么? 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.编译错误
以下程序的输出结果是#include <stdio.h>main(){ 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)); } }}
以下程序段的输出结果为( )。 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 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);A.6B.1C.2D.4
写出以下程序的运行结果: main() {int i,j=4; for(i=j;i<=2*j;i++) switch(i/j) {case 0: case 1: printf(“*”);break; case 2: printf(“#”); } }
10、给定Java代码片断,如下: int i=0,j=-1; switch(i) { case 0,1:j=1; case 2:j=2; } System.out.print("j="+j); 编译运行,正确的结果是()。A.程序编译出错B.j=1C.j=2D.j=0