System.out.println(\"k2= \"+k2+\" I= \"+I); } }A)k1=true I=1 B)k1=true I=1 k2=true I=2 k2=true I=1 C)k1=true I=1 D)k1=true I=1 k2=false I=1 k2=false I=2
13. 下面程序段运行的结果为( C )。 Public class Quiz2{
public static void main(String args[]){
try {throw new MyException(); }
catch(Exception e){
System.out.println(\"It's caught!\"); }
finally{
System.out.println(\"It's finally caught!\"); } } }
class MyException extends Exception{} A)It's finally caught! B)It's caught! C)It's caught! D)无输出
It's finally caught!
14. 下列代表八进制整数的是( D )。 A)0XA6 B)-1E3 C)1840 D)0144
15. 在完全二叉树的顺序存储中,若节点I有左子女,则其左子女是节点__2i___。 16. 将表中两个相邻元素依次比较,若不符合排序要求,则交换位置。这种排序方法称为_ 冒泡排序____。
17. 结构化程序设计方法的主要原则可以概括为自顶向下,__逐步求精___,模块化,使用goto语句。
18. 软件测试中路径测试是整个测试的基础,它是对软件的__结构___进行测试。 19. 数据模型通常由三部分组成,它们是数据结构、数据操作和__完整性约束___。
20. 创建一个Vector对象myv,初始包含10个元素,写出正确的语句_ Vector myv=new Vector(10);____。
21. 如果要终止线程的运行,使用__stop()___方法。
22. 将按钮btn上的标签文字设置为斜体的14像素的Courier字体,则正确的语句为__ btn.setFont(new Font(\"Courier\。
23. 获取文本区域area1中被用户选中的文字添加在另一个文本区域area2中,则正确的语句为__ area2.append(area1.getSelectedText());___。
24. 工具栏在Swing中是用___ JToolBar__类创建的,它是一个容器,按照行或者列对几个组件进行分组。
25. 下面程序段运行的结果为__ FEDCBA___。 Public class Test{
public static void main(String args[]){ String s=\"ABCDEF\";
for(int I=s.length()-1;I>=0;I--) System.out.print(s.charAt(I));
System.out.println(); } }
26. 下面程序段运行的结果为__ I=1 j=11___。 Public class Test{
public static void main(String[] args){ for(int I=1,j=I+10;I<2;I++,j=I*2) System.out.println(\"I=\"+I+\" j= \"+j); } }
27.下面程序段运行的结果为__ doT saw I was toD___。 Public class StringsDemo{
public static void main(String[] args){ String palindrome=\"Dot saw I was Tod\"; int len= palindrome.length();
StringBuffer dest=new StringBuffer(len); for(int I=(len-1);I>=0;I--){
dest.append(palindrome.charAt(I)); }
System.out.println(dest.toString()); } }
28. 下面程序段的功能是把partnovel.txt的内容传输到target.txt中,这两个文件都在本机的e:\\files中,请将程序补充完整。 Import java.io.*;
public class FileCopy{
public static void main(String[] args)throws IOException{ File inputFile=new File(\"__e://files//partnovel.txt___\"); File outputFile=new File(\"__e://files//target.txt___\"); FileReader in=new FileReader(inputFile); FileReader out=new FileWriter(outputFile); int c;
while((c=in.read())!= -1) out.writer?; in close(); out.close(); } }