电科18秋《JAVA程序设计》在线作业3【答案】

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2018-09-30 00:13

18春《JAVA程序设计》在线作业3-0001 试卷总分:100 得分:0 一、 单选题 (共 20 道试题,共 80 分) 1.实现下列 接口可以对TextField对象的事件进行监听和处理。 A.ActionListener B.FocusListener C.MouseMo
18春《JAVA程序设计》在线作业3-0001
试卷总分:100    得分:0
一、 单选题 (共 20 道试题,共 80 分)
1.实现下列 接口可以对TextField对象的事件进行监听和处理。
A.ActionListener
B.FocusListener
C.MouseMotionListener
D.WindowListener
 
 
2.下列 是Java的调试器,如果编译器返回程序代码的错误,可以用它对程序进行调试。
A.java.exe
B.javadoc.exe
C.jdb.exe
D.javaprof.exe
 
 
3.容器Panel和Applet默认使用的布局管理器是
A.CardLayout
B.BorderLayout
C.FlowLayout
D.GridLayout
 
 
4.下列语句输出结果为 。public class A{public static void main(String[]args){byte b=0xa;System.out.println(b);}}
A.0xa
B.a
C.1
D.10
 
 
5.Give the following java class: public class Example {public static void main(String args[]) {int x[] = new int[15];System.out.println(x[5]);} } Which statement is corrected?
A.When compile, some error will occur.
B.When run, some error will occur.
C.Output is zero.
D.Output is null.
 
 
6.Which modifer should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object?
A.static
B.final
C.const
D.abstract
 
 
7.下列 不是Java的保留字。
A.do
B.double
C.sizeof
D.while
 
 
8.类是所有异常类的父类。
A.Throwable
B.Error
C.Exception
D.AWTError
 
 
9.若在某一个类定义中定义有方法:abstract void f();则该类是
A.public类
B.final类
C.抽象类
D.不能确定
 
 
10.A class design requires that a member variable should be accessible only by same package, which modifer word should be used?
A.protected
B.public
C.no modifer
D.private
 
 
11.public class X extends Frame{ public static void main(String[] args){ X x=new X();x.pack();x.setVisible(true); } public X(){ setLayout(new GridLayout(2,2)); Panel p1=new Panel(); add(p1); Button b1
A.all change height and width
B.Button One change height
C.Button Two change height and Button Three change width
D.Button Four change height and width
 
 
12.Thread类的方法中,toString()方法的作用是
A.只返回线程的名称
B.返回当前线程所属的线程组的名称
C.返回当前线程对象
D.返回线程的字符串信息
 
 
13.构造方法在 时候被调用。
A.类定义时
B.创建对象时
C.调用对象方法时
D.使用对象的变量时
 
 
14.如下 方法可以将MenuBar加入Frame中。
A.setMenu()
B.setMenuBar()
C.add()
D.addMenuBar()
 
 
15.下列常见的系统定义的异常中, 是数组下标越界异常。
A.ArithmeticException
B.IOException
C.ArrayIndexOutOfBoundsException
D.NullPointerException
 
 
16.下列关于接口的叙述中, 是正确的。
A.接口与抽象类是相同的概念
B.接口之间不能有继承关系
C.一个类只能实现一个接口
D.接口中只含有抽象方法和常量
 
 
17.下列叙述中, 是正确的。
A.类是变量和方法的集合体
B.数组是无序数据的集合
C.抽象类可以实例化
D.类成员数据必须是公有的
 
 
18.在Java中,用 关键字定义常量。
A.define
B.fixed
C.const
D.final
 
 
19.有类定义:abstract class A{public abstract void f();}下面关于该类的描述中正确的是
A.该类可以用new A();实例化一个对象
B.该类不能被继承
C.该类的方法不能被重载
D.以上说法都不对
 
 
20.若要抛出异常,应该使用下列 子句。
A.catch
B.throw
C.try
D.finally
 
 
二、 判断题 (共 5 道试题,共 20 分)
1.( )final类中的属性和方法都必须被final修饰符修饰。
A.错误
B.正确
 
 
2.( )有的类定义时可以不定义构造函数,所以构造函数不是必需的。
A.错误
B.正确
 
 
3.( )用“+”可以实现字符串的拼接,用“-”可以从一个字符串中去除一个字符子串。
A.错误
B.正确
 
 
4.( )Java的屏幕坐标是以像素为单位,容器的左下角被确定为坐标的起点。
A.错误
B.正确
 
 
5.( )字符串分为两大类,一类是字符串常量,使用StringBuffer类的对象表示;另一类是字符串变量,使用String类的对象表示。
A.错误
B.正确
 
Tag:  

作业咨询:
点击这里给我发消息

论文咨询:
点击这里给我发消息

合作加盟:
点击这里给我发消息

服务时间:
8:30-24:00(工作日)