电科23春《面向对象程序设计》课程在线作业1【标准答案】

作者:周老师 分类: 电子科技大学 发布时间: 2023-03-31 13:07

专业辅导各院校在线、离线考核、形考、终极考核、统考、社会调查报告、毕业论文写作交流等!

联系我们:QQ客服:3326650399   439328128    微信客服①:cs80188     微信客服②:cs80189

              扫一扫添加我为好友                           扫一扫添加我为好友

支付宝微信钱包

20春《面向对象程序设计》在线作业1

试卷总分:100 得分:100

一、单选题 (共 20 道试题,共 80 分)

1.class A {public int getNumber(int a){return a+1;}} class B extends A {public int getNumber(int a, char c){return a+2;} public static void main(String[] args) {B b=new B();System.out.println(b.getNumber(0));} } what is the result?

A.compilation succeeds and 1 is printed

B.compilation succeeds and 2 is printed

C.compilation succeeds and 3 is printed

D.An error at this program cause compilation to fail



2.以下( )束缚符可用于界说成员常量。

A.static

B.final

C.abstract

D.No?modifier?can?be?used



3.在Java的根本数据类型中,int型数据占用( ) 字节内存空间。

A.1

B.2

C.4

D.不能断定,取决于计算机字长



4.Java中main()函数的值是 。

A.String

B.int

C.char

D.void



5.下列常见的系统界说的反常中,( )是输入、输出反常。

A.ClassNotFoundException

B.IOException

C.FileNotFoundException

D.UnknownHostException



6.import java.awt.*;

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=new Button("One"); p1.add(b1);

Panel p2=new Panel();add(p2);

Button b2=new Button("Two"); p2.add(b2);

Button b3=new Button("Three"); p2.add(b3);

Button b4=new Button("Four"); add(b4);

}

}

when the frame is resized,

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



7.下列Java常见事情类中( )是鼠标事情类。

A.InputEvent

B.KeyEvent

C.MouseEvent

D.WindowEvent



8.在运用interface声明一个接口时,只能够运用 润饰符润饰该接口。

A.public

B.protected

C.private和protected

D.private



9.在Java中,用( )关键词界说常量。

A.#define

B.fixed

C.const

D.final



10.下列 润饰符能够使在一个类中界说的成员变量只能被同一包中的类拜访。

A.private

B.public

C.protected

D.无润饰符



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.下列关于接口的叙说中,( )是正确的。

A.接口与笼统类是一样的概念

B.接口之间不能有承继关系

C.一个类只能完成一个接口

D.接口中只富含笼统方法和常量



13.在Java的根本数据类型中,int型数据占用 字节内存空间。

A.1

B.2

C.4

D.不能断定,取决于计算机字长



14.下列句子输出成果为( )。public class A{public static void main(String[]args){byte b=0xa;System.out.println(b);}}。

A.0xa

B.a

C.1

D.10



15.下列 ( )是反常的意义。

A.程序的语法错

B.程序编译或运转中所发作的反常事情

C.程序预先界说好的反常事情

D.程序编译错误



16.下列指令中, 指令是Java的编译指令。

A.javac

B.java

C.javadoc

D.appletviewer



17.class Super{public float getNum(){return 3.0f;}} public class Sub extends Super{ //overload } which method, placed at overload, will cause a compiler error?

A.public float getNum(){return 4.0f;}

B.public void getNum(){}

C.public void getNum(double d){}

D.public double getNum(float d){return 4.0d;}



18.在一个applet符号中,( )符号特点项能够省去不写。

A.code

B.codebase

C.width

D.height



19.已知如下代码: public?class?Test{ static long?a[]?=?new?long[10]; public?static?void?main?(?String?arg[]?)?{ System.out.println?(?a[6]?); } } 则下面 个句子是正确的。

A.Output is null.

B.When compile, some error will occur.

C.Output is 0.

D.When running, some error will occur.



20.下列叙说错误的是

A.Java是一种面向对象的网络编程语言

B.Java Applet程序在网络上载输不受硬软件渠道的约束

C.Java供给了类库撑持TCP/IP协议

D.Java语言答应运用指针拜访内存



二、判别题 (共 5 道试题,共 20 分)

21.Java的屏幕坐标是以像素为单位,容器的左下角被断定为坐标的起点。



22.笼统方法有必要在笼统类中,所以笼统类中的方法都有必要是笼统方法。



23.J2SDK中首要有两个有关环境变量,即path和classpath。前者指定了JDK指令查找途径,后者指定了Java类途径。



24.Java的各种数据类型占用固定长度,与详细的软硬件渠道环境无关。



25.Java语言没有无符号整数类型、指针类型、结构类型、枚举类型、共用体类型。

专业辅导各院校在线、离线考核、形考、终极考核、统考、社会调查报告、毕业论文写作交流等!(非免费)

联系我们:QQ客服:3326650399   439328128    微信客服①:cs80188     微信客服②:cs80189

               扫一扫添加我为好友                           扫一扫添加我为好友

支付宝微信钱包