第一范文网 - 专业文章范例文档资料分享平台

Java程序设计预赛模拟题-6

来源:用户分享 时间:2025/5/25 18:28:24 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

45.在上题中,Beta类被称为▁▁类。

A.超类 B.子类 C.系统

D.用户自定义

46.一个▁▁类的对象可以当作相应的▁▁类对象看待。

A.子 系统

B.用户 系统 C.子 超 D.超 用户 47.请看下面的代码

1.class Example { 2. String str;

3. public Example( ){ 4. str = “example”; 5. }

6. public Example(String s){ 7. str = s; 8. }

9..}

10.class Demo extends Example {

11.}

12.public class Test{ 13. public void f(){

14. Example ex = new Example(“good”); 15. Demo d = new Demo(“Good”); 16. }

17.}

那一行将导致发生错误: A.3 B.6 C.10 D.14 E.15

48.请看下面的代码

public class Example{

String str = new String(“hello”); Char ch[ ]={‘d’,’b’,’c’};

public static void main(String args[ ]){ Example ex=new Example( ); ex.change(ex.str,ex.ch);

System .out .println(ex.str +“and”+ex.ch); }

public void change(String str,char ch[ ]){

str=”world”; ch[0]=’a’; } }

该程序的输出结果是: A.hello dbc B.hello abc C.world dbc D.world abc 49.下面选项正确的是:

A.String temp[ ]= new String{“j””a””z”}; B.String temp[ ]= {“j””a””z”}; C.String temp= {“j”,”a”,”z”}; D.String temp[ ]= {“j”,”a”,”z”}; 50.▁▁块可以防止资源泄露。

A.finally

B.catch

C.finally或catch D.任意

51.下面选项中的异常处理不是Java中预定以好的:

A.ArithmeticException

B.NullPointerException C.SecurityException

D.ArrayOutOfLengthException E. NegativeArraySizeException 52.用什么来声明一个出来处理:

A.try

B.catch C.throw D.finally

53、下列哪一种布局管理器将容器分为“东、西、南、北、中”五个部分?( )

A. FlowLayout B. BorderLayout C. GridLayout D. CardLayout E. GridBagLayout 54、关于Applet的生命周期正确的说法有( )。

A. init()方法在start()方法之后执行 B. init()方法可执行多次 C. stop()方法在Applet退出时被调用,只调用一次

D. stop()方法在Applet不可见时被调用,可以被调用多次

55、实现下列哪个接口可以对 TextField 对象的事件进行监听和处理? ( )

A. MouseMotionListener B. FocusListener C. ActionListener D. WindowListener 56、监听事件和处理事件( )。 A. 都由 Listener 完成 B. 由 Listener 和窗口分别完成

C. 由 Listener 和组件分别完成 D. 都由相应事件 Listener 处登记过的组件完成 57、下面语句正确的是:( )

A. RandomAccessFile raf = new RandomAccesssFile(“myfile.txt”,”rw”) B. RandomAccessFile raf = new RandomAccesssFile(new DataInputStream())

C. RandomAccessFile raf= new RandomAccesssFile(“myfile.txt”)

D. RandomAccessFile raf = new RandomAccesssFile(new File(“myfile.txt”)) 58、( )类是java.lang包中的一个专门用来创建线程和对线程进行操作的类。

A. Runnable B. Thread C. Synchronized 59、Java Application程序执行的入口是( )方法。 A.init() B. main() C.stop() D.start() 60、Java Applet程序执行的入口是( )方法。

A.init() B. main() C.stop() D.start() 二、多重选择题(2*20,共计40分) 1.请看下面的程序代码:

switch(n) {

case 0: System .out .println(“first”); case 1:

case 2: System .out .println(“second”); break; default: System .out .println(“end”); }

当n为何值时,程序段将输出字符串second: A.0 B.1 C.2

D.3

2.数组元素之所以相关,是因为它们具有相同的▁▁。

A.名字 B.类型

C.下标 D.地址

3.请看下面的程序段

public class Person{ String name;

int age;

public Person(String n,int a) { name=n; age=a;}

public static void main(String arg[ ]){ //point x }

}

下面选项可以添加到//point x处: A.Person p[ ]=new Person[3]; P[1]=new Person(“user1”;24); B.Person p[ ]; P=new Person[3];

P=new Person(“user2”;56);

C.Person p[ ]={ new Person(“user1’,34),(“user2”,34)} D.Person p[ ]=new Person{(“user1’,34),(“user2”,34)} 4.请看下面的程序段

public class Test{ String s;

int m;

public Test(String t ,int n){ s=t;m=n; }

public static void main(String arg[ ]){ Test t[ ]={ new Test(“abc”,3); new Test(“ddf”,23) }; //point x }

}

下面选项可以添加到//point x处:

A.System .out .println(“the value is”+t[3].s); B.System .out .println(“the value is”+t[2].m); C.System .out .println(“the value is”+t[1].s); D.System .out .println(“the value is”+t[1].m); 5.下面那一个不是Java的关键字:

A. TRUE B. sizeof C. const D. super E. void

6.下面语句书写错误的是:

A.String s = “Gone with the wind”; String t = “good”;

String k = s + t;

B.String s = “Gone with the wind”; String t;

t = s[3] + “one”;

C.String s = “Gone with the wind”; String standard = s.toUpperCase( ); D.String s = “home directory”; String t = s - “directory”; 7.请看下面的代码

String s = “hello”; String t = “hello”;

String c[ ] = {‘h’,’e’,’l’,’l’,’o’}; 下面哪一选项的语句返回值为真: A.s .equals(t);

搜索更多关于: Java程序设计预赛模拟题-6 的文档
Java程序设计预赛模拟题-6.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c6qdxv6vd4n9emep57bop_3.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top