已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
私 立 华 联 学 院 试 题 200_200_ _学年度 第_ _学期( 卷)课程名称 JAVA语言程序设计课程代码 任课教师尹 菡系(部)主任签字 学号 考生姓名 系别计算机科学与技术 班级 -题号一二三四五六七八九十总 分得分一、选择题(本题共20小题,每题2分,共40分)1欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的 ( )A、 ArrayList myList=new Object(); B、 List myList=new ArrayList(); C、 ArrayList myList=new List(); D、 List myList=new List();2paint()方法使用哪种类型的参数 ( )A、 Graphics B、 Graphics2D C、 String D、 Color3指出正确的表达式 ( )A、 byte=128; B、 Boolean=null; C、 long l=0xfffL; D、 double=09239d; 4指出下列程序运行的结果 ( )public class Example String str=new String(good); charch=a,b,c; public static void main(String args) Example ex=new Example();exchange(exstr,exch); Systemoutprint(exstr+ and ); Sytemoutprint(exch); public void change(String str,char ch) str=test ok; ch0=g; A、 good and abc B、 good and gbc C、test ok and abc D、 test ok and gbc 5运行下列程序, 会产生什么结果 ( )public class X extends Thread implements Runable public void run() Systemoutprintln(this is run(); public static void main(String args) Thread t=new Thread(new X(); tstart(); A、 第一行会产生编译错误 B、 第六行会产生编译错误 C、 第六行会产生运行错误 D、 程序会运行和启动 6要从文件 filedat文件中读出第10个字节到变量C中,下列哪个方法适合? ( )A、 FileInputStream in=new FileInputStream(filedat); inskip(9); int c=inread(); B、 FileInputStream in=new FileInputStream(filedat); inskip(10); int c=inread(); C、 FileInputStream in=new FileInputStream(filedat); int c=inread(); D、 RandomAccessFile in=new RandomAccessFile(filedat); inskip(9); int c=inreadByte(); 7容器被重新设置大小后,哪种布局管理器的容器中的组件大小不随容器大小的变化而改变? ( )A、 CardLayout B、 FlowLayout C、 BorderLayout D、 GridLayout 8给出下面代码: public class Person static int arr = new int10;public static void main(String a) Systemoutprintln(arr1); 那个语句是正确的? ( )A、 编译时将产生错误; B、 编译时正确,运行时将产生错误; C 、输出零; D、 输出空。 9下列那个是反斜杠的正确表示?( )A、 B、 * C、 D、 10下列哪些语句关于内存回收的说明是正确的? ( )A、 程序员必须创建一个线程来释放内存; B、 内存回收程序负责释放无用内存 C、内存回收程序允许程序员直接释放内存 D、内存回收程序可以在指定的时间释放内存对象 11下列代码哪几行会出错: ( )1) public void modify() 2) int I, j, k; 3) I = 100; 4) while ( I 0 ) 5) j = I * 2; 6) Systemoutprintln ( 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 812MAX_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 13给出下面代码: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行14类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、 编译时正确,但运行时错误。 15给出下面代码段 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 16对于下列代码: 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) tprintValue(10); 11) 第10行语句将调用哪行语句?( )A、 line 2 B、 line 3 C、 line 6 D、 line 717哪个关键字可以抛出异常? ( )A、 transient B、 finally C、 throw D、 static 18Main()方法的返回类型是: ( )A、 int B、 void C、 boolean D、 static 19( )布局管理器使容器中各个构件呈网格布局,平局占据容器空间。A、 FlowLayout B、 CardLayout C、 GridLayout D、 BorderLayout 20对于下列代码: 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二、填空(本题共10空,每空2分,共20分)1如果一个java源程序文件中定义有4个类,使用sun公司的JDK编译器javac编译该源程序文件将产生_个文件名与类名相同扩展名为_ _的字节码文件。2Java中所有类都是类 _ _的子类。3请填出在javalang包中与下列基本数据类型相对应的封装类: float:javalangFloat, char: _ _, boolean: _ _。 4被关键字_修饰的方法是不能被当前类的子类重新定义的方法5线程的四种状态是_ _ 、_ _ 、_ _ 、_ _。6java语言中_ 是所有类的根。7Swing的事件处理机制包括_ _、事件和事件处理者。8URL_ _是的缩写。9java有两类应用程序java Application和_。10转义字符以_开头。三、判断题(本题共5小题,每题2分,共10分)1 ( ) 程序中抛出异常时(throw ),只能抛出自己定义的异常对象。2 ( ) System类中的in是一个输入对象。3 ( ) 实现一个接口,则在类中一定要实现接口中的所有方法。4 ( ) 所有的文件输入/输出流都继承于InputStream类/OutputStream类。5 ( ) 一个异常处理中 finally语句块只能有一个或者可以没有。四、简答题(每小题5分,共2题,10分)1、 Java中面向对象方法的特点有哪些?2、 什么是方法的覆盖?什么是方法的重载?五、阅读程序写出结果(每小题5分,共4题,20分)1)程序的输出结果是 class Number int i;public class ReNumber public static void main(String args) Number n1=new Number(); Number n2=new Number(); n1.i=47; n2.i=13; System.out.println(“n1.i=”+n1.i+”n2.i=”+n2.i); n1=n2; System.out.println(“n1.i=”+n1.i+”n2.i=”+n2.i);2) 程序的输出结果是 interface OneToNint disp(int n);class Sum implements OneToNpublic int disp(int n)int s=0;for(int i=1;i=n;i+)s+=i;return s;public class UseInterfacepublic static void main(String args)int n=5;Sum s=new Sum();System.out.println(s.disp(n);3)以下程序段的输出结果为 。class C1 C1 ( ) System.out.println(1 ); public class C2 extends C2 C 2( ) System.out.println(2 ); public static void main(String args) C2 c = new C2( ); 4)以下程序段的输出结果为 。public class ExchangeNum public static void main(String args) int a; a=new int1,2,3,4,5,6,7,8,9,10; int temp; for(int i=0;i5;i+) temp=ai; ai=a9-i; a9-i=temp; for(int i=0;i10;i+) System.out.print(ai+ ); 答案一 选择题(每题2分,共40分)12345678910BADAADBCAB111213141516
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 药膳汤品食材规范
- 工作场所职业病危害告知牌
- 体检报告解读专业话术手册
- 厂房坍塌应急救援预案
- 蔬菜采后预冷处理管理规范
- 暴雨防汛应急响应工作方案
- 长期服务关怀计划方案
- 重大危险源专项风险管控措施
- 颈椎牵引标准操作流程
- 风电场临电布置方案
- GJB10157-2021军用可编程逻辑器件软件语言编程安全子集
- 南昌市青山湖区2025年公开招聘社区工作者(专职网格员)【45人】模拟试卷含答案解析
- 2025年上海市安全员C3证(专职安全员综合类)操作证考试练习题库(含答案)
- 常备借贷便利管理办法
- YBT《钢包精炼(LF)智能控制系统技术要求》
- 【物理】2025年高考真题-宁夏卷
- 榆林市社区专职招聘笔试真题2024
- 工厂关键岗位管理制度
- 抖音拍摄剪辑课件
- 2025年广东省广州市天河区中考一模物理试题(含答案)
- 教科版(2017)四年级下册科学全册教案(表格式)
评论
0/150
提交评论