1. 下列哪个选项是合法的标识符(2分)(B)
A.123 B._name
C.class D.1first
2. 编译运行以下程序后,关于输出结果的说明正确的是(C)
public class Conditional{
public static void main(String args[ ]){
int x=4;
System.out.println(“value is “+ ((x>4) ? 99.9 :9));
}
}
(2分)
A.输出结果为:value is 99.99
B.输出结果为:value is 9
C.输出结果为:value is 9.0
D.编译错误
3. 下面的方法,当输入为2的时候result是多少? (B)
int result = 0;
switch (i) {
case 1:
result = result + i;
case 2:
result = result + i * 2;
case 3:
result = result + i * 3;
}
(2分)
A.0 B.2
C.4 D.10
4. 下列语句的输出结果是()
public class Test {
public static void main(String[] args) {
int x = 1, y = 1, z = 1;
if (x-- == 1 && y++ == z && z++ == 1) {
System.out.println("x=" + x + ",y=" + y + ",z=" + z);
}
}}(2分)

A
x=0,y=2,z=1
B
x=1,y=2,z=1
C
x=0,y=2,z=2
D
没有输出
5.
以下程序调试结果为:
class Base{
Base(){
int i = 100;
System.out.print (i);
}
}
public class Pri extends Base{
static int i = 200;
public static void main(String argv[]){
Pri p = new Pri();
System.out.print(i);
}
}(2分)

A
编译错误
B