计算机二级JAVA模拟题4_第3页

考试站(www.examzz.com)   【考试站:中国教育考试第一门户】   2014年7月9日
21.下列方法中,不属于Throwable类的方法是(     )。   
  A.printMessage   
  B.getMessage  
  C.toString   
  D.fillStackTrace  
  22.下列程序的输出结果是(     )。   
  public class Test{  
  public static void main(String[]args){  
  int[]array=(2,4,6,8,lO);   
  int size=6;   
  int result =-1:   
  try{  
  for(int i=0;i(size 8L&result= = -1;)  
  if(array[i]= =20)result=i:   
  }   
  catch(ArithmeticException e){  
  System.out.println("Catch- - -l");   
  }  
  catch(ArraylndexOutOfBoundsException e){  
  System.out.println("Catch- - -2");   
  }  
  catch(Exception e){  
  System.out.println("Catch- - -3");)  
  }  
  }  
  A.Catch- - -1   
  B.Catch- - -2  
  C.Catch- - -3   
  D.以上都不对   
  23.下列包中,包含JOptionPane类的是(     )。   
  A.javax.swing   
  B.java.lang  
  C.java.util   
  D.java.applet  
  24.下列选项中,与成员变量共同构成一个类的是(     )。   
  A.关键字   
  B.方法   
  C.运算符   
  D.表达式   
  25.下列程序的功能是将一个整数数组写入二进制文件,在程序的下画线处应填入的选项是(     )。   
  import java.io.*;   
  public class XieShuzu{  
  public static void main(String[]a){  
  int[]myArray=(10,20,30,40);   
  try{  
  DataOutputStream dos=  
  new DataOutputStream(new  
  FileOutput Stream("ints.dat"));   
  for(int i=0;i  dos.        (myArray[i]);   
  dos.close();   
  System.OUt.println("已经将整数数组写入二进   
  制文件:ints.dat");   
  }catch(IOException ioe)  
  {System.OUt.println("IO Exeepr_on");)  
  }  
  }  
  A.writeArray B.writeByte  
  C.writeInt D.writeDouble  
  26.Java中的抽象类Reader和Writer所处理的流是(     )。   
  A.图像流   
  B.对象流   
  C.字节流   
  D.字符流   
  27.下列叙述中,错误的是(     )。   
  A.内部类的名称与定义它的类的名称可以相同   
  B.内部类可用abstract修饰   
  C.内部类可作为其他类的成员   
  D.内部类可访问它所在类的成员   
  28.用于在子类中调用被重写父类方法的关键字是(     )。  
  A.this   
  B.super  
  C.This   
  D.Super  
  29.下列Java语句从指定网址读取html文件,在下画线处应填上的选项是(     )。   
  Reader in=new——(new URL(urlString).   
  openStream());   
  A.Reader  
  B.DataOutputStream  
  C.ByteArray InputStream  
  D.InputStreamReader  
  30.下列不属于表达式语句的是(     )。   
  A.++i;   
  B.--j;   
  C.b#a;  
  D.b*=a;

相关文章