h /= j; }
System.out.println(h); }
A59 B 61 C 2 D 1
10.下面程序的输出结果是:( b)。 public static void main(String[] args) { int s = 105; int result = 0; while (s >0) { int m = s % 10; result += m; s /= 10; }
System.out.println(result); } A. 5 B. 6 C. 10 D. 20
11.下列代码的编译运行结果是(d) public static void main(String[] args) { String str = \ str += 42;
System.out.print(str); } A.42 B.420 C.462 D.42042
12.程序编译运行输出的结果为( d) public static void main(String[] args) { int a = 100, b = 200; a = a + b; b = a - b; a = a - b;
System.out.println(a + \}
A. 100,200 B.200,200 C.100,100 D.200,100
13.下列代码出错的行是:( c)
1) public void modify(c) { 2) int i, j, k; 3) i = 100; 4) while ( i > 0 ) { 5) j = i * 2;
6) System.out.println (\7) k = k + 1; 8) i--; 9) } 10) } A. 4 B. 6 C. 7 D. 8
14.编译运行以下程序后,关于输出结果的说明正确的是 (c ):public class Conditional{
public static void main(String args[ ]){ int x=4;
System.out.println(“value is “+ ((4>4) ? 99.9 :9)); } }
A、 输出结果为:value is 99.99 B、 输出结果为:value is 9 C、 输出结果为:value is 9.0 D、 编译错误
15.下列代码编译运行的结果(c ) public static void main(String[] args) { int a = 12,b=13;
if(a++==13 |++b==14){ //按位或
System.out.print(\
}
System.out.println(a+\ }
A.12,13 B.13,13 C.a 13,14 D.a 13,13
16.下列代码编译运行的结果是:d public static void main(String[] args) {
for(1 int i=0; 2 i<10; 3 i++){
i++ }
System.out.println(i);