13.下面哪一句是关于非静态的内部类正确的描述?
A.It must implement an interface.
B.It can access private instance variables in the enclosing object.
C.It is accessible from any other class.
D.It can only be instantiated in the enclosing class.
E.It must be final if it is declared in a method scope.
14.以下关于Java的局部内部类的说法错误的是( A )
A.局部内部类只能在当前类中使用
B.局部内部类不能包含静态成员
C.局部内部类可以访问外部类的所有成员
D.在局部内部类中定义的内部类不能被private修饰符修饰
16.下面哪个函数是public void aMethod(){…}的重载函数?( D )
A.void aMethod( ){…}
B.public int aMethod(){…}
C.public void aMethod ( ){…}
D.public int aMethod ( int m){…}
17.Which keyword is used to make a class definition include the non-private attributes and behaviors of a parent class, as well as additional attributes and behaviors that are specific to the class being defined?
A.extends
B.super
C.inheritance
D.finalizer
19.A JavaFX action event handler is an instance of _ A _.
A.EventHandler< ActionEvent>
B.EventHandler
C.ActionEvent
D.Action
20.A JavaFX event handler for event type T is an instance of _ A _.
A.EventHandler < T >
B.ActionEvent
C.Action
D.EventHandler
21.To handle the mouse click event on a pane p, register the handler with p using _ A _.
A. p.setOnMouseClicked(handler);
B. p.setOnMouseReleased(handler);
C. p.setOnMouseDragged(handler);
D. p.setOnMousePressed(handler);
22.Suppose A is an anonymous inner class in Test. A is compiled into a file named _ D _.
A. A.class
B. Test$A.class
C. A$Test.class
D.Test$1.class
E.Test&1.class
23.To place two nodes node1 and node2 in a HBox p, use _.
A. p.addAll(node1, node2);
B. p.add(node1, node2);
C. p.getChildren().addAll(node1, node2);
D. p.getChildren().add(node1, node2);
24.Suppose a JavaFX class has a binding property named weight of the type DoubleProperty. By convention, which of the following methods are defined in the class?
A.public double getWeight()
B.public DoubleProperty weightProperty()
C.public DoubleProperty WeightProperty()
D.public void setWeight(double v)
E.public double weightProperty()
25.To add a node to the the first row and second column in a GridPane pane, use _ D _.
A. pane.getChildren().add(node, 1, 2);
B. pane.add(node, 1, 2);
C. pane.getChildren().add(node, 0, 1);
D. pane.add(node, 1, 0);
E. pane.add(node, 0, 1);
26.If this source code is contained in a file called SmallProg.java, what command should be used to compile it using the JDK? ( B )
27.如果需要从文件中读取数据,则可以在程序中创建哪一个类的对象( A )。
A.FileInputStream
B.FileOutputStream
C.DataOutputStream
D.FileWriter
28.Which of the following computer components are referred to as hardware?
A.monitor, keyboard, and programs
B.mouse, CPU, and programs
C.monitor, CPU, and keyboard
D.keyboard, programs, and mouse
29.What kind of reader do you use to handle Character code? ( A )
A.Reader
B.Writer
C.PrintWriter
D.InputStreamReader
30.Object of which class below can be real parameter of constructor of DataInputStream?( C )
A.File
B.String
C.FilterInputStream
D.FileOutputStream
31.Below is the function header for write() in OutputStream
voidwrite(int b)
1
. Now given code below, what would be the size and the content of the output file?
int i=0xcafebabe;
FileOutputStream out =newFileOutputStream("output");
out.write(i);
1
2
3
A. 1 byte and 0xbe
B. 1 byte and 0xca
C. 4 bytes as 0xcafebabe
D. 4 bytes as 0xbebafeca
32.For InputStream.read(), the read() with no parameters, which statement below is correct?
A. read() returns int, because it has to return EOF to indicate the end of the file
B. read() returns byte, because it reads a byte from the stream
C. read() returns char, because it reads a char from the stream
D. read() returns int, as the number of bytes it just read
33.Given:
voidwrite()throws IOException {
DataOutputStream out =newDataOutputStream(newBufferedOutputStream(newFileOutputStream(newFile("data.out"))));
out.writeInt(123456);
out.close();}
1
2
3
4
5
6
7
8
After executing the function, the size of the file “data.out” is:
A. 4
B. 6
C. 7
D. Depends on the OS
34.以下哪个关键字可以用来给对象加互斥锁?( B )
A.transient
B.synchronized
C.serialize
D.static
35.Which method you define as the starting point of new thread in a class from which new the thread can be excution? ( B )
A.public void start()
B.public void run()
C.public void int()
D.public static void main(String args[])
36.下列哪个一个操作不能使线程从等待阻塞状态进入对象阻塞状态( A )。
A.等待阻塞状态下的线程被notify()唤醒
B.等待阻塞状态下的纯种被interrput()中断
C.等待时间到
D.等待阻塞状态下的线程调用wait()方法
37.下列说法中错误的一项是( C )。
A.一个线程是一个Thread类的实例。
B.线程从传递给纯种的Runnable实例run()方法开始执行。
C.新建的线程调用start()方法就能立即进入运行状态.
D.线程操作的数据来自Runnable实例
38.对于类与对象的关系,以下说法错误的是( D )。
A.类是对象的类型
B.对象由类来创建
C.类是同类对象的抽象
D.对象是创建类的模板
39.以下关于继承的叙述正确的是( A )。
A.在Java中类只允许单一继承
B.在Java中一个类只能实现一个接口
C.在Java中一个类不能同时继承一个类和实现一个接口
D.在Java中接口只允许单一继承