- 39
- 0
- 约9.92千字
- 约 8页
- 2023-06-29 发布于山东
- 举报
好学近乎知,力行近乎仁,知耻近乎勇。——《中庸》
《JAVA 语言程序设计》期末考试试题及答案 4 (应考
必备题库)
一、单选题
1、下列程序段执行后的结果是( ) 。
String s = new String(abcdefg);
for (int i=0; is.length(); i+=2){
System.out.print(s.charAt(i));
}
A) aceg B) ACEG C) abcdefg D) abcd
二、单选题
1、下列程序段执行后的结果是( ) 。
String s = new String(abcdefg);
for (int i=0; is.length(); i+=2){
System.out.print(s.charAt(i));
}
B) A) aceg B) ACEG C) abcdefg D) ab
2 、有整型数组:int[] x={12,35,8,7,2};,则调用方法 Arrays.sort(x)后,数组 x 中
的元素值依次是( ).
A) 2 7 8 12 35 B) 12 35 8 7 2
C) 35 12 8 7 2 D) 8 7 12 35 2
3 、下面的程序段创建了 BufferedReader 类的对象 in ,以便读取本机 c 盘 my 文
献夹下的文献 1.txt。File 构造函数中对的的途径和文献名的表达是( ) 。
File f = new File( 填代码处);
file =new FileReader(f);
in=new BufferedReader(file);
百川东到海,何时复西归?少壮不尽力,老大徒伤悲。——汉乐府《长歌行》
吾日三省乎吾身。为人谋而不忠乎?与朋友交而不信乎?传不习乎?——《论语》
A) ./1.txt B) ../my/1.txt C) c:\\my\\1.txt D) c:\ my\1.txt
4 、应用程序的main 方法中有以下语句,则输出的结果是 ( ) 。
String s1=new String(abc);
String s2=new String(abc);
boolean b1=s1.equals(s2);
boolean b2=(s1==s2);
System.out.print(b1+ +b2);
A)true false B) false true C) true true D)false false
5 、应用程序的main 方法中有以下语句,则输出的结果是 ( ) 。
Hashtable hashtable=new Hashtable();
hashtable.put(x,12345);
hashtable.put(y,67890);
hashtable.put(a
原创力文档

文档评论(0)