JAVA 考试试卷(带答案) 高博java培训S1阶段考试试卷
一.选择题(每题2分,共40分)
1、给定下列代码:??
if(x>4){ ?? System.out.println("Test 1");
}else if (x>9){ ?? System.out.println("Test 2");
}else { ?? System.out.println("Test 3"); } ??
要使输出为"Test 2",则x的范围是: ?? A.x<4 B.x>4 C.x>9 D.不存在 2、main()方法的返回类型是?
A. intB. voidC. BooleanD. static E. Object 3、运行下列程序,输出为何? public class Qd803 {
public static void main(String args[]) { String word = "restructure";
System.out.println(word.substring(2, 3)); } }
A.estB.esC.strD.stE.s
4、代码System.out.println(""+11+1); 的输出结果是: A.(空) B.11 C.12 D.111 5、十进制数16的16进制表示格式是____。
A、0x10 B、0x16 C、0xA D、016
6、对于垃圾回收机制(Garbage Collection)的说明,下面哪个叙述是正确的? A. 程序开发者必须编写线程来负责对内存空间的释放。
B. 垃圾回收机制会检查并释放那些不再需要使用的内存空间。 C. 垃圾回收机制允许程序开发者直接立即释放内存空间。
D. 垃圾回收机制可设定在预期的时间内释放被Java对象所使用的内存空间。 7、有一个类(class)如下:
1. class Test {
2. void test(int i) {
3. System.out.println(“I am an int.”); 4. }
5. void test(String s) {
6. System.out.println(“I am a string.”); 7. } 8.
9. public static void main(String args[]) { 10. Test t=new Test(); 11. char ch='y'; 12. t.test(ch);
搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新人文社科java S1阶段测试全文阅读和word下载服务。
相关推荐: