读书人

选择题(3)

发布时间: 2012-12-21 12:03:49 作者: rapoo

选择题(三)



?61、下列哪个用户图形界面组件在软件安装程序中是常见的? ?(??? )

?

A.滑块??????????? B.进度条????????? C.对话框????????? D.标签

?

62、 包含可单击按钮的类的Java类库是哪个?

?

A.AWT???????????? B.Swing?????????? C.二者都有??????? D.二者都没有

?

63、下面的哪个用户界面组件不是容器? (??? )

?

A. JScrollPane B. JFrame? C. JWindows?? D. JScrollBar

?

64、在下列事件处理机制中哪个不是机制中的角色?? ( ??)

?

A. 事件   B. 事件源??? C. 事件接口  D. 事件处理者

?

65.欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的 ?( ??)

?

A、 ArrayList myList=new Object(); B、 List myList=new ArrayList();

C、 ArrayList myList=new List();?? D、 List myList=new List();

?

66.paint()方法使用哪种类型的参数? ( ??)

?

A、 Graphics B、 Graphics2D C、 String D、 Color

?

67.指出正确的表达式 ( ??)

?

A、 byte=128; B、 Boolean=null; C、 long l=0xfffL; D、 double=0.9239d;

?

68.指出下列程序运行的结果 ( ??)
public class Example{
  String str=new String("good");
  char[]ch={'a','b','c'};
  public static void main(String args[]){
    Example ex=new Example();
    ex.change(ex.str,ex.ch);
    System.out.print(ex.str+" and ");
    Sytem.out.print(ex.ch);
  }
  public void change(String str,char ch[]){
    str="test ok";
    ch[0]='g';
  }
}

?

A、 good and abc B、 good and gbc C、test ok and abc D、 test ok and gbc

69.运行下列程序, 会产生什么结果 ( ??)
public class X extends Thread implements Runable{
 public void run(){
  System.out.println("this is run()");
 }
 public static void main(String args[])
 {
  Thread t=new Thread(new X());
  t.start();
 }
}

?

A、 第一行会产生编译错误 B、 第六行会产生编译错误

C、 第六行会产生运行错误 D、 程序会运行和启动

70.要从文件" file.dat"文件中读出第10个字节到变量C中,下列哪个方法适合? ( ??)

?

A、 FileInputStream in=new FileInputStream("file.dat"); in.skip(9); int c=in.read();

B、 FileInputStream in=new FileInputStream("file.dat"); in.skip(10); int c=in.read();

C、 FileInputStream in=new FileInputStream("file.dat"); int c=in.read();

D、 RandomAccessFile in=new RandomAccessFile("file.dat"); in.skip(9); int c=in.readByte();

71.容器被重新设置大小后,哪种布局管理器的容器中的组件大小不随容器大小的变化而改变? ( ??)

?

A、 CardLayout B、 FlowLayout C、 BorderLayout D、 GridLayout

72.给出下面代码:
public class Person{
  static int arr[] = new int[10];
  public static void main(String a[])
  {
   System.out.println(arr[1]);
  }
}

那个语句是正确的? ( ??)

A、 编译时将产生错误; B、 编译时正确,运行时将产生错误;

C 、输出零;?????????? D、 输出空。

73.哪个关键字可以对对象加互斥锁? ( ??)

?

A、 transient B、 synchronized C、 serialize D、 static

74.下列哪些语句关于内存回收的说明是正确的? ( ??)

?

A、 程序员必须创建一个线程来释放内存;B、 内存回收程序负责释放无用内存

C、内存回收程序允许程序员直接释放内存?D、内存回收程序可以在指定的时间释放内存对象

75.下列代码哪几行会出错: ( ??)
1) public void modify() {
2) int I, j, k;
3) I = 100;
4) while ( I > 0 ) {
5) j = I * 2;
6) System.out.println (" The value of j is " + j );
7) k = k + 1;
8) I--;
9) }
10} }

?

A、 line 4 B、 line 6 C、 line 7 D、 line 8

?

76.MAX_LENGTH是int型public成员变量, 变量值保持为常量100,用简短语句定义这个变量。 ( ??)

?

A、 public int MAX_LENGTH=100;???????? B、 final int MAX_LENGTH=100;

C、 final public int MAX_LENGTH=100;?? D、 public final int MAX_LENGTH=100.

77.给出下面代码:
  1) class Parent {
  2} private String name;
  3} public Parent(){}
  4} }
  5) public class Child extends Parent {
  6} private String department;
  7} public Child() {}
  8} public String getValue(){ return name; }
  9} public static void main(String arg[]) {
  10} Parent p = new Parent();
  11} }
  12} }
  那些行将引起错误? ( ??)

A、 第3行 B、 第6行 C、 第7行 D、 第8行

78.类Teacher和Student是类Person的子类;
   Person p;
   Teacher t;
   Student s;
   //p, t and s are all non-null.
   if(t instanceof Person) { s = (Student)t; }
  最后一句语句的结果是: ( ??)

?

A、 将构造一个Student对象; B、 表达式是合法的;

C、 表达式是错误的;??????? D、 编译时正确,但运行时错误。

79.给出下面代码段
  1) public class Test {
  2} int m, n;
  3} public Test() {}
  4} public Test(int a) { m=a; }
  5} public static void main(String arg[]) {
  6} Test t1,t2;
  7} int j,k;
  8} j=0; k=0;
  9} t1=new Test();
  10} t2=new Test(j,k);
  11} }
  12} }
  哪行将引起一个编译时错误?( ??)

?

A、 line 3 B、 line 5 C、 line 6 D、 line 10

80.对于下列代码:
  1) class Person {
  2} public void printValue(int i, int j) {//... }
  3} public void printValue(int i){//... }
  4} }
  5) public class Teacher extends Person {
  6} public void printValue() {//... }
  7} public void printValue(int i) {//...}
  8} public static void main(String args[]){
  9} Person t = new Teacher();
  10} t.printValue(10);
  11} }
  第10行语句将调用哪行语句? ( ??)

?

A、 line 2 B、 line 3 C、 line 6 D、 line 7

81.哪个关键字可以抛出异常? ( ??)

A、 transient?????? B、 finally C、 throw D、 static

82.Main()方法的返回类型是: ( ??)

A、 int????????? B、 void??? C、 boolean??? D、 static

83.System类在哪个包中? (??? )

?

A、 java.util??????B、 java.io???? C、 java.awt?? D、 java.lang

84.对于下列代码:
  public class Parent {
   public int addValue( int a, int b) {
     int s;
     s = a+b;
     return s;
   }
  }
  class Child extends Parent {
  }
 下述哪些方法可以加入类Child? ( ??)

A、 int addValue( int a, int b ){// do something...}

B、 public void addValue (int a, int b ){// do something...}

C、 public int addValue( int a ){// do something...}

D、 public int addValue( int a, int b )throws MyException {//do something...}

85.给出下面代码:
  public class test{
   static int a[] = new a[10];
   public static void main(String args[]) {
    System.out.println(arr[10]);
   }
  }
那个选项是正确的? ( ??)

A、 编译时将产生错误;???? B、 编译时正确,运行时将产生错误;

C、 输出零;?????????????? D、 输出空。

86.下面哪些选项是正确的main方法说明? (??? )

A、 public main(String args[])

B、 public static void main(String args[])

C、 private static void main(String args[])

D、 void main()

87.给定下面的代码片段:
  1) String str = null;
  2) if ((str != null) && (str.length() > 10)) {
  3} System.out.println("more than 10");
  4} }
  5) else if ((str != null) & (str.length() < 5)) {
  6} System.out.println("less than 5");
  7} }
  8) else { System.out.println("end"); }
哪些行会导致错误? ( ??)

?

A、 line 1?? B、 line 2? C、 line 5? D、

line 8

88.下面哪种注释方法能够支持javadoc命令: ( ??)

?

A、 /**...**/? B、 /*...*/?? C、 //?? D、

/**...*/

89. 欲编写如下图的一个界面,用于显示用户指定的图像: 如果在区域A中只能放置一个AWT组件,从各组件的本来功能角度考虑,最好使用哪种组件:
选择题(3)

?

A、 TextArea??? B、 Panel??? C、 Applet?? D、 Canvas

90. 界面如上题所示。若"Button1"的功能是:点击后弹出一个用于输入的界面,获取用户想要显示的图像文件名,则该界面最好是(从编程简单和程序不易出错的角度考虑):

A、 模式(Modal)Dialog??? B、 非模式(None-modal)Dialog
C、 FileDialog???????????????????? D、 Frame

91. 界面如上题所示。如果在A区域使用某种AWT组件(java.awt.Component的子类)来负责绘制图像,则绘图的语句最好应放在该组件的哪个方法中(考虑到应用程序和Java虚拟机的AWT线程都会要求重画该组件)? ( ??)

A、 构造方法 B、 paint(Graphics g) C、 update(Graphics g) D、 repaint()

读书人网 >编程

热点推荐